| 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 <unordered_set> | 8 #include <unordered_set> |
| 9 | 9 |
| 10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| 11 #include "base/macros.h" | 11 #include "base/macros.h" |
| 12 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
| 13 #include "base/threading/non_thread_safe.h" | 13 #include "base/threading/thread_checker.h" |
| 14 #include "cc/scheduler/begin_frame_source.h" | 14 #include "cc/scheduler/begin_frame_source.h" |
| 15 #include "content/renderer/gpu/compositor_forwarding_message_filter.h" | 15 #include "content/renderer/gpu/compositor_forwarding_message_filter.h" |
| 16 | 16 |
| 17 namespace IPC { | 17 namespace IPC { |
| 18 class Message; | 18 class Message; |
| 19 class SyncMessageFilter; | 19 class SyncMessageFilter; |
| 20 } | 20 } |
| 21 | 21 |
| 22 namespace content { | 22 namespace content { |
| 23 | 23 |
| 24 // This class can be created only on the main thread, but then becomes pinned | 24 // This class can be created only on the main thread, but then becomes pinned |
| 25 // to a fixed thread where cc::Scheduler is running. | 25 // to a fixed thread where cc::Scheduler is running. |
| 26 // | 26 // |
| 27 // TODO(enne): This only implements the BeginFrameSource interface to | 27 // TODO(enne): This only implements the BeginFrameSource interface to |
| 28 // make it easier to give to cc as an external begin frame source. In the | 28 // make it easier to give to cc as an external begin frame source. In the |
| 29 // future, if this is owned by an output surface, then the internal | 29 // future, if this is owned by an output surface, then the internal |
| 30 // cc::ExternalBeginFrameSource can be the BeginFrameSource passed to cc | 30 // cc::ExternalBeginFrameSource can be the BeginFrameSource passed to cc |
| 31 // directly rather than proxied by this class. | 31 // directly rather than proxied by this class. |
| 32 class CompositorExternalBeginFrameSource | 32 class CompositorExternalBeginFrameSource |
| 33 : public cc::BeginFrameSource, | 33 : public cc::BeginFrameSource, |
| 34 public cc::ExternalBeginFrameSourceClient, | 34 public cc::ExternalBeginFrameSourceClient { |
| 35 public NON_EXPORTED_BASE(base::NonThreadSafe) { | |
| 36 public: | 35 public: |
| 37 explicit CompositorExternalBeginFrameSource( | 36 explicit CompositorExternalBeginFrameSource( |
| 38 CompositorForwardingMessageFilter* filter, | 37 CompositorForwardingMessageFilter* filter, |
| 39 IPC::SyncMessageFilter* sync_message_filter, | 38 IPC::SyncMessageFilter* sync_message_filter, |
| 40 int routing_id); | 39 int routing_id); |
| 41 ~CompositorExternalBeginFrameSource() override; | 40 ~CompositorExternalBeginFrameSource() override; |
| 42 | 41 |
| 43 // cc::BeginFrameSource implementation. | 42 // cc::BeginFrameSource implementation. |
| 44 void AddObserver(cc::BeginFrameObserver* obs) override; | 43 void AddObserver(cc::BeginFrameObserver* obs) override; |
| 45 void RemoveObserver(cc::BeginFrameObserver* obs) override; | 44 void RemoveObserver(cc::BeginFrameObserver* obs) override; |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 // Shared helper implementation. | 80 // Shared helper implementation. |
| 82 cc::ExternalBeginFrameSource external_begin_frame_source_; | 81 cc::ExternalBeginFrameSource external_begin_frame_source_; |
| 83 | 82 |
| 84 scoped_refptr<CompositorForwardingMessageFilter> begin_frame_source_filter_; | 83 scoped_refptr<CompositorForwardingMessageFilter> begin_frame_source_filter_; |
| 85 scoped_refptr<CompositorExternalBeginFrameSourceProxy> | 84 scoped_refptr<CompositorExternalBeginFrameSourceProxy> |
| 86 begin_frame_source_proxy_; | 85 begin_frame_source_proxy_; |
| 87 scoped_refptr<IPC::SyncMessageFilter> message_sender_; | 86 scoped_refptr<IPC::SyncMessageFilter> message_sender_; |
| 88 int routing_id_; | 87 int routing_id_; |
| 89 CompositorForwardingMessageFilter::Handler begin_frame_source_filter_handler_; | 88 CompositorForwardingMessageFilter::Handler begin_frame_source_filter_handler_; |
| 90 | 89 |
| 90 THREAD_CHECKER(thread_checker_); |
| 91 |
| 91 DISALLOW_COPY_AND_ASSIGN(CompositorExternalBeginFrameSource); | 92 DISALLOW_COPY_AND_ASSIGN(CompositorExternalBeginFrameSource); |
| 92 }; | 93 }; |
| 93 | 94 |
| 94 } // namespace content | 95 } // namespace content |
| 95 | 96 |
| 96 #endif // CONTENT_RENDERER_GPU_COMPOSITOR_EXTERNAL_BEGIN_FRAME_SOURCE_H_ | 97 #endif // CONTENT_RENDERER_GPU_COMPOSITOR_EXTERNAL_BEGIN_FRAME_SOURCE_H_ |
| OLD | NEW |