OLD | NEW |
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 #include "cc/trees/remote_channel_main.h" | 5 #include "cc/trees/remote_channel_main.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 | 8 |
9 #include "base/memory/ptr_util.h" | 9 #include "base/memory/ptr_util.h" |
10 #include "cc/proto/base_conversions.h" | 10 #include "cc/proto/base_conversions.h" |
11 #include "cc/proto/compositor_message.pb.h" | 11 #include "cc/proto/compositor_message.pb.h" |
12 #include "cc/proto/compositor_message_to_impl.pb.h" | 12 #include "cc/proto/compositor_message_to_impl.pb.h" |
13 #include "cc/proto/compositor_message_to_main.pb.h" | 13 #include "cc/proto/compositor_message_to_main.pb.h" |
14 #include "cc/proto/gfx_conversions.h" | 14 #include "cc/proto/gfx_conversions.h" |
15 #include "cc/trees/layer_tree_host.h" | 15 #include "cc/trees/layer_tree_host_in_process.h" |
16 #include "cc/trees/proxy_main.h" | 16 #include "cc/trees/proxy_main.h" |
17 | 17 |
18 namespace cc { | 18 namespace cc { |
19 | 19 |
20 std::unique_ptr<RemoteChannelMain> RemoteChannelMain::Create( | 20 std::unique_ptr<RemoteChannelMain> RemoteChannelMain::Create( |
21 RemoteProtoChannel* remote_proto_channel, | 21 RemoteProtoChannel* remote_proto_channel, |
22 ProxyMain* proxy_main, | 22 ProxyMain* proxy_main, |
23 TaskRunnerProvider* task_runner_provider) { | 23 TaskRunnerProvider* task_runner_provider) { |
24 return base::WrapUnique(new RemoteChannelMain( | 24 return base::WrapUnique(new RemoteChannelMain( |
25 remote_proto_channel, proxy_main, task_runner_provider)); | 25 remote_proto_channel, proxy_main, task_runner_provider)); |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
165 | 165 |
166 // Notify swap promises that commit had no updates. In the local compositor | 166 // Notify swap promises that commit had no updates. In the local compositor |
167 // case this goes to the impl thread to be queued up in case we have an | 167 // case this goes to the impl thread to be queued up in case we have an |
168 // activation pending but that never happens for remote compositor. | 168 // activation pending but that never happens for remote compositor. |
169 for (const auto& swap_promise : swap_promises) | 169 for (const auto& swap_promise : swap_promises) |
170 swap_promise->DidNotSwap(SwapPromise::COMMIT_NO_UPDATE); | 170 swap_promise->DidNotSwap(SwapPromise::COMMIT_NO_UPDATE); |
171 } | 171 } |
172 | 172 |
173 void RemoteChannelMain::NotifyReadyToCommitOnImpl( | 173 void RemoteChannelMain::NotifyReadyToCommitOnImpl( |
174 CompletionEvent* completion, | 174 CompletionEvent* completion, |
175 LayerTreeHost* layer_tree_host, | 175 LayerTreeHostInProcess* layer_tree_host, |
176 base::TimeTicks main_thread_start_time, | 176 base::TimeTicks main_thread_start_time, |
177 bool hold_commit_for_activation) { | 177 bool hold_commit_for_activation) { |
178 TRACE_EVENT0("cc.remote", "RemoteChannelMain::NotifyReadyToCommitOnImpl"); | 178 TRACE_EVENT0("cc.remote", "RemoteChannelMain::NotifyReadyToCommitOnImpl"); |
179 proto::CompositorMessage proto; | 179 proto::CompositorMessage proto; |
180 proto::CompositorMessageToImpl* to_impl_proto = proto.mutable_to_impl(); | 180 proto::CompositorMessageToImpl* to_impl_proto = proto.mutable_to_impl(); |
181 to_impl_proto->set_message_type(proto::CompositorMessageToImpl::START_COMMIT); | 181 to_impl_proto->set_message_type(proto::CompositorMessageToImpl::START_COMMIT); |
182 proto::StartCommit* start_commit_message = | 182 proto::StartCommit* start_commit_message = |
183 to_impl_proto->mutable_start_commit_message(); | 183 to_impl_proto->mutable_start_commit_message(); |
184 std::vector<std::unique_ptr<SwapPromise>> swap_promises; | 184 std::vector<std::unique_ptr<SwapPromise>> swap_promises; |
185 layer_tree_host->ToProtobufForCommit( | 185 layer_tree_host->ToProtobufForCommit( |
(...skipping 26 matching lines...) Expand all Loading... |
212 // LayerTreeHostClient::DidCommit and stay consistent with the | 212 // LayerTreeHostClient::DidCommit and stay consistent with the |
213 // behaviour in the threaded compositor. | 213 // behaviour in the threaded compositor. |
214 MainThreadTaskRunner()->PostTask( | 214 MainThreadTaskRunner()->PostTask( |
215 FROM_HERE, base::Bind(&RemoteChannelMain::DidCommitAndDrawFrame, | 215 FROM_HERE, base::Bind(&RemoteChannelMain::DidCommitAndDrawFrame, |
216 weak_factory_.GetWeakPtr())); | 216 weak_factory_.GetWeakPtr())); |
217 | 217 |
218 completion->Signal(); | 218 completion->Signal(); |
219 } | 219 } |
220 | 220 |
221 void RemoteChannelMain::SynchronouslyInitializeImpl( | 221 void RemoteChannelMain::SynchronouslyInitializeImpl( |
222 LayerTreeHost* layer_tree_host, | 222 LayerTreeHostInProcess* layer_tree_host, |
223 std::unique_ptr<BeginFrameSource> external_begin_frame_source) { | 223 std::unique_ptr<BeginFrameSource> external_begin_frame_source) { |
224 TRACE_EVENT0("cc.remote", "RemoteChannelMain::SynchronouslyInitializeImpl"); | 224 TRACE_EVENT0("cc.remote", "RemoteChannelMain::SynchronouslyInitializeImpl"); |
225 DCHECK(!initialized_); | 225 DCHECK(!initialized_); |
226 | 226 |
227 initialized_ = true; | 227 initialized_ = true; |
228 } | 228 } |
229 | 229 |
230 void RemoteChannelMain::SynchronouslyCloseImpl() { | 230 void RemoteChannelMain::SynchronouslyCloseImpl() { |
231 TRACE_EVENT0("cc.remote", "RemoteChannelMain::SynchronouslyCloseImpl"); | 231 TRACE_EVENT0("cc.remote", "RemoteChannelMain::SynchronouslyCloseImpl"); |
232 DCHECK(initialized_); | 232 DCHECK(initialized_); |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
270 | 270 |
271 void RemoteChannelMain::DidCompleteSwapBuffers() { | 271 void RemoteChannelMain::DidCompleteSwapBuffers() { |
272 proxy_main_->DidCompleteSwapBuffers(); | 272 proxy_main_->DidCompleteSwapBuffers(); |
273 } | 273 } |
274 | 274 |
275 base::SingleThreadTaskRunner* RemoteChannelMain::MainThreadTaskRunner() const { | 275 base::SingleThreadTaskRunner* RemoteChannelMain::MainThreadTaskRunner() const { |
276 return task_runner_provider_->MainThreadTaskRunner(); | 276 return task_runner_provider_->MainThreadTaskRunner(); |
277 } | 277 } |
278 | 278 |
279 } // namespace cc | 279 } // namespace cc |
OLD | NEW |