Revert of cc: Implement shared worker contexts. (patchset #9 id:160001 of https:...
[chromium-blink-merge.git] / content / browser / android / in_process / synchronous_compositor_external_begin_frame_source.h
blobeb7e84b87e645bc28b692db4191654a57d4f32de
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef CONTENT_BROWSER_ANDROID_IN_PROCESS_SYNCHRONOUS_COMPOSITOR_EXTERNAL_BEGIN_FRAME_SOURCE_H_
6 #define CONTENT_BROWSER_ANDROID_IN_PROCESS_SYNCHRONOUS_COMPOSITOR_EXTERNAL_BEGIN_FRAME_SOURCE_H_
8 #include "base/basictypes.h"
9 #include "base/compiler_specific.h"
10 #include "cc/scheduler/begin_frame_source.h"
12 namespace content {
13 class SynchronousCompositorImpl;
15 // Make sure that this is initialized and set to compositor before output
16 // surface is bound to compositor.
17 class SynchronousCompositorExternalBeginFrameSource
18 : public cc::BeginFrameSourceBase {
19 public:
20 explicit SynchronousCompositorExternalBeginFrameSource(int routing_id);
21 ~SynchronousCompositorExternalBeginFrameSource() override;
23 void BeginFrame(const cc::BeginFrameArgs& args);
24 void SetCompositor(SynchronousCompositorImpl* compositor);
26 // cc::BeginFrameSourceBase implementation.
27 void OnNeedsBeginFramesChange(bool needs_begin_frames) override;
28 void SetClientReady() override;
30 private:
31 bool CalledOnValidThread() const;
33 const int routing_id_;
34 bool registered_;
36 // Not owned. This can be null when compositor is gone first than BFS.
37 SynchronousCompositorImpl* compositor_;
39 DISALLOW_COPY_AND_ASSIGN(SynchronousCompositorExternalBeginFrameSource);
42 } // namespace content
44 #endif // CONTENT_BROWSER_ANDROID_IN_PROCESS_SYNCHRONOUS_COMPOSITOR_EXTERNAL_BEGIN_FRAME_SOURCE_H_