OLD | NEW |
| (Empty) |
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. | |
4 | |
5 #ifndef CONTENT_RENDERER_ANDROID_SYNCHRONOUS_COMPOSITOR_EXTERNAL_BEGIN_FRAME_SOU
RCE_H_ | |
6 #define CONTENT_RENDERER_ANDROID_SYNCHRONOUS_COMPOSITOR_EXTERNAL_BEGIN_FRAME_SOU
RCE_H_ | |
7 | |
8 #include "base/compiler_specific.h" | |
9 #include "base/macros.h" | |
10 #include "base/threading/thread_checker.h" | |
11 #include "cc/scheduler/begin_frame_source.h" | |
12 | |
13 namespace content { | |
14 | |
15 class SynchronousCompositorRegistry; | |
16 | |
17 class SynchronousCompositorExternalBeginFrameSourceClient { | |
18 public: | |
19 virtual void OnNeedsBeginFramesChange(bool needs_begin_frames) = 0; | |
20 | |
21 protected: | |
22 virtual ~SynchronousCompositorExternalBeginFrameSourceClient() {} | |
23 }; | |
24 | |
25 // Make sure that this is initialized and set to client before output | |
26 // surface is bound to compositor. | |
27 class SynchronousCompositorExternalBeginFrameSource | |
28 : public cc::BeginFrameSourceBase { | |
29 public: | |
30 SynchronousCompositorExternalBeginFrameSource( | |
31 int routing_id, | |
32 SynchronousCompositorRegistry* registry); | |
33 ~SynchronousCompositorExternalBeginFrameSource() override; | |
34 | |
35 void BeginFrame(const cc::BeginFrameArgs& args); | |
36 void SetClient(SynchronousCompositorExternalBeginFrameSourceClient* client); | |
37 using cc::BeginFrameSourceBase::SetBeginFrameSourcePaused; | |
38 | |
39 // cc::BeginFrameSourceBase implementation. | |
40 void OnNeedsBeginFramesChanged(bool needs_begin_frames) override; | |
41 void AddObserver(cc::BeginFrameObserver* obs) override; | |
42 | |
43 private: | |
44 bool CalledOnValidThread() const; | |
45 | |
46 const int routing_id_; | |
47 SynchronousCompositorRegistry* const registry_; | |
48 bool registered_; | |
49 | |
50 // Not owned. | |
51 SynchronousCompositorExternalBeginFrameSourceClient* client_; | |
52 | |
53 base::ThreadChecker thread_checker_; | |
54 | |
55 DISALLOW_COPY_AND_ASSIGN(SynchronousCompositorExternalBeginFrameSource); | |
56 }; | |
57 | |
58 } // namespace content | |
59 | |
60 #endif // CONTENT_RENDERER_ANDROID_SYNCHRONOUS_COMPOSITOR_EXTERNAL_BEGIN_FRAME_
SOURCE_H_ | |
OLD | NEW |