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"
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
{
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
;
31 bool CalledOnValidThread() const;
33 const int routing_id_
;
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_