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 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
220 visible_(false), | 221 visible_(false), |
221 has_gpu_rasterization_trigger_(false), | 222 has_gpu_rasterization_trigger_(false), |
222 content_is_suitable_for_gpu_rasterization_(true), | 223 content_is_suitable_for_gpu_rasterization_(true), |
223 gpu_rasterization_histogram_recorded_(false), | 224 gpu_rasterization_histogram_recorded_(false), |
224 did_complete_scale_animation_(false), | 225 did_complete_scale_animation_(false), |
225 id_(s_layer_tree_host_sequence_number.GetNext() + 1), | 226 id_(s_layer_tree_host_sequence_number.GetNext() + 1), |
226 next_commit_forces_redraw_(false), | 227 next_commit_forces_redraw_(false), |
227 shared_bitmap_manager_(params->shared_bitmap_manager), | 228 shared_bitmap_manager_(params->shared_bitmap_manager), |
228 gpu_memory_buffer_manager_(params->gpu_memory_buffer_manager), | 229 gpu_memory_buffer_manager_(params->gpu_memory_buffer_manager), |
229 task_graph_runner_(params->task_graph_runner), | 230 task_graph_runner_(params->task_graph_runner), |
230 image_serialization_processor_(params->image_serialization_processor), | 231 image_serialization_processor_(params->image_serialization_processor) { |
231 surface_client_id_(0u), | |
232 next_surface_sequence_(1u) { | |
233 DCHECK(task_graph_runner_); | 232 DCHECK(task_graph_runner_); |
234 DCHECK(layer_tree_); | 233 DCHECK(layer_tree_); |
235 | 234 |
236 rendering_stats_instrumentation_->set_record_rendering_stats( | 235 rendering_stats_instrumentation_->set_record_rendering_stats( |
237 debug_state_.RecordRenderingStats()); | 236 debug_state_.RecordRenderingStats()); |
238 } | 237 } |
239 | 238 |
240 void LayerTreeHost::InitializeThreaded( | 239 void LayerTreeHost::InitializeThreaded( |
241 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner, | 240 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner, |
242 scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner, | 241 scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner, |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
343 layer_tree_->animation_host()->SetSupportsScrollAnimations( | 342 layer_tree_->animation_host()->SetSupportsScrollAnimations( |
344 proxy_->SupportsImplScrolling()); | 343 proxy_->SupportsImplScrolling()); |
345 } | 344 } |
346 | 345 |
347 LayerTreeHost::~LayerTreeHost() { | 346 LayerTreeHost::~LayerTreeHost() { |
348 TRACE_EVENT0("cc", "LayerTreeHost::~LayerTreeHost"); | 347 TRACE_EVENT0("cc", "LayerTreeHost::~LayerTreeHost"); |
349 | 348 |
350 // Clear any references into the LayerTreeHost. | 349 // Clear any references into the LayerTreeHost. |
351 layer_tree_.reset(); | 350 layer_tree_.reset(); |
352 | 351 |
353 DCHECK(swap_promise_monitor_.empty()); | |
354 | |
355 BreakSwapPromises(SwapPromise::COMMIT_FAILS); | |
356 | |
357 if (proxy_) { | 352 if (proxy_) { |
358 DCHECK(task_runner_provider_->IsMainThread()); | 353 DCHECK(task_runner_provider_->IsMainThread()); |
359 proxy_->Stop(); | 354 proxy_->Stop(); |
360 | 355 |
361 // Proxy must be destroyed before the Task Runner Provider. | 356 // Proxy must be destroyed before the Task Runner Provider. |
362 proxy_ = nullptr; | 357 proxy_ = nullptr; |
363 } | 358 } |
364 } | 359 } |
365 | 360 |
366 int LayerTreeHost::GetId() const { | 361 int LayerTreeHost::GetId() const { |
(...skipping 13 matching lines...) Expand all Loading... |
380 } | 375 } |
381 | 376 |
382 UIResourceManager* LayerTreeHost::GetUIResourceManager() const { | 377 UIResourceManager* LayerTreeHost::GetUIResourceManager() const { |
383 return ui_resource_manager_.get(); | 378 return ui_resource_manager_.get(); |
384 } | 379 } |
385 | 380 |
386 TaskRunnerProvider* LayerTreeHost::GetTaskRunnerProvider() const { | 381 TaskRunnerProvider* LayerTreeHost::GetTaskRunnerProvider() const { |
387 return task_runner_provider_.get(); | 382 return task_runner_provider_.get(); |
388 } | 383 } |
389 | 384 |
| 385 SwapPromiseManager* LayerTreeHost::GetSwapPromiseManager() { |
| 386 return &swap_promise_manager_; |
| 387 } |
| 388 |
390 const LayerTreeSettings& LayerTreeHost::GetSettings() const { | 389 const LayerTreeSettings& LayerTreeHost::GetSettings() const { |
391 return settings_; | 390 return settings_; |
392 } | 391 } |
393 | 392 |
| 393 void LayerTreeHost::SetSurfaceClientId(uint32_t client_id) { |
| 394 surface_sequence_generator_.set_surface_client_id(client_id); |
| 395 } |
| 396 |
| 397 void LayerTreeHost::QueueSwapPromise( |
| 398 std::unique_ptr<SwapPromise> swap_promise) { |
| 399 swap_promise_manager_.QueueSwapPromise(std::move(swap_promise)); |
| 400 } |
| 401 |
| 402 SurfaceSequenceGenerator* LayerTreeHost::GetSurfaceSequenceGenerator() { |
| 403 return &surface_sequence_generator_; |
| 404 } |
| 405 |
394 void LayerTreeHost::WillBeginMainFrame() { | 406 void LayerTreeHost::WillBeginMainFrame() { |
395 devtools_instrumentation::WillBeginMainThreadFrame(GetId(), | 407 devtools_instrumentation::WillBeginMainThreadFrame(GetId(), |
396 SourceFrameNumber()); | 408 SourceFrameNumber()); |
397 client_->WillBeginMainFrame(); | 409 client_->WillBeginMainFrame(); |
398 } | 410 } |
399 | 411 |
400 void LayerTreeHost::DidBeginMainFrame() { | 412 void LayerTreeHost::DidBeginMainFrame() { |
401 client_->DidBeginMainFrame(); | 413 client_->DidBeginMainFrame(); |
402 } | 414 } |
403 | 415 |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
446 next_commit_forces_redraw_ = false; | 458 next_commit_forces_redraw_ = false; |
447 } | 459 } |
448 | 460 |
449 sync_tree->set_source_frame_number(SourceFrameNumber()); | 461 sync_tree->set_source_frame_number(SourceFrameNumber()); |
450 | 462 |
451 if (layer_tree_->needs_full_tree_sync()) | 463 if (layer_tree_->needs_full_tree_sync()) |
452 TreeSynchronizer::SynchronizeTrees(layer_tree_->root_layer(), sync_tree); | 464 TreeSynchronizer::SynchronizeTrees(layer_tree_->root_layer(), sync_tree); |
453 | 465 |
454 layer_tree_->PushPropertiesTo(sync_tree); | 466 layer_tree_->PushPropertiesTo(sync_tree); |
455 | 467 |
456 sync_tree->PassSwapPromises(std::move(swap_promise_list_)); | 468 sync_tree->PassSwapPromises(swap_promise_manager_.TakeSwapPromises()); |
457 swap_promise_list_.clear(); | |
458 | 469 |
459 host_impl->SetHasGpuRasterizationTrigger(has_gpu_rasterization_trigger_); | 470 host_impl->SetHasGpuRasterizationTrigger(has_gpu_rasterization_trigger_); |
460 host_impl->SetContentIsSuitableForGpuRasterization( | 471 host_impl->SetContentIsSuitableForGpuRasterization( |
461 content_is_suitable_for_gpu_rasterization_); | 472 content_is_suitable_for_gpu_rasterization_); |
462 RecordGpuRasterizationHistogram(); | 473 RecordGpuRasterizationHistogram(); |
463 | 474 |
464 host_impl->SetViewportSize(layer_tree_->device_viewport_size()); | 475 host_impl->SetViewportSize(layer_tree_->device_viewport_size()); |
465 // TODO(senorblanco): Move this to LayerTree::PushPropertiesTo so that it | 476 // TODO(senorblanco): Move this to LayerTree::PushPropertiesTo so that it |
466 // happens before GPU rasterization properties are set, since those trigger an | 477 // happens before GPU rasterization properties are set, since those trigger an |
467 // update of GPU rasterization status, which depends on the device scale | 478 // update of GPU rasterization status, which depends on the device scale |
(...skipping 24 matching lines...) Expand all Loading... |
492 | 503 |
493 // This must happen after synchronizing property trees and after pushing | 504 // This must happen after synchronizing property trees and after pushing |
494 // properties, which updates the clobber_active_value flag. | 505 // properties, which updates the clobber_active_value flag. |
495 sync_tree->UpdatePropertyTreeScrollOffset(layer_tree_->property_trees()); | 506 sync_tree->UpdatePropertyTreeScrollOffset(layer_tree_->property_trees()); |
496 | 507 |
497 micro_benchmark_controller_.ScheduleImplBenchmarks(host_impl); | 508 micro_benchmark_controller_.ScheduleImplBenchmarks(host_impl); |
498 layer_tree_->property_trees()->ResetAllChangeTracking(); | 509 layer_tree_->property_trees()->ResetAllChangeTracking(); |
499 } | 510 } |
500 | 511 |
501 void LayerTreeHost::WillCommit() { | 512 void LayerTreeHost::WillCommit() { |
502 OnCommitForSwapPromises(); | 513 swap_promise_manager_.WillCommit(); |
503 client_->WillCommit(); | 514 client_->WillCommit(); |
504 } | 515 } |
505 | 516 |
506 void LayerTreeHost::UpdateHudLayer() { | 517 void LayerTreeHost::UpdateHudLayer() { |
507 } | 518 } |
508 | 519 |
509 void LayerTreeHost::CommitComplete() { | 520 void LayerTreeHost::CommitComplete() { |
510 source_frame_number_++; | 521 source_frame_number_++; |
511 client_->DidCommit(); | 522 client_->DidCommit(); |
512 if (did_complete_scale_animation_) { | 523 if (did_complete_scale_animation_) { |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
583 SetNeedsCommit(); | 594 SetNeedsCommit(); |
584 } | 595 } |
585 | 596 |
586 void LayerTreeHost::SetDeferCommits(bool defer_commits) { | 597 void LayerTreeHost::SetDeferCommits(bool defer_commits) { |
587 proxy_->SetDeferCommits(defer_commits); | 598 proxy_->SetDeferCommits(defer_commits); |
588 } | 599 } |
589 | 600 |
590 DISABLE_CFI_PERF | 601 DISABLE_CFI_PERF |
591 void LayerTreeHost::SetNeedsAnimate() { | 602 void LayerTreeHost::SetNeedsAnimate() { |
592 proxy_->SetNeedsAnimate(); | 603 proxy_->SetNeedsAnimate(); |
593 NotifySwapPromiseMonitorsOfSetNeedsCommit(); | 604 swap_promise_manager_.NotifySwapPromiseMonitorsOfSetNeedsCommit(); |
594 } | 605 } |
595 | 606 |
596 DISABLE_CFI_PERF | 607 DISABLE_CFI_PERF |
597 void LayerTreeHost::SetNeedsUpdateLayers() { | 608 void LayerTreeHost::SetNeedsUpdateLayers() { |
598 proxy_->SetNeedsUpdateLayers(); | 609 proxy_->SetNeedsUpdateLayers(); |
599 NotifySwapPromiseMonitorsOfSetNeedsCommit(); | 610 swap_promise_manager_.NotifySwapPromiseMonitorsOfSetNeedsCommit(); |
600 } | 611 } |
601 | 612 |
602 void LayerTreeHost::SetNeedsCommit() { | 613 void LayerTreeHost::SetNeedsCommit() { |
603 proxy_->SetNeedsCommit(); | 614 proxy_->SetNeedsCommit(); |
604 NotifySwapPromiseMonitorsOfSetNeedsCommit(); | 615 swap_promise_manager_.NotifySwapPromiseMonitorsOfSetNeedsCommit(); |
605 } | 616 } |
606 | 617 |
607 void LayerTreeHost::SetNeedsRedraw() { | 618 void LayerTreeHost::SetNeedsRedraw() { |
608 SetNeedsRedrawRect(gfx::Rect(layer_tree_->device_viewport_size())); | 619 SetNeedsRedrawRect(gfx::Rect(layer_tree_->device_viewport_size())); |
609 } | 620 } |
610 | 621 |
611 void LayerTreeHost::SetNeedsRedrawRect(const gfx::Rect& damage_rect) { | 622 void LayerTreeHost::SetNeedsRedrawRect(const gfx::Rect& damage_rect) { |
612 proxy_->SetNeedsRedraw(damage_rect); | 623 proxy_->SetNeedsRedraw(damage_rect); |
613 } | 624 } |
614 | 625 |
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
869 SetNeedsUpdateLayers(); | 880 SetNeedsUpdateLayers(); |
870 } | 881 } |
871 | 882 |
872 void LayerTreeHost::ApplyScrollAndScale(ScrollAndScaleSet* info) { | 883 void LayerTreeHost::ApplyScrollAndScale(ScrollAndScaleSet* info) { |
873 for (auto& swap_promise : info->swap_promises) { | 884 for (auto& swap_promise : info->swap_promises) { |
874 TRACE_EVENT_WITH_FLOW1("input,benchmark", | 885 TRACE_EVENT_WITH_FLOW1("input,benchmark", |
875 "LatencyInfo.Flow", | 886 "LatencyInfo.Flow", |
876 TRACE_ID_DONT_MANGLE(swap_promise->TraceId()), | 887 TRACE_ID_DONT_MANGLE(swap_promise->TraceId()), |
877 TRACE_EVENT_FLAG_FLOW_IN | TRACE_EVENT_FLAG_FLOW_OUT, | 888 TRACE_EVENT_FLAG_FLOW_IN | TRACE_EVENT_FLAG_FLOW_OUT, |
878 "step", "Main thread scroll update"); | 889 "step", "Main thread scroll update"); |
879 QueueSwapPromise(std::move(swap_promise)); | 890 swap_promise_manager_.QueueSwapPromise(std::move(swap_promise)); |
880 } | 891 } |
881 | 892 |
882 if (layer_tree_->root_layer()) { | 893 if (layer_tree_->root_layer()) { |
883 for (size_t i = 0; i < info->scrolls.size(); ++i) { | 894 for (size_t i = 0; i < info->scrolls.size(); ++i) { |
884 Layer* layer = layer_tree_->LayerById(info->scrolls[i].layer_id); | 895 Layer* layer = layer_tree_->LayerById(info->scrolls[i].layer_id); |
885 if (!layer) | 896 if (!layer) |
886 continue; | 897 continue; |
887 layer->SetScrollOffsetFromImplSide(gfx::ScrollOffsetWithDelta( | 898 layer->SetScrollOffsetFromImplSide(gfx::ScrollOffsetWithDelta( |
888 layer->scroll_offset(), info->scrolls[i].scroll_delta)); | 899 layer->scroll_offset(), info->scrolls[i].scroll_delta)); |
889 SetNeedsUpdateLayers(); | 900 SetNeedsUpdateLayers(); |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
926 return micro_benchmark_controller_.ScheduleRun(benchmark_name, | 937 return micro_benchmark_controller_.ScheduleRun(benchmark_name, |
927 std::move(value), callback); | 938 std::move(value), callback); |
928 } | 939 } |
929 | 940 |
930 bool LayerTreeHost::SendMessageToMicroBenchmark( | 941 bool LayerTreeHost::SendMessageToMicroBenchmark( |
931 int id, | 942 int id, |
932 std::unique_ptr<base::Value> value) { | 943 std::unique_ptr<base::Value> value) { |
933 return micro_benchmark_controller_.SendMessage(id, std::move(value)); | 944 return micro_benchmark_controller_.SendMessage(id, std::move(value)); |
934 } | 945 } |
935 | 946 |
936 void LayerTreeHost::InsertSwapPromiseMonitor(SwapPromiseMonitor* monitor) { | |
937 swap_promise_monitor_.insert(monitor); | |
938 } | |
939 | |
940 void LayerTreeHost::RemoveSwapPromiseMonitor(SwapPromiseMonitor* monitor) { | |
941 swap_promise_monitor_.erase(monitor); | |
942 } | |
943 | |
944 void LayerTreeHost::NotifySwapPromiseMonitorsOfSetNeedsCommit() { | |
945 std::set<SwapPromiseMonitor*>::iterator it = swap_promise_monitor_.begin(); | |
946 for (; it != swap_promise_monitor_.end(); it++) | |
947 (*it)->OnSetNeedsCommitOnMain(); | |
948 } | |
949 | |
950 void LayerTreeHost::QueueSwapPromise( | |
951 std::unique_ptr<SwapPromise> swap_promise) { | |
952 DCHECK(swap_promise); | |
953 swap_promise_list_.push_back(std::move(swap_promise)); | |
954 } | |
955 | |
956 void LayerTreeHost::BreakSwapPromises(SwapPromise::DidNotSwapReason reason) { | |
957 for (const auto& swap_promise : swap_promise_list_) | |
958 swap_promise->DidNotSwap(reason); | |
959 swap_promise_list_.clear(); | |
960 } | |
961 | |
962 std::vector<std::unique_ptr<SwapPromise>> LayerTreeHost::TakeSwapPromises() { | |
963 std::vector<std::unique_ptr<SwapPromise>> to_return; | |
964 to_return.swap(swap_promise_list_); | |
965 return to_return; | |
966 } | |
967 | |
968 void LayerTreeHost::OnCommitForSwapPromises() { | |
969 for (const auto& swap_promise : swap_promise_list_) | |
970 swap_promise->OnCommit(); | |
971 } | |
972 | |
973 void LayerTreeHost::SetSurfaceClientId(uint32_t client_id) { | |
974 surface_client_id_ = client_id; | |
975 } | |
976 | |
977 SurfaceSequence LayerTreeHost::CreateSurfaceSequence() { | |
978 return SurfaceSequence(surface_client_id_, next_surface_sequence_++); | |
979 } | |
980 | |
981 void LayerTreeHost::SetLayerTreeMutator( | 947 void LayerTreeHost::SetLayerTreeMutator( |
982 std::unique_ptr<LayerTreeMutator> mutator) { | 948 std::unique_ptr<LayerTreeMutator> mutator) { |
983 proxy_->SetMutator(std::move(mutator)); | 949 proxy_->SetMutator(std::move(mutator)); |
984 } | 950 } |
985 | 951 |
986 bool LayerTreeHost::IsSingleThreaded() const { | 952 bool LayerTreeHost::IsSingleThreaded() const { |
987 DCHECK(compositor_mode_ != CompositorMode::SINGLE_THREADED || | 953 DCHECK(compositor_mode_ != CompositorMode::SINGLE_THREADED || |
988 !task_runner_provider_->HasImplThread()); | 954 !task_runner_provider_->HasImplThread()); |
989 return compositor_mode_ == CompositorMode::SINGLE_THREADED; | 955 return compositor_mode_ == CompositorMode::SINGLE_THREADED; |
990 } | 956 } |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1024 // - The output surfaces are only valid on the client-side so they are | 990 // - The output surfaces are only valid on the client-side so they are |
1025 // therefore not serialized. | 991 // therefore not serialized. |
1026 // - LayerTreeSettings are needed only during construction of the | 992 // - LayerTreeSettings are needed only during construction of the |
1027 // LayerTreeHost, so they are serialized outside of the LayerTreeHost | 993 // LayerTreeHost, so they are serialized outside of the LayerTreeHost |
1028 // serialization. | 994 // serialization. |
1029 // - The |visible_| flag will be controlled from the client separately and | 995 // - The |visible_| flag will be controlled from the client separately and |
1030 // will need special handling outside of the serialization of the | 996 // will need special handling outside of the serialization of the |
1031 // LayerTreeHost. | 997 // LayerTreeHost. |
1032 // TODO(nyquist): Figure out how to support animations. See crbug.com/570376. | 998 // TODO(nyquist): Figure out how to support animations. See crbug.com/570376. |
1033 TRACE_EVENT0("cc.remote", "LayerTreeHost::ToProtobufForCommit"); | 999 TRACE_EVENT0("cc.remote", "LayerTreeHost::ToProtobufForCommit"); |
1034 swap_promises->swap(swap_promise_list_); | 1000 *swap_promises = swap_promise_manager_.TakeSwapPromises(); |
1035 DCHECK(swap_promise_list_.empty()); | |
1036 | 1001 |
1037 proto->set_source_frame_number(source_frame_number_); | 1002 proto->set_source_frame_number(source_frame_number_); |
1038 | 1003 |
1039 // Serialize the LayerTree before serializing the properties. During layer | 1004 // Serialize the LayerTree before serializing the properties. During layer |
1040 // property serialization, we clear the list |layer_that_should_properties_| | 1005 // property serialization, we clear the list |layer_that_should_properties_| |
1041 // from the LayerTree. | 1006 // from the LayerTree. |
1042 layer_tree_->ToProtobuf(proto->mutable_layer_tree()); | 1007 layer_tree_->ToProtobuf(proto->mutable_layer_tree()); |
1043 | 1008 |
1044 LayerProtoConverter::SerializeLayerProperties(this, | 1009 LayerProtoConverter::SerializeLayerProperties(this, |
1045 proto->mutable_layer_updates()); | 1010 proto->mutable_layer_updates()); |
1046 | 1011 |
1047 std::vector<PictureData> pictures = | 1012 std::vector<PictureData> pictures = |
1048 engine_picture_cache_->CalculateCacheUpdateAndFlush(); | 1013 engine_picture_cache_->CalculateCacheUpdateAndFlush(); |
1049 proto::PictureDataVectorToSkPicturesProto(pictures, | 1014 proto::PictureDataVectorToSkPicturesProto(pictures, |
1050 proto->mutable_pictures()); | 1015 proto->mutable_pictures()); |
1051 | 1016 |
1052 debug_state_.ToProtobuf(proto->mutable_debug_state()); | 1017 debug_state_.ToProtobuf(proto->mutable_debug_state()); |
1053 proto->set_has_gpu_rasterization_trigger(has_gpu_rasterization_trigger_); | 1018 proto->set_has_gpu_rasterization_trigger(has_gpu_rasterization_trigger_); |
1054 proto->set_content_is_suitable_for_gpu_rasterization( | 1019 proto->set_content_is_suitable_for_gpu_rasterization( |
1055 content_is_suitable_for_gpu_rasterization_); | 1020 content_is_suitable_for_gpu_rasterization_); |
1056 proto->set_id(id_); | 1021 proto->set_id(id_); |
1057 proto->set_next_commit_forces_redraw(next_commit_forces_redraw_); | 1022 proto->set_next_commit_forces_redraw(next_commit_forces_redraw_); |
1058 | 1023 |
1059 proto->set_surface_client_id(surface_client_id_); | |
1060 proto->set_next_surface_sequence(next_surface_sequence_); | |
1061 | |
1062 TRACE_EVENT_OBJECT_SNAPSHOT_WITH_ID( | 1024 TRACE_EVENT_OBJECT_SNAPSHOT_WITH_ID( |
1063 "cc.remote", "LayerTreeHostProto", source_frame_number_, | 1025 "cc.remote", "LayerTreeHostProto", source_frame_number_, |
1064 ComputeLayerTreeHostProtoSizeSplitAsValue(proto)); | 1026 ComputeLayerTreeHostProtoSizeSplitAsValue(proto)); |
1065 } | 1027 } |
1066 | 1028 |
1067 void LayerTreeHost::FromProtobufForCommit(const proto::LayerTreeHost& proto) { | 1029 void LayerTreeHost::FromProtobufForCommit(const proto::LayerTreeHost& proto) { |
1068 DCHECK(client_picture_cache_); | 1030 DCHECK(client_picture_cache_); |
1069 source_frame_number_ = proto.source_frame_number(); | 1031 source_frame_number_ = proto.source_frame_number(); |
1070 | 1032 |
1071 layer_tree_->FromProtobuf(proto.layer_tree()); | 1033 layer_tree_->FromProtobuf(proto.layer_tree()); |
(...skipping 10 matching lines...) Expand all Loading... |
1082 | 1044 |
1083 // The deserialization is finished, so now clear the cache. | 1045 // The deserialization is finished, so now clear the cache. |
1084 client_picture_cache_->Flush(); | 1046 client_picture_cache_->Flush(); |
1085 | 1047 |
1086 debug_state_.FromProtobuf(proto.debug_state()); | 1048 debug_state_.FromProtobuf(proto.debug_state()); |
1087 has_gpu_rasterization_trigger_ = proto.has_gpu_rasterization_trigger(); | 1049 has_gpu_rasterization_trigger_ = proto.has_gpu_rasterization_trigger(); |
1088 content_is_suitable_for_gpu_rasterization_ = | 1050 content_is_suitable_for_gpu_rasterization_ = |
1089 proto.content_is_suitable_for_gpu_rasterization(); | 1051 proto.content_is_suitable_for_gpu_rasterization(); |
1090 id_ = proto.id(); | 1052 id_ = proto.id(); |
1091 next_commit_forces_redraw_ = proto.next_commit_forces_redraw(); | 1053 next_commit_forces_redraw_ = proto.next_commit_forces_redraw(); |
1092 | |
1093 surface_client_id_ = proto.surface_client_id(); | |
1094 next_surface_sequence_ = proto.next_surface_sequence(); | |
1095 } | 1054 } |
1096 | 1055 |
1097 } // namespace cc | 1056 } // namespace cc |
OLD | NEW |