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

Side by Side Diff: cc/trees/layer_tree_host.cc

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

Powered by Google App Engine
This is Rietveld 408576698