OLD | NEW |
1 // Copyright 2011 The Chromium Authors. All rights reserved. | 1 // Copyright 2011 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/layer_tree_host.h" | 5 #include "cc/trees/layer_tree_host.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <algorithm> | 10 #include <algorithm> |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 #include "cc/scheduler/begin_frame_source.h" | 52 #include "cc/scheduler/begin_frame_source.h" |
53 #include "cc/trees/draw_property_utils.h" | 53 #include "cc/trees/draw_property_utils.h" |
54 #include "cc/trees/layer_tree_host_client.h" | 54 #include "cc/trees/layer_tree_host_client.h" |
55 #include "cc/trees/layer_tree_host_common.h" | 55 #include "cc/trees/layer_tree_host_common.h" |
56 #include "cc/trees/layer_tree_host_impl.h" | 56 #include "cc/trees/layer_tree_host_impl.h" |
57 #include "cc/trees/layer_tree_impl.h" | 57 #include "cc/trees/layer_tree_impl.h" |
58 #include "cc/trees/property_tree_builder.h" | 58 #include "cc/trees/property_tree_builder.h" |
59 #include "cc/trees/proxy_main.h" | 59 #include "cc/trees/proxy_main.h" |
60 #include "cc/trees/remote_channel_impl.h" | 60 #include "cc/trees/remote_channel_impl.h" |
61 #include "cc/trees/single_thread_proxy.h" | 61 #include "cc/trees/single_thread_proxy.h" |
| 62 #include "cc/trees/swap_promise_manager.h" |
62 #include "cc/trees/tree_synchronizer.h" | 63 #include "cc/trees/tree_synchronizer.h" |
63 #include "ui/gfx/geometry/size_conversions.h" | 64 #include "ui/gfx/geometry/size_conversions.h" |
64 #include "ui/gfx/geometry/vector2d_conversions.h" | 65 #include "ui/gfx/geometry/vector2d_conversions.h" |
65 | 66 |
66 namespace { | 67 namespace { |
67 static base::StaticAtomicSequenceNumber s_layer_tree_host_sequence_number; | 68 static base::StaticAtomicSequenceNumber s_layer_tree_host_sequence_number; |
68 } | 69 } |
69 | 70 |
70 namespace cc { | 71 namespace cc { |
71 namespace { | 72 namespace { |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
208 LayerTreeHost::LayerTreeHost(InitParams* params, | 209 LayerTreeHost::LayerTreeHost(InitParams* params, |
209 CompositorMode mode, | 210 CompositorMode mode, |
210 std::unique_ptr<LayerTree> layer_tree) | 211 std::unique_ptr<LayerTree> layer_tree) |
211 : micro_benchmark_controller_(this), | 212 : micro_benchmark_controller_(this), |
212 layer_tree_(std::move(layer_tree)), | 213 layer_tree_(std::move(layer_tree)), |
213 next_ui_resource_id_(1), | 214 next_ui_resource_id_(1), |
214 compositor_mode_(mode), | 215 compositor_mode_(mode), |
215 client_(params->client), | 216 client_(params->client), |
216 source_frame_number_(0), | 217 source_frame_number_(0), |
217 rendering_stats_instrumentation_(RenderingStatsInstrumentation::Create()), | 218 rendering_stats_instrumentation_(RenderingStatsInstrumentation::Create()), |
| 219 swap_promise_manager_(base::MakeUnique<SwapPromiseManager>()), |
218 settings_(*params->settings), | 220 settings_(*params->settings), |
219 debug_state_(settings_.initial_debug_state), | 221 debug_state_(settings_.initial_debug_state), |
220 visible_(false), | 222 visible_(false), |
221 has_gpu_rasterization_trigger_(false), | 223 has_gpu_rasterization_trigger_(false), |
222 content_is_suitable_for_gpu_rasterization_(true), | 224 content_is_suitable_for_gpu_rasterization_(true), |
223 gpu_rasterization_histogram_recorded_(false), | 225 gpu_rasterization_histogram_recorded_(false), |
224 did_complete_scale_animation_(false), | 226 did_complete_scale_animation_(false), |
225 id_(s_layer_tree_host_sequence_number.GetNext() + 1), | 227 id_(s_layer_tree_host_sequence_number.GetNext() + 1), |
226 next_commit_forces_redraw_(false), | 228 next_commit_forces_redraw_(false), |
227 shared_bitmap_manager_(params->shared_bitmap_manager), | 229 shared_bitmap_manager_(params->shared_bitmap_manager), |
228 gpu_memory_buffer_manager_(params->gpu_memory_buffer_manager), | 230 gpu_memory_buffer_manager_(params->gpu_memory_buffer_manager), |
229 task_graph_runner_(params->task_graph_runner), | 231 task_graph_runner_(params->task_graph_runner), |
230 image_serialization_processor_(params->image_serialization_processor), | 232 image_serialization_processor_(params->image_serialization_processor) { |
231 surface_client_id_(0u), | |
232 next_surface_sequence_(1u) { | |
233 DCHECK(task_graph_runner_); | 233 DCHECK(task_graph_runner_); |
234 DCHECK(layer_tree_); | 234 DCHECK(layer_tree_); |
235 | 235 |
236 rendering_stats_instrumentation_->set_record_rendering_stats( | 236 rendering_stats_instrumentation_->set_record_rendering_stats( |
237 debug_state_.RecordRenderingStats()); | 237 debug_state_.RecordRenderingStats()); |
238 } | 238 } |
239 | 239 |
240 void LayerTreeHost::InitializeThreaded( | 240 void LayerTreeHost::InitializeThreaded( |
241 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner, | 241 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner, |
242 scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner, | 242 scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner, |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
338 layer_tree_->animation_host()->SetSupportsScrollAnimations( | 338 layer_tree_->animation_host()->SetSupportsScrollAnimations( |
339 proxy_->SupportsImplScrolling()); | 339 proxy_->SupportsImplScrolling()); |
340 } | 340 } |
341 | 341 |
342 LayerTreeHost::~LayerTreeHost() { | 342 LayerTreeHost::~LayerTreeHost() { |
343 TRACE_EVENT0("cc", "LayerTreeHost::~LayerTreeHost"); | 343 TRACE_EVENT0("cc", "LayerTreeHost::~LayerTreeHost"); |
344 | 344 |
345 // Clear any references into the LayerTreeHost. | 345 // Clear any references into the LayerTreeHost. |
346 layer_tree_.reset(); | 346 layer_tree_.reset(); |
347 | 347 |
348 DCHECK(swap_promise_monitor_.empty()); | 348 swap_promise_manager_.reset(); |
349 | |
350 BreakSwapPromises(SwapPromise::COMMIT_FAILS); | |
351 | 349 |
352 if (proxy_) { | 350 if (proxy_) { |
353 DCHECK(task_runner_provider_->IsMainThread()); | 351 DCHECK(task_runner_provider_->IsMainThread()); |
354 proxy_->Stop(); | 352 proxy_->Stop(); |
355 | 353 |
356 // Proxy must be destroyed before the Task Runner Provider. | 354 // Proxy must be destroyed before the Task Runner Provider. |
357 proxy_ = nullptr; | 355 proxy_ = nullptr; |
358 } | 356 } |
359 } | 357 } |
360 | 358 |
(...skipping 10 matching lines...) Expand all Loading... |
371 } | 369 } |
372 | 370 |
373 const LayerTree* LayerTreeHost::GetLayerTree() const { | 371 const LayerTree* LayerTreeHost::GetLayerTree() const { |
374 return layer_tree_.get(); | 372 return layer_tree_.get(); |
375 } | 373 } |
376 | 374 |
377 TaskRunnerProvider* LayerTreeHost::GetTaskRunnerProvider() const { | 375 TaskRunnerProvider* LayerTreeHost::GetTaskRunnerProvider() const { |
378 return task_runner_provider_.get(); | 376 return task_runner_provider_.get(); |
379 } | 377 } |
380 | 378 |
| 379 SwapPromiseManager* LayerTreeHost::GetSwapPromiseManager() const { |
| 380 return swap_promise_manager_.get(); |
| 381 } |
| 382 |
381 const LayerTreeSettings& LayerTreeHost::GetSettings() const { | 383 const LayerTreeSettings& LayerTreeHost::GetSettings() const { |
382 return settings_; | 384 return settings_; |
383 } | 385 } |
384 | 386 |
| 387 SurfaceSequenceGenerator* LayerTreeHost::GetSurfaceSequenceGenerator() { |
| 388 return &surface_sequence_generator_; |
| 389 } |
| 390 |
385 void LayerTreeHost::WillBeginMainFrame() { | 391 void LayerTreeHost::WillBeginMainFrame() { |
386 devtools_instrumentation::WillBeginMainThreadFrame(GetId(), | 392 devtools_instrumentation::WillBeginMainThreadFrame(GetId(), |
387 SourceFrameNumber()); | 393 SourceFrameNumber()); |
388 client_->WillBeginMainFrame(); | 394 client_->WillBeginMainFrame(); |
389 } | 395 } |
390 | 396 |
391 void LayerTreeHost::DidBeginMainFrame() { | 397 void LayerTreeHost::DidBeginMainFrame() { |
392 client_->DidBeginMainFrame(); | 398 client_->DidBeginMainFrame(); |
393 } | 399 } |
394 | 400 |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
437 next_commit_forces_redraw_ = false; | 443 next_commit_forces_redraw_ = false; |
438 } | 444 } |
439 | 445 |
440 sync_tree->set_source_frame_number(SourceFrameNumber()); | 446 sync_tree->set_source_frame_number(SourceFrameNumber()); |
441 | 447 |
442 if (layer_tree_->needs_full_tree_sync()) | 448 if (layer_tree_->needs_full_tree_sync()) |
443 TreeSynchronizer::SynchronizeTrees(layer_tree_->root_layer(), sync_tree); | 449 TreeSynchronizer::SynchronizeTrees(layer_tree_->root_layer(), sync_tree); |
444 | 450 |
445 layer_tree_->PushPropertiesTo(sync_tree); | 451 layer_tree_->PushPropertiesTo(sync_tree); |
446 | 452 |
447 sync_tree->PassSwapPromises(std::move(swap_promise_list_)); | 453 sync_tree->PassSwapPromises(swap_promise_manager_->TakeSwapPromises()); |
448 swap_promise_list_.clear(); | |
449 | 454 |
450 host_impl->SetHasGpuRasterizationTrigger(has_gpu_rasterization_trigger_); | 455 host_impl->SetHasGpuRasterizationTrigger(has_gpu_rasterization_trigger_); |
451 host_impl->SetContentIsSuitableForGpuRasterization( | 456 host_impl->SetContentIsSuitableForGpuRasterization( |
452 content_is_suitable_for_gpu_rasterization_); | 457 content_is_suitable_for_gpu_rasterization_); |
453 RecordGpuRasterizationHistogram(); | 458 RecordGpuRasterizationHistogram(); |
454 | 459 |
455 host_impl->SetViewportSize(layer_tree_->device_viewport_size()); | 460 host_impl->SetViewportSize(layer_tree_->device_viewport_size()); |
456 // TODO(senorblanco): Move this to LayerTree::PushPropertiesTo so that it | 461 // TODO(senorblanco): Move this to LayerTree::PushPropertiesTo so that it |
457 // happens before GPU rasterization properties are set, since those trigger an | 462 // happens before GPU rasterization properties are set, since those trigger an |
458 // update of GPU rasterization status, which depends on the device scale | 463 // update of GPU rasterization status, which depends on the device scale |
(...skipping 26 matching lines...) Expand all Loading... |
485 | 490 |
486 // This must happen after synchronizing property trees and after pushing | 491 // This must happen after synchronizing property trees and after pushing |
487 // properties, which updates the clobber_active_value flag. | 492 // properties, which updates the clobber_active_value flag. |
488 sync_tree->UpdatePropertyTreeScrollOffset(layer_tree_->property_trees()); | 493 sync_tree->UpdatePropertyTreeScrollOffset(layer_tree_->property_trees()); |
489 | 494 |
490 micro_benchmark_controller_.ScheduleImplBenchmarks(host_impl); | 495 micro_benchmark_controller_.ScheduleImplBenchmarks(host_impl); |
491 layer_tree_->property_trees()->ResetAllChangeTracking(); | 496 layer_tree_->property_trees()->ResetAllChangeTracking(); |
492 } | 497 } |
493 | 498 |
494 void LayerTreeHost::WillCommit() { | 499 void LayerTreeHost::WillCommit() { |
495 OnCommitForSwapPromises(); | 500 swap_promise_manager_->WillCommit(); |
496 client_->WillCommit(); | 501 client_->WillCommit(); |
497 } | 502 } |
498 | 503 |
499 void LayerTreeHost::UpdateHudLayer() { | 504 void LayerTreeHost::UpdateHudLayer() { |
500 } | 505 } |
501 | 506 |
502 void LayerTreeHost::CommitComplete() { | 507 void LayerTreeHost::CommitComplete() { |
503 source_frame_number_++; | 508 source_frame_number_++; |
504 client_->DidCommit(); | 509 client_->DidCommit(); |
505 if (did_complete_scale_animation_) { | 510 if (did_complete_scale_animation_) { |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
576 SetNeedsCommit(); | 581 SetNeedsCommit(); |
577 } | 582 } |
578 | 583 |
579 void LayerTreeHost::SetDeferCommits(bool defer_commits) { | 584 void LayerTreeHost::SetDeferCommits(bool defer_commits) { |
580 proxy_->SetDeferCommits(defer_commits); | 585 proxy_->SetDeferCommits(defer_commits); |
581 } | 586 } |
582 | 587 |
583 DISABLE_CFI_PERF | 588 DISABLE_CFI_PERF |
584 void LayerTreeHost::SetNeedsAnimate() { | 589 void LayerTreeHost::SetNeedsAnimate() { |
585 proxy_->SetNeedsAnimate(); | 590 proxy_->SetNeedsAnimate(); |
586 NotifySwapPromiseMonitorsOfSetNeedsCommit(); | 591 swap_promise_manager_->NotifySwapPromiseMonitorsOfSetNeedsCommit(); |
587 } | 592 } |
588 | 593 |
589 DISABLE_CFI_PERF | 594 DISABLE_CFI_PERF |
590 void LayerTreeHost::SetNeedsUpdateLayers() { | 595 void LayerTreeHost::SetNeedsUpdateLayers() { |
591 proxy_->SetNeedsUpdateLayers(); | 596 proxy_->SetNeedsUpdateLayers(); |
592 NotifySwapPromiseMonitorsOfSetNeedsCommit(); | 597 swap_promise_manager_->NotifySwapPromiseMonitorsOfSetNeedsCommit(); |
593 } | 598 } |
594 | 599 |
595 void LayerTreeHost::SetNeedsCommit() { | 600 void LayerTreeHost::SetNeedsCommit() { |
596 proxy_->SetNeedsCommit(); | 601 proxy_->SetNeedsCommit(); |
597 NotifySwapPromiseMonitorsOfSetNeedsCommit(); | 602 swap_promise_manager_->NotifySwapPromiseMonitorsOfSetNeedsCommit(); |
598 } | 603 } |
599 | 604 |
600 void LayerTreeHost::SetNeedsRedraw() { | 605 void LayerTreeHost::SetNeedsRedraw() { |
601 SetNeedsRedrawRect(gfx::Rect(layer_tree_->device_viewport_size())); | 606 SetNeedsRedrawRect(gfx::Rect(layer_tree_->device_viewport_size())); |
602 } | 607 } |
603 | 608 |
604 void LayerTreeHost::SetNeedsRedrawRect(const gfx::Rect& damage_rect) { | 609 void LayerTreeHost::SetNeedsRedrawRect(const gfx::Rect& damage_rect) { |
605 proxy_->SetNeedsRedraw(damage_rect); | 610 proxy_->SetNeedsRedraw(damage_rect); |
606 } | 611 } |
607 | 612 |
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
862 SetNeedsUpdateLayers(); | 867 SetNeedsUpdateLayers(); |
863 } | 868 } |
864 | 869 |
865 void LayerTreeHost::ApplyScrollAndScale(ScrollAndScaleSet* info) { | 870 void LayerTreeHost::ApplyScrollAndScale(ScrollAndScaleSet* info) { |
866 for (auto& swap_promise : info->swap_promises) { | 871 for (auto& swap_promise : info->swap_promises) { |
867 TRACE_EVENT_WITH_FLOW1("input,benchmark", | 872 TRACE_EVENT_WITH_FLOW1("input,benchmark", |
868 "LatencyInfo.Flow", | 873 "LatencyInfo.Flow", |
869 TRACE_ID_DONT_MANGLE(swap_promise->TraceId()), | 874 TRACE_ID_DONT_MANGLE(swap_promise->TraceId()), |
870 TRACE_EVENT_FLAG_FLOW_IN | TRACE_EVENT_FLAG_FLOW_OUT, | 875 TRACE_EVENT_FLAG_FLOW_IN | TRACE_EVENT_FLAG_FLOW_OUT, |
871 "step", "Main thread scroll update"); | 876 "step", "Main thread scroll update"); |
872 QueueSwapPromise(std::move(swap_promise)); | 877 swap_promise_manager_->QueueSwapPromise(std::move(swap_promise)); |
873 } | 878 } |
874 | 879 |
875 if (layer_tree_->root_layer()) { | 880 if (layer_tree_->root_layer()) { |
876 for (size_t i = 0; i < info->scrolls.size(); ++i) { | 881 for (size_t i = 0; i < info->scrolls.size(); ++i) { |
877 Layer* layer = layer_tree_->LayerById(info->scrolls[i].layer_id); | 882 Layer* layer = layer_tree_->LayerById(info->scrolls[i].layer_id); |
878 if (!layer) | 883 if (!layer) |
879 continue; | 884 continue; |
880 layer->SetScrollOffsetFromImplSide(gfx::ScrollOffsetWithDelta( | 885 layer->SetScrollOffsetFromImplSide(gfx::ScrollOffsetWithDelta( |
881 layer->scroll_offset(), info->scrolls[i].scroll_delta)); | 886 layer->scroll_offset(), info->scrolls[i].scroll_delta)); |
882 SetNeedsUpdateLayers(); | 887 SetNeedsUpdateLayers(); |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
980 return micro_benchmark_controller_.ScheduleRun(benchmark_name, | 985 return micro_benchmark_controller_.ScheduleRun(benchmark_name, |
981 std::move(value), callback); | 986 std::move(value), callback); |
982 } | 987 } |
983 | 988 |
984 bool LayerTreeHost::SendMessageToMicroBenchmark( | 989 bool LayerTreeHost::SendMessageToMicroBenchmark( |
985 int id, | 990 int id, |
986 std::unique_ptr<base::Value> value) { | 991 std::unique_ptr<base::Value> value) { |
987 return micro_benchmark_controller_.SendMessage(id, std::move(value)); | 992 return micro_benchmark_controller_.SendMessage(id, std::move(value)); |
988 } | 993 } |
989 | 994 |
990 void LayerTreeHost::InsertSwapPromiseMonitor(SwapPromiseMonitor* monitor) { | |
991 swap_promise_monitor_.insert(monitor); | |
992 } | |
993 | |
994 void LayerTreeHost::RemoveSwapPromiseMonitor(SwapPromiseMonitor* monitor) { | |
995 swap_promise_monitor_.erase(monitor); | |
996 } | |
997 | |
998 void LayerTreeHost::NotifySwapPromiseMonitorsOfSetNeedsCommit() { | |
999 std::set<SwapPromiseMonitor*>::iterator it = swap_promise_monitor_.begin(); | |
1000 for (; it != swap_promise_monitor_.end(); it++) | |
1001 (*it)->OnSetNeedsCommitOnMain(); | |
1002 } | |
1003 | |
1004 void LayerTreeHost::QueueSwapPromise( | |
1005 std::unique_ptr<SwapPromise> swap_promise) { | |
1006 DCHECK(swap_promise); | |
1007 swap_promise_list_.push_back(std::move(swap_promise)); | |
1008 } | |
1009 | |
1010 void LayerTreeHost::BreakSwapPromises(SwapPromise::DidNotSwapReason reason) { | |
1011 for (const auto& swap_promise : swap_promise_list_) | |
1012 swap_promise->DidNotSwap(reason); | |
1013 swap_promise_list_.clear(); | |
1014 } | |
1015 | |
1016 std::vector<std::unique_ptr<SwapPromise>> LayerTreeHost::TakeSwapPromises() { | |
1017 std::vector<std::unique_ptr<SwapPromise>> to_return; | |
1018 to_return.swap(swap_promise_list_); | |
1019 return to_return; | |
1020 } | |
1021 | |
1022 void LayerTreeHost::OnCommitForSwapPromises() { | |
1023 for (const auto& swap_promise : swap_promise_list_) | |
1024 swap_promise->OnCommit(); | |
1025 } | |
1026 | |
1027 void LayerTreeHost::SetSurfaceClientId(uint32_t client_id) { | |
1028 surface_client_id_ = client_id; | |
1029 } | |
1030 | |
1031 SurfaceSequence LayerTreeHost::CreateSurfaceSequence() { | |
1032 return SurfaceSequence(surface_client_id_, next_surface_sequence_++); | |
1033 } | |
1034 | |
1035 void LayerTreeHost::SetLayerTreeMutator( | 995 void LayerTreeHost::SetLayerTreeMutator( |
1036 std::unique_ptr<LayerTreeMutator> mutator) { | 996 std::unique_ptr<LayerTreeMutator> mutator) { |
1037 proxy_->SetMutator(std::move(mutator)); | 997 proxy_->SetMutator(std::move(mutator)); |
1038 } | 998 } |
1039 | 999 |
1040 bool LayerTreeHost::IsSingleThreaded() const { | 1000 bool LayerTreeHost::IsSingleThreaded() const { |
1041 DCHECK(compositor_mode_ != CompositorMode::SINGLE_THREADED || | 1001 DCHECK(compositor_mode_ != CompositorMode::SINGLE_THREADED || |
1042 !task_runner_provider_->HasImplThread()); | 1002 !task_runner_provider_->HasImplThread()); |
1043 return compositor_mode_ == CompositorMode::SINGLE_THREADED; | 1003 return compositor_mode_ == CompositorMode::SINGLE_THREADED; |
1044 } | 1004 } |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1078 // - The output surfaces are only valid on the client-side so they are | 1038 // - The output surfaces are only valid on the client-side so they are |
1079 // therefore not serialized. | 1039 // therefore not serialized. |
1080 // - LayerTreeSettings are needed only during construction of the | 1040 // - LayerTreeSettings are needed only during construction of the |
1081 // LayerTreeHost, so they are serialized outside of the LayerTreeHost | 1041 // LayerTreeHost, so they are serialized outside of the LayerTreeHost |
1082 // serialization. | 1042 // serialization. |
1083 // - The |visible_| flag will be controlled from the client separately and | 1043 // - The |visible_| flag will be controlled from the client separately and |
1084 // will need special handling outside of the serialization of the | 1044 // will need special handling outside of the serialization of the |
1085 // LayerTreeHost. | 1045 // LayerTreeHost. |
1086 // TODO(nyquist): Figure out how to support animations. See crbug.com/570376. | 1046 // TODO(nyquist): Figure out how to support animations. See crbug.com/570376. |
1087 TRACE_EVENT0("cc.remote", "LayerTreeHost::ToProtobufForCommit"); | 1047 TRACE_EVENT0("cc.remote", "LayerTreeHost::ToProtobufForCommit"); |
1088 swap_promises->swap(swap_promise_list_); | 1048 *swap_promises = swap_promise_manager_->TakeSwapPromises(); |
1089 DCHECK(swap_promise_list_.empty()); | |
1090 | 1049 |
1091 proto->set_source_frame_number(source_frame_number_); | 1050 proto->set_source_frame_number(source_frame_number_); |
1092 | 1051 |
1093 // Serialize the LayerTree before serializing the properties. During layer | 1052 // Serialize the LayerTree before serializing the properties. During layer |
1094 // property serialization, we clear the list |layer_that_should_properties_| | 1053 // property serialization, we clear the list |layer_that_should_properties_| |
1095 // from the LayerTree. | 1054 // from the LayerTree. |
1096 layer_tree_->ToProtobuf(proto->mutable_layer_tree()); | 1055 layer_tree_->ToProtobuf(proto->mutable_layer_tree()); |
1097 | 1056 |
1098 LayerProtoConverter::SerializeLayerProperties(this, | 1057 LayerProtoConverter::SerializeLayerProperties(this, |
1099 proto->mutable_layer_updates()); | 1058 proto->mutable_layer_updates()); |
1100 | 1059 |
1101 std::vector<PictureData> pictures = | 1060 std::vector<PictureData> pictures = |
1102 engine_picture_cache_->CalculateCacheUpdateAndFlush(); | 1061 engine_picture_cache_->CalculateCacheUpdateAndFlush(); |
1103 proto::PictureDataVectorToSkPicturesProto(pictures, | 1062 proto::PictureDataVectorToSkPicturesProto(pictures, |
1104 proto->mutable_pictures()); | 1063 proto->mutable_pictures()); |
1105 | 1064 |
1106 debug_state_.ToProtobuf(proto->mutable_debug_state()); | 1065 debug_state_.ToProtobuf(proto->mutable_debug_state()); |
1107 proto->set_has_gpu_rasterization_trigger(has_gpu_rasterization_trigger_); | 1066 proto->set_has_gpu_rasterization_trigger(has_gpu_rasterization_trigger_); |
1108 proto->set_content_is_suitable_for_gpu_rasterization( | 1067 proto->set_content_is_suitable_for_gpu_rasterization( |
1109 content_is_suitable_for_gpu_rasterization_); | 1068 content_is_suitable_for_gpu_rasterization_); |
1110 proto->set_id(id_); | 1069 proto->set_id(id_); |
1111 proto->set_next_commit_forces_redraw(next_commit_forces_redraw_); | 1070 proto->set_next_commit_forces_redraw(next_commit_forces_redraw_); |
1112 | 1071 |
1113 proto->set_surface_client_id(surface_client_id_); | |
1114 proto->set_next_surface_sequence(next_surface_sequence_); | |
1115 | |
1116 TRACE_EVENT_OBJECT_SNAPSHOT_WITH_ID( | 1072 TRACE_EVENT_OBJECT_SNAPSHOT_WITH_ID( |
1117 "cc.remote", "LayerTreeHostProto", source_frame_number_, | 1073 "cc.remote", "LayerTreeHostProto", source_frame_number_, |
1118 ComputeLayerTreeHostProtoSizeSplitAsValue(proto)); | 1074 ComputeLayerTreeHostProtoSizeSplitAsValue(proto)); |
1119 } | 1075 } |
1120 | 1076 |
1121 void LayerTreeHost::FromProtobufForCommit(const proto::LayerTreeHost& proto) { | 1077 void LayerTreeHost::FromProtobufForCommit(const proto::LayerTreeHost& proto) { |
1122 DCHECK(client_picture_cache_); | 1078 DCHECK(client_picture_cache_); |
1123 source_frame_number_ = proto.source_frame_number(); | 1079 source_frame_number_ = proto.source_frame_number(); |
1124 | 1080 |
1125 layer_tree_->FromProtobuf(proto.layer_tree()); | 1081 layer_tree_->FromProtobuf(proto.layer_tree()); |
(...skipping 10 matching lines...) Expand all Loading... |
1136 | 1092 |
1137 // The deserialization is finished, so now clear the cache. | 1093 // The deserialization is finished, so now clear the cache. |
1138 client_picture_cache_->Flush(); | 1094 client_picture_cache_->Flush(); |
1139 | 1095 |
1140 debug_state_.FromProtobuf(proto.debug_state()); | 1096 debug_state_.FromProtobuf(proto.debug_state()); |
1141 has_gpu_rasterization_trigger_ = proto.has_gpu_rasterization_trigger(); | 1097 has_gpu_rasterization_trigger_ = proto.has_gpu_rasterization_trigger(); |
1142 content_is_suitable_for_gpu_rasterization_ = | 1098 content_is_suitable_for_gpu_rasterization_ = |
1143 proto.content_is_suitable_for_gpu_rasterization(); | 1099 proto.content_is_suitable_for_gpu_rasterization(); |
1144 id_ = proto.id(); | 1100 id_ = proto.id(); |
1145 next_commit_forces_redraw_ = proto.next_commit_forces_redraw(); | 1101 next_commit_forces_redraw_ = proto.next_commit_forces_redraw(); |
1146 | |
1147 surface_client_id_ = proto.surface_client_id(); | |
1148 next_surface_sequence_ = proto.next_surface_sequence(); | |
1149 } | 1102 } |
1150 | 1103 |
1151 } // namespace cc | 1104 } // namespace cc |
OLD | NEW |