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" |
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
170 CompletionEvent* completion, | 170 CompletionEvent* completion, |
171 LayerTreeHost* layer_tree_host, | 171 LayerTreeHost* layer_tree_host, |
172 base::TimeTicks main_thread_start_time, | 172 base::TimeTicks main_thread_start_time, |
173 bool hold_commit_for_activation) { | 173 bool hold_commit_for_activation) { |
174 TRACE_EVENT0("cc.remote", "RemoteChannelMain::StartCommitOnImpl"); | 174 TRACE_EVENT0("cc.remote", "RemoteChannelMain::StartCommitOnImpl"); |
175 proto::CompositorMessage proto; | 175 proto::CompositorMessage proto; |
176 proto::CompositorMessageToImpl* to_impl_proto = proto.mutable_to_impl(); | 176 proto::CompositorMessageToImpl* to_impl_proto = proto.mutable_to_impl(); |
177 to_impl_proto->set_message_type(proto::CompositorMessageToImpl::START_COMMIT); | 177 to_impl_proto->set_message_type(proto::CompositorMessageToImpl::START_COMMIT); |
178 proto::StartCommit* start_commit_message = | 178 proto::StartCommit* start_commit_message = |
179 to_impl_proto->mutable_start_commit_message(); | 179 to_impl_proto->mutable_start_commit_message(); |
180 std::vector<std::unique_ptr<SwapPromise>> swap_promises; | |
180 layer_tree_host->ToProtobufForCommit( | 181 layer_tree_host->ToProtobufForCommit( |
181 start_commit_message->mutable_layer_tree_host()); | 182 start_commit_message->mutable_layer_tree_host(), &swap_promises); |
182 | 183 |
183 VLOG(1) << "Sending commit message to client. Commit bytes size: " | 184 VLOG(1) << "Sending commit message to client. Commit bytes size: " |
184 << proto.ByteSize(); | 185 << proto.ByteSize(); |
185 SendMessageProto(proto); | 186 SendMessageProto(proto); |
186 | 187 |
188 // Activate the swap promises after the commit is queued. | |
vmpstr
2016/05/18 18:05:59
Can you expand the comment to explain why this is
Khushal
2016/05/18 21:16:58
Sure, Done.
| |
189 for (const auto& swap_promise : swap_promises) | |
190 swap_promise->DidActivate(); | |
191 | |
187 // In order to avoid incurring the overhead for the client to send us a | 192 // In order to avoid incurring the overhead for the client to send us a |
188 // message for when a frame to be committed is drawn we inform the embedder | 193 // message for when a frame to be committed is drawn we inform the embedder |
189 // that the draw was successful immediately after sending the commit message. | 194 // that the draw was successful immediately after sending the commit message. |
190 // Since the compositing state may be used by the embedder to throttle | 195 // Since the compositing state may be used by the embedder to throttle |
191 // commit/draw requests, it is better to allow them to propagate rather than | 196 // commit/draw requests, it is better to allow them to propagate rather than |
192 // incurring a round-trip to get Acks for draw from the client for each frame. | 197 // incurring a round-trip to get Acks for draw from the client for each frame. |
193 | 198 |
194 // This is done as a separate PostTask to ensure that these calls run after | 199 // This is done as a separate PostTask to ensure that these calls run after |
195 // LayerTreeHostClient::DidCommit and stay consistent with the | 200 // LayerTreeHostClient::DidCommit and stay consistent with the |
196 // behaviour in the threaded compositor. | 201 // behaviour in the threaded compositor. |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
270 | 275 |
271 void RemoteChannelMain::DidCompleteSwapBuffers() { | 276 void RemoteChannelMain::DidCompleteSwapBuffers() { |
272 proxy_main_->DidCompleteSwapBuffers(); | 277 proxy_main_->DidCompleteSwapBuffers(); |
273 } | 278 } |
274 | 279 |
275 base::SingleThreadTaskRunner* RemoteChannelMain::MainThreadTaskRunner() const { | 280 base::SingleThreadTaskRunner* RemoteChannelMain::MainThreadTaskRunner() const { |
276 return task_runner_provider_->MainThreadTaskRunner(); | 281 return task_runner_provider_->MainThreadTaskRunner(); |
277 } | 282 } |
278 | 283 |
279 } // namespace cc | 284 } // namespace cc |
OLD | NEW |