| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CONTENT_RENDERER_GPU_COMPOSITOR_EXTERNAL_BEGIN_FRAME_SOURCE_H_ | 5 #ifndef CONTENT_RENDERER_GPU_COMPOSITOR_EXTERNAL_BEGIN_FRAME_SOURCE_H_ |
| 6 #define CONTENT_RENDERER_GPU_COMPOSITOR_EXTERNAL_BEGIN_FRAME_SOURCE_H_ | 6 #define CONTENT_RENDERER_GPU_COMPOSITOR_EXTERNAL_BEGIN_FRAME_SOURCE_H_ |
| 7 | 7 |
| 8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
| 9 #include "base/macros.h" | 9 #include "base/macros.h" |
| 10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 public: | 26 public: |
| 27 explicit CompositorExternalBeginFrameSource( | 27 explicit CompositorExternalBeginFrameSource( |
| 28 CompositorForwardingMessageFilter* filter, | 28 CompositorForwardingMessageFilter* filter, |
| 29 IPC::SyncMessageFilter* sync_message_filter, | 29 IPC::SyncMessageFilter* sync_message_filter, |
| 30 int routing_id); | 30 int routing_id); |
| 31 ~CompositorExternalBeginFrameSource() override; | 31 ~CompositorExternalBeginFrameSource() override; |
| 32 | 32 |
| 33 // cc::BeginFrameSourceBase implementation. | 33 // cc::BeginFrameSourceBase implementation. |
| 34 void AddObserver(cc::BeginFrameObserver* obs) override; | 34 void AddObserver(cc::BeginFrameObserver* obs) override; |
| 35 void OnNeedsBeginFramesChanged(bool needs_begin_frames) override; | 35 void OnNeedsBeginFramesChanged(bool needs_begin_frames) override; |
| 36 void SetClientReady() override; | |
| 37 | 36 |
| 38 private: | 37 private: |
| 39 class CompositorExternalBeginFrameSourceProxy | 38 class CompositorExternalBeginFrameSourceProxy |
| 40 : public base::RefCountedThreadSafe< | 39 : public base::RefCountedThreadSafe< |
| 41 CompositorExternalBeginFrameSourceProxy> { | 40 CompositorExternalBeginFrameSourceProxy> { |
| 42 public: | 41 public: |
| 43 explicit CompositorExternalBeginFrameSourceProxy( | 42 explicit CompositorExternalBeginFrameSourceProxy( |
| 44 CompositorExternalBeginFrameSource* begin_frame_source) | 43 CompositorExternalBeginFrameSource* begin_frame_source) |
| 45 : begin_frame_source_(begin_frame_source) {} | 44 : begin_frame_source_(begin_frame_source) {} |
| 46 void ClearBeginFrameSource() { begin_frame_source_ = NULL; } | 45 void ClearBeginFrameSource() { begin_frame_source_ = NULL; } |
| 47 void OnMessageReceived(const IPC::Message& message) { | 46 void OnMessageReceived(const IPC::Message& message) { |
| 48 if (begin_frame_source_) | 47 if (begin_frame_source_) |
| 49 begin_frame_source_->OnMessageReceived(message); | 48 begin_frame_source_->OnMessageReceived(message); |
| 50 } | 49 } |
| 51 | 50 |
| 52 private: | 51 private: |
| 53 friend class base::RefCountedThreadSafe< | 52 friend class base::RefCountedThreadSafe< |
| 54 CompositorExternalBeginFrameSourceProxy>; | 53 CompositorExternalBeginFrameSourceProxy>; |
| 55 virtual ~CompositorExternalBeginFrameSourceProxy() {} | 54 virtual ~CompositorExternalBeginFrameSourceProxy() {} |
| 56 | 55 |
| 57 CompositorExternalBeginFrameSource* begin_frame_source_; | 56 CompositorExternalBeginFrameSource* begin_frame_source_; |
| 58 | 57 |
| 59 DISALLOW_COPY_AND_ASSIGN(CompositorExternalBeginFrameSourceProxy); | 58 DISALLOW_COPY_AND_ASSIGN(CompositorExternalBeginFrameSourceProxy); |
| 60 }; | 59 }; |
| 61 | 60 |
| 61 void SetClientReady(); |
| 62 void OnMessageReceived(const IPC::Message& message); | 62 void OnMessageReceived(const IPC::Message& message); |
| 63 | 63 |
| 64 void OnBeginFrame(const cc::BeginFrameArgs& args); | 64 void OnBeginFrame(const cc::BeginFrameArgs& args); |
| 65 bool Send(IPC::Message* message); | 65 bool Send(IPC::Message* message); |
| 66 | 66 |
| 67 scoped_refptr<CompositorForwardingMessageFilter> begin_frame_source_filter_; | 67 scoped_refptr<CompositorForwardingMessageFilter> begin_frame_source_filter_; |
| 68 scoped_refptr<CompositorExternalBeginFrameSourceProxy> | 68 scoped_refptr<CompositorExternalBeginFrameSourceProxy> |
| 69 begin_frame_source_proxy_; | 69 begin_frame_source_proxy_; |
| 70 scoped_refptr<IPC::SyncMessageFilter> message_sender_; | 70 scoped_refptr<IPC::SyncMessageFilter> message_sender_; |
| 71 int routing_id_; | 71 int routing_id_; |
| 72 CompositorForwardingMessageFilter::Handler begin_frame_source_filter_handler_; | 72 CompositorForwardingMessageFilter::Handler begin_frame_source_filter_handler_; |
| 73 cc::BeginFrameArgs missed_begin_frame_args_; | 73 cc::BeginFrameArgs missed_begin_frame_args_; |
| 74 | 74 |
| 75 DISALLOW_COPY_AND_ASSIGN(CompositorExternalBeginFrameSource); | 75 DISALLOW_COPY_AND_ASSIGN(CompositorExternalBeginFrameSource); |
| 76 }; | 76 }; |
| 77 | 77 |
| 78 } // namespace content | 78 } // namespace content |
| 79 | 79 |
| 80 #endif // CONTENT_RENDERER_GPU_COMPOSITOR_EXTERNAL_BEGIN_FRAME_SOURCE_H_ | 80 #endif // CONTENT_RENDERER_GPU_COMPOSITOR_EXTERNAL_BEGIN_FRAME_SOURCE_H_ |
| OLD | NEW |