Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(501)

Side by Side Diff: cc/trees/remote_channel_impl.h

Issue 2340143002: cc: Rename LayerTreeHost to LayerTreeHostInProcess. (Closed)
Patch Set: comment fix Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « cc/trees/proxy_main.cc ('k') | cc/trees/remote_channel_impl.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 CC_TREES_REMOTE_CHANNEL_IMPL_H_ 5 #ifndef CC_TREES_REMOTE_CHANNEL_IMPL_H_
6 #define CC_TREES_REMOTE_CHANNEL_IMPL_H_ 6 #define CC_TREES_REMOTE_CHANNEL_IMPL_H_
7 7
8 #include "base/macros.h" 8 #include "base/macros.h"
9 #include "base/memory/weak_ptr.h" 9 #include "base/memory/weak_ptr.h"
10 #include "cc/base/cc_export.h" 10 #include "cc/base/cc_export.h"
11 #include "cc/base/completion_event.h" 11 #include "cc/base/completion_event.h"
12 #include "cc/proto/compositor_message_to_impl.pb.h" 12 #include "cc/proto/compositor_message_to_impl.pb.h"
13 #include "cc/trees/channel_impl.h" 13 #include "cc/trees/channel_impl.h"
14 #include "cc/trees/proxy.h" 14 #include "cc/trees/proxy.h"
15 #include "cc/trees/proxy_impl.h" 15 #include "cc/trees/proxy_impl.h"
16 #include "cc/trees/remote_proto_channel.h" 16 #include "cc/trees/remote_proto_channel.h"
17 17
18 namespace cc { 18 namespace cc {
19 class LayerTreeHost; 19 class LayerTreeHostInProcess;
20 20
21 namespace proto { 21 namespace proto {
22 class CompositorMessage; 22 class CompositorMessage;
23 class CompositorMessageToImpl; 23 class CompositorMessageToImpl;
24 class CompositorMessageToMain; 24 class CompositorMessageToMain;
25 } 25 }
26 26
27 // The Proxy and ChannelImpl implementation for the remote compositor. 27 // The Proxy and ChannelImpl implementation for the remote compositor.
28 // The object life cycle and communication across threads is as follows: 28 // The object life cycle and communication across threads is as follows:
29 // 29 //
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 // the impl thread since: 63 // the impl thread since:
64 // 1) The only impl threaded callers of RemoteChannelImpl is the 64 // 1) The only impl threaded callers of RemoteChannelImpl is the
65 // RemoteChannelImpl itself and ProxyImpl which is created and owned by the 65 // RemoteChannelImpl itself and ProxyImpl which is created and owned by the
66 // RemoteChannelImpl. 66 // RemoteChannelImpl.
67 // 2) The RemoteChannelImpl blocks the main thread in its dtor to wait for the 67 // 2) The RemoteChannelImpl blocks the main thread in its dtor to wait for the
68 // impl-thread teardown to complete, which ensures that any tasks queued to call 68 // impl-thread teardown to complete, which ensures that any tasks queued to call
69 // it on the impl thread are run before it is destroyed on the main thread. 69 // it on the impl thread are run before it is destroyed on the main thread.
70 // 70 //
71 // The RemoteChannelImpl receives and processes messages from the remote server 71 // The RemoteChannelImpl receives and processes messages from the remote server
72 // compositor on the main thread. The requests from ProxyImpl are received on 72 // compositor on the main thread. The requests from ProxyImpl are received on
73 // the impl thread which may be directed to the LayerTreeHost on the client 73 // the impl thread which may be directed to the LayerTreeHostInProcesson the
74 // (for instance output surface requests) or sent to the LayerTreeHost on the 74 // client (for instance output surface requests) or sent to the
75 // server. The messages to the server are created on the impl thread and sent 75 // LayerTreeHostInProcess on the server. The messages to the server are created
76 // using the RemoteProtoChannel on the main thread. 76 // on the impl thread and sent using the RemoteProtoChannel on the main thread.
77 class CC_EXPORT RemoteChannelImpl : public ChannelImpl, 77 class CC_EXPORT RemoteChannelImpl : public ChannelImpl,
78 public RemoteProtoChannel::ProtoReceiver, 78 public RemoteProtoChannel::ProtoReceiver,
79 public Proxy { 79 public Proxy {
80 public: 80 public:
81 RemoteChannelImpl(LayerTreeHost* layer_tree_host, 81 RemoteChannelImpl(LayerTreeHostInProcess* layer_tree_host,
82 RemoteProtoChannel* remote_proto_channel, 82 RemoteProtoChannel* remote_proto_channel,
83 TaskRunnerProvider* task_runner_provider); 83 TaskRunnerProvider* task_runner_provider);
84 ~RemoteChannelImpl() override; 84 ~RemoteChannelImpl() override;
85 85
86 // virtual for testing. 86 // virtual for testing.
87 virtual std::unique_ptr<ProxyImpl> CreateProxyImpl( 87 virtual std::unique_ptr<ProxyImpl> CreateProxyImpl(
88 ChannelImpl* channel_impl, 88 ChannelImpl* channel_impl,
89 LayerTreeHost* layer_tree_host, 89 LayerTreeHostInProcess* layer_tree_host,
90 TaskRunnerProvider* task_runner_provider, 90 TaskRunnerProvider* task_runner_provider,
91 std::unique_ptr<BeginFrameSource> external_begin_frame_source); 91 std::unique_ptr<BeginFrameSource> external_begin_frame_source);
92 92
93 private: 93 private:
94 struct MainThreadOnly { 94 struct MainThreadOnly {
95 LayerTreeHost* layer_tree_host; 95 LayerTreeHostInProcess* layer_tree_host;
96 RemoteProtoChannel* remote_proto_channel; 96 RemoteProtoChannel* remote_proto_channel;
97 97
98 bool started; 98 bool started;
99 99
100 // This is set to true if we lost the output surface and can not push any 100 // This is set to true if we lost the output surface and can not push any
101 // commits to the impl thread. 101 // commits to the impl thread.
102 bool waiting_for_compositor_frame_sink_initialization; 102 bool waiting_for_compositor_frame_sink_initialization;
103 103
104 // The queue of messages received from the server. The messages are added to 104 // The queue of messages received from the server. The messages are added to
105 // this queue if we are waiting for a new output surface to be initialized. 105 // this queue if we are waiting for a new output surface to be initialized.
106 std::queue<proto::CompositorMessageToImpl> pending_messages; 106 std::queue<proto::CompositorMessageToImpl> pending_messages;
107 107
108 base::WeakPtrFactory<RemoteChannelImpl> remote_channel_weak_factory; 108 base::WeakPtrFactory<RemoteChannelImpl> remote_channel_weak_factory;
109 109
110 MainThreadOnly(RemoteChannelImpl*, 110 MainThreadOnly(RemoteChannelImpl*,
111 LayerTreeHost* layer_tree_host, 111 LayerTreeHostInProcess* layer_tree_host,
112 RemoteProtoChannel* remote_proto_channel); 112 RemoteProtoChannel* remote_proto_channel);
113 ~MainThreadOnly(); 113 ~MainThreadOnly();
114 }; 114 };
115 115
116 struct CompositorThreadOnly { 116 struct CompositorThreadOnly {
117 std::unique_ptr<ProxyImpl> proxy_impl; 117 std::unique_ptr<ProxyImpl> proxy_impl;
118 std::unique_ptr<base::WeakPtrFactory<ProxyImpl>> proxy_impl_weak_factory; 118 std::unique_ptr<base::WeakPtrFactory<ProxyImpl>> proxy_impl_weak_factory;
119 base::WeakPtr<RemoteChannelImpl> remote_channel_weak_ptr; 119 base::WeakPtr<RemoteChannelImpl> remote_channel_weak_ptr;
120 120
121 CompositorThreadOnly( 121 CompositorThreadOnly(
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 void HandleProto(const proto::CompositorMessageToImpl& proto); 174 void HandleProto(const proto::CompositorMessageToImpl& proto);
175 void DidCompleteSwapBuffersOnMain(); 175 void DidCompleteSwapBuffersOnMain();
176 void DidCommitAndDrawFrameOnMain(); 176 void DidCommitAndDrawFrameOnMain();
177 void DidLoseCompositorFrameSinkOnMain(); 177 void DidLoseCompositorFrameSinkOnMain();
178 void RequestNewCompositorFrameSinkOnMain(); 178 void RequestNewCompositorFrameSinkOnMain();
179 void DidInitializeCompositorFrameSinkOnMain(bool success); 179 void DidInitializeCompositorFrameSinkOnMain(bool success);
180 void SendMessageProtoOnMain(std::unique_ptr<proto::CompositorMessage> proto); 180 void SendMessageProtoOnMain(std::unique_ptr<proto::CompositorMessage> proto);
181 void PostSetNeedsRedrawToImpl(const gfx::Rect& damaged_rect); 181 void PostSetNeedsRedrawToImpl(const gfx::Rect& damaged_rect);
182 182
183 void InitializeImplOnImpl(CompletionEvent* completion, 183 void InitializeImplOnImpl(CompletionEvent* completion,
184 LayerTreeHost* layer_tree_host); 184 LayerTreeHostInProcess* layer_tree_host);
185 void ShutdownImplOnImpl(CompletionEvent* completion); 185 void ShutdownImplOnImpl(CompletionEvent* completion);
186 186
187 MainThreadOnly& main(); 187 MainThreadOnly& main();
188 const MainThreadOnly& main() const; 188 const MainThreadOnly& main() const;
189 CompositorThreadOnly& impl(); 189 CompositorThreadOnly& impl();
190 const CompositorThreadOnly& impl() const; 190 const CompositorThreadOnly& impl() const;
191 191
192 base::SingleThreadTaskRunner* MainThreadTaskRunner() const; 192 base::SingleThreadTaskRunner* MainThreadTaskRunner() const;
193 base::SingleThreadTaskRunner* ImplThreadTaskRunner() const; 193 base::SingleThreadTaskRunner* ImplThreadTaskRunner() const;
194 194
195 TaskRunnerProvider* task_runner_provider_; 195 TaskRunnerProvider* task_runner_provider_;
196 196
197 // use accessors instead of these variables directly 197 // use accessors instead of these variables directly
198 MainThreadOnly main_thread_vars_unsafe_; 198 MainThreadOnly main_thread_vars_unsafe_;
199 CompositorThreadOnly compositor_thread_vars_unsafe_; 199 CompositorThreadOnly compositor_thread_vars_unsafe_;
200 200
201 base::WeakPtr<ProxyImpl> proxy_impl_weak_ptr_; 201 base::WeakPtr<ProxyImpl> proxy_impl_weak_ptr_;
202 202
203 DISALLOW_COPY_AND_ASSIGN(RemoteChannelImpl); 203 DISALLOW_COPY_AND_ASSIGN(RemoteChannelImpl);
204 }; 204 };
205 205
206 } // namespace cc 206 } // namespace cc
207 207
208 #endif // CC_TREES_REMOTE_CHANNEL_IMPL_H_ 208 #endif // CC_TREES_REMOTE_CHANNEL_IMPL_H_
OLDNEW
« no previous file with comments | « cc/trees/proxy_main.cc ('k') | cc/trees/remote_channel_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698