Chromium Code Reviews| 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_GPU_COMPOSITOR_EXTERNAL_BEGIN_FRAME_SOURCE_H_ | |
| 6 #define CONTENT_RENDERER_GPU_COMPOSITOR_EXTERNAL_BEGIN_FRAME_SOURCE_H_ | |
| 7 | |
| 8 #include "base/basictypes.h" | |
| 9 #include "base/compiler_specific.h" | |
| 10 #include "base/memory/ref_counted.h" | |
| 11 #include "base/threading/non_thread_safe.h" | |
| 12 #include "cc/scheduler/begin_frame_source.h" | |
| 13 | |
| 14 namespace base { | |
| 15 class TaskRunner; | |
| 16 } | |
| 17 | |
| 18 namespace IPC { | |
| 19 class ForwardingMessageFilter; | |
| 20 class Message; | |
| 21 class SyncMessageFilter; | |
| 22 } | |
| 23 | |
| 24 namespace content { | |
| 25 | |
| 26 // This class can be created only on the main thread, but then becomes pinned | |
| 27 // to a fixed thread where cc::Scheduler is running. | |
| 28 class CompositorExternalBeginFrameSource | |
| 29 : public cc::ExternalBeginFrameSource, | |
|
danakj
2014/10/10 16:03:36
This would inherit from the BFSMixin and also the
simonhong
2014/10/15 01:04:22
ditto.
| |
| 30 NON_EXPORTED_BASE(public base::NonThreadSafe) { | |
| 31 public: | |
| 32 static IPC::ForwardingMessageFilter* CreateFilter( | |
| 33 base::TaskRunner* target_task_runner); | |
| 34 | |
| 35 explicit CompositorExternalBeginFrameSource(int routing_id); | |
| 36 virtual ~CompositorExternalBeginFrameSource(); | |
| 37 | |
| 38 // cc::ExternalBeginFrameSource implementation. | |
| 39 virtual void OnNeedsBeginFramesChange(bool needs_begin_frames) OVERRIDE; | |
|
Sami
2014/10/10 13:32:33
nit: I think we can now write just
virtual void
danakj
2014/10/10 16:03:36
+1
simonhong
2014/10/15 01:04:22
Done.
| |
| 40 virtual void SetClientReady() OVERRIDE; | |
| 41 | |
| 42 private: | |
| 43 class CompositorExternalBeginFrameSourceProxy | |
| 44 : public base::RefCountedThreadSafe< | |
| 45 CompositorExternalBeginFrameSourceProxy> { | |
| 46 public: | |
| 47 explicit CompositorExternalBeginFrameSourceProxy( | |
| 48 CompositorExternalBeginFrameSource* begin_frame_source) | |
| 49 : begin_frame_source_(begin_frame_source) {} | |
| 50 void ClearBeginFrameSource() { begin_frame_source_ = NULL; } | |
| 51 void OnMessageReceived(const IPC::Message& message) { | |
| 52 if (begin_frame_source_) | |
| 53 begin_frame_source_->OnMessageReceived(message); | |
| 54 } | |
| 55 | |
| 56 private: | |
| 57 friend class base::RefCountedThreadSafe< | |
| 58 CompositorExternalBeginFrameSourceProxy>; | |
| 59 ~CompositorExternalBeginFrameSourceProxy() {} | |
| 60 | |
| 61 CompositorExternalBeginFrameSource* begin_frame_source_; | |
| 62 | |
| 63 DISALLOW_COPY_AND_ASSIGN(CompositorExternalBeginFrameSourceProxy); | |
| 64 }; | |
| 65 | |
| 66 void OnMessageReceived(const IPC::Message& message); | |
| 67 | |
| 68 void OnBeginFrame(const cc::BeginFrameArgs& args); | |
| 69 bool Send(IPC::Message* message); | |
| 70 | |
| 71 scoped_refptr<IPC::ForwardingMessageFilter> begin_frame_source_filter_; | |
| 72 scoped_refptr<CompositorExternalBeginFrameSourceProxy> | |
| 73 begin_frame_source_proxy_; | |
| 74 scoped_refptr<IPC::SyncMessageFilter> message_sender_; | |
| 75 bool is_client_ready_; | |
| 76 int routing_id_; | |
| 77 | |
| 78 DISALLOW_COPY_AND_ASSIGN(CompositorExternalBeginFrameSource); | |
| 79 }; | |
| 80 | |
| 81 } // namespace content | |
| 82 | |
| 83 #endif // CONTENT_RENDERER_GPU_COMPOSITOR_EXTERNAL_BEGIN_FRAME_SOURCE_H_ | |
| OLD | NEW |