Index: cc/trees/remote_channel_impl.h |
diff --git a/cc/trees/remote_channel_impl.h b/cc/trees/remote_channel_impl.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..5d264aef7059d260afcdbc1fa5374870f8809e45 |
--- /dev/null |
+++ b/cc/trees/remote_channel_impl.h |
@@ -0,0 +1,136 @@ |
+// Copyright 2015 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef CC_TREES_REMOTE_CHANNEL_IMPL_H_ |
+#define CC_TREES_REMOTE_CHANNEL_IMPL_H_ |
+ |
+#include "base/macros.h" |
+#include "base/memory/weak_ptr.h" |
+#include "cc/base/cc_export.h" |
+#include "cc/base/completion_event.h" |
+#include "cc/raster/task_graph_runner.h" |
+#include "cc/trees/channel_impl.h" |
+#include "cc/trees/proxy_impl.h" |
+#include "cc/trees/remote_proto_channel.h" |
+ |
+namespace cc { |
+class LayerTreeHost; |
+class LayerTreeSettings; |
+class RemoteChannelHost; |
+ |
+namespace proto { |
+class CompositorMessage; |
+class CompositorMessageToImpl; |
+class CompositorMessageToMain; |
+class InitializeImpl; |
+} |
+ |
+class CC_EXPORT RemoteChannelImpl : public ChannelImpl { |
+ public: |
+ static scoped_ptr<RemoteChannelImpl> Create( |
+ RemoteChannelHost* remote_channel_host, |
+ TaskGraphRunner* task_graph_runner, |
+ const LayerTreeSettings& settings, |
+ scoped_refptr<base::SingleThreadTaskRunner> main_task_runner, |
+ scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner); |
+ |
+ ~RemoteChannelImpl() override; |
+ |
+ void Initialize(); |
+ |
+ void HandleProto(const proto::CompositorMessageToImpl& proto); |
+ |
+ // Should be called on impl thread only. |
+ ProxyImpl* GetProxyImplForTesting() const; |
+ |
+ protected: |
+ RemoteChannelImpl( |
+ RemoteChannelHost* remote_channel_host, |
+ TaskGraphRunner* task_graph_runner, |
+ const LayerTreeSettings& settings, |
+ scoped_refptr<base::SingleThreadTaskRunner> main_task_runner, |
+ scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner); |
+ |
+ // virtual for testing. |
+ virtual scoped_ptr<ProxyImpl> CreateProxyImpl( |
+ ChannelImpl* channel_impl, |
+ LayerTreeHost* layer_tree_host, |
+ TaskRunnerProvider* task_runner_provider, |
+ scoped_ptr<BeginFrameSource> external_begin_frame_source); |
+ |
+ bool MainFrameWillHappenForTesting(); |
+ |
+ private: |
+ struct MainThreadOnly { |
+ RemoteChannelHost* remote_channel_host; |
+ scoped_ptr<LayerTreeHost> layer_tree_host; |
David Trainor- moved to gerrit
2015/12/11 17:13:44
Comment about the specifics/expectations of this L
Khushal
2015/12/11 22:49:37
Done.
|
+ |
+ MainThreadOnly( |
+ RemoteChannelImpl* remote_channel_impl, |
+ RemoteChannelHost* remote_channel_host, |
+ TaskGraphRunner* task_graph_runner, |
+ const LayerTreeSettings& settings, |
+ scoped_refptr<base::SingleThreadTaskRunner> main_task_runner, |
+ scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner); |
+ ~MainThreadOnly(); |
+ }; |
+ |
+ struct CompositorThreadOnly { |
+ scoped_ptr<ProxyImpl> proxy_impl; |
+ scoped_ptr<base::WeakPtrFactory<ProxyImpl>> proxy_impl_weak_factory; |
+ |
+ CompositorThreadOnly(); |
+ ~CompositorThreadOnly(); |
+ }; |
+ |
+ // Called on impl thread. |
+ // ChannelImpl implementation |
+ void DidCompleteSwapBuffers() override; |
+ void SetRendererCapabilitiesMainCopy( |
+ const RendererCapabilities& capabilities) override; |
+ void BeginMainFrameNotExpectedSoon() override; |
+ void DidCommitAndDrawFrame() override; |
+ void SetAnimationEvents(scoped_ptr<AnimationEventsVector> queue) override; |
+ void DidLoseOutputSurface() override; |
+ void RequestNewOutputSurface() override; |
+ void DidInitializeOutputSurface( |
+ bool success, |
+ const RendererCapabilities& capabilities) override; |
+ void DidCompletePageScaleAnimation() override; |
+ void PostFrameTimingEventsOnMain( |
+ scoped_ptr<FrameTimingTracker::CompositeTimingSet> composite_events, |
+ scoped_ptr<FrameTimingTracker::MainFrameTimingSet> main_frame_events) |
+ override; |
+ void BeginMainFrame( |
+ scoped_ptr<BeginMainFrameAndCommitState> begin_main_frame_state) override; |
+ |
+ // Called on impl thread. |
David Trainor- moved to gerrit
2015/12/11 17:13:44
Do you need this if you have it above? I'm fine w
Khushal
2015/12/11 22:49:37
I wasn't sure if having the comment only above the
|
+ void InitializeImplOnImpl(CompletionEvent* completion, |
+ LayerTreeHost* layer_tree_host); |
+ void ShutdownImplOnImpl(CompletionEvent* completion); |
+ |
+ // Called on main thread. |
+ void MainThreadHasStoppedFlinging(); |
+ |
+ MainThreadOnly& main(); |
+ CompositorThreadOnly& impl(); |
+ const CompositorThreadOnly& impl() const; |
+ |
+ base::SingleThreadTaskRunner* MainThreadTaskRunner() const; |
+ base::SingleThreadTaskRunner* ImplThreadTaskRunner() const; |
+ |
+ // use accessors instead of these variables directly |
+ MainThreadOnly main_thread_vars_unsafe_; |
+ CompositorThreadOnly compositor_thread_vars_unsafe_; |
+ |
+ TaskRunnerProvider* task_runner_provider_; |
+ |
+ base::WeakPtr<ProxyImpl> proxy_impl_weak_ptr_; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(RemoteChannelImpl); |
+}; |
+ |
+} // namespace cc |
+ |
+#endif // CC_TREES_REMOTE_CHANNEL_IMPL_H_ |