| 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_in_process.h" | 5 #include "cc/trees/layer_tree_host_in_process.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 432 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 443 if (next_commit_forces_recalculate_raster_scales_) { | 443 if (next_commit_forces_recalculate_raster_scales_) { |
| 444 sync_tree->ForceRecalculateRasterScales(); | 444 sync_tree->ForceRecalculateRasterScales(); |
| 445 next_commit_forces_recalculate_raster_scales_ = false; | 445 next_commit_forces_recalculate_raster_scales_ = false; |
| 446 } | 446 } |
| 447 | 447 |
| 448 sync_tree->set_source_frame_number(SourceFrameNumber()); | 448 sync_tree->set_source_frame_number(SourceFrameNumber()); |
| 449 | 449 |
| 450 if (layer_tree_->needs_full_tree_sync()) | 450 if (layer_tree_->needs_full_tree_sync()) |
| 451 TreeSynchronizer::SynchronizeTrees(layer_tree_->root_layer(), sync_tree); | 451 TreeSynchronizer::SynchronizeTrees(layer_tree_->root_layer(), sync_tree); |
| 452 | 452 |
| 453 layer_tree_->PushPropertiesTo(sync_tree); | 453 float page_scale_delta = 1.f; |
| 454 if (reflected_main_frame_state_) |
| 455 page_scale_delta = reflected_main_frame_state_->page_scale_delta; |
| 456 layer_tree_->PushPropertiesTo(sync_tree, page_scale_delta); |
| 454 | 457 |
| 455 sync_tree->PassSwapPromises(swap_promise_manager_.TakeSwapPromises()); | 458 sync_tree->PassSwapPromises(swap_promise_manager_.TakeSwapPromises()); |
| 456 | 459 |
| 457 host_impl->SetHasGpuRasterizationTrigger(has_gpu_rasterization_trigger_); | 460 host_impl->SetHasGpuRasterizationTrigger(has_gpu_rasterization_trigger_); |
| 458 host_impl->SetContentIsSuitableForGpuRasterization( | 461 host_impl->SetContentIsSuitableForGpuRasterization( |
| 459 content_is_suitable_for_gpu_rasterization_); | 462 content_is_suitable_for_gpu_rasterization_); |
| 460 RecordGpuRasterizationHistogram(); | 463 RecordGpuRasterizationHistogram(); |
| 461 | 464 |
| 462 host_impl->SetViewportSize(layer_tree_->device_viewport_size()); | 465 host_impl->SetViewportSize(layer_tree_->device_viewport_size()); |
| 463 sync_tree->SetDeviceScaleFactor(layer_tree_->device_scale_factor()); | 466 sync_tree->SetDeviceScaleFactor(layer_tree_->device_scale_factor()); |
| 464 host_impl->SetDebugState(debug_state_); | 467 host_impl->SetDebugState(debug_state_); |
| 465 | 468 |
| 466 sync_tree->set_ui_resource_request_queue( | 469 sync_tree->set_ui_resource_request_queue( |
| 467 ui_resource_manager_->TakeUIResourcesRequests()); | 470 ui_resource_manager_->TakeUIResourcesRequests()); |
| 468 | 471 |
| 469 { | 472 { |
| 470 TRACE_EVENT0("cc", "LayerTreeHostInProcess::PushProperties"); | 473 TRACE_EVENT0("cc", "LayerTreeHostInProcess::PushProperties"); |
| 471 | 474 |
| 472 TreeSynchronizer::PushLayerProperties(layer_tree_.get(), sync_tree); | 475 TreeSynchronizer::PushLayerProperties(layer_tree_.get(), sync_tree); |
| 473 | 476 |
| 477 if (reflected_main_frame_state_) { |
| 478 for (const auto& scroll_update : reflected_main_frame_state_->scrolls) { |
| 479 int layer_id = scroll_update.layer_id; |
| 480 gfx::Vector2dF scroll_delta = scroll_update.scroll_delta; |
| 481 |
| 482 PropertyTrees* property_trees = layer_tree_->property_trees(); |
| 483 property_trees->scroll_tree.SetScrollOffset( |
| 484 layer_id, gfx::ScrollOffsetWithDelta( |
| 485 layer_tree_->LayerById(layer_id)->scroll_offset(), |
| 486 scroll_delta)); |
| 487 } |
| 488 } |
| 489 |
| 474 // This must happen after synchronizing property trees and after pushing | 490 // This must happen after synchronizing property trees and after pushing |
| 475 // properties, which updates the clobber_active_value flag. | 491 // properties, which updates the clobber_active_value flag. |
| 476 sync_tree->UpdatePropertyTreeScrollOffset(layer_tree_->property_trees()); | 492 sync_tree->UpdatePropertyTreeScrollOffset(layer_tree_->property_trees()); |
| 477 | 493 |
| 478 // This must happen after synchronizing property trees and after push | 494 // This must happen after synchronizing property trees and after push |
| 479 // properties, which updates property tree indices, but before animation | 495 // properties, which updates property tree indices, but before animation |
| 480 // host pushes properties as animation host push properties can change | 496 // host pushes properties as animation host push properties can change |
| 481 // Animation::InEffect and we want the old InEffect value for updating | 497 // Animation::InEffect and we want the old InEffect value for updating |
| 482 // property tree scrolling and animation. | 498 // property tree scrolling and animation. |
| 483 sync_tree->UpdatePropertyTreeScrollingAndAnimationFromMainThread(); | 499 sync_tree->UpdatePropertyTreeScrollingAndAnimationFromMainThread(); |
| 484 | 500 |
| 485 TRACE_EVENT0("cc", "LayerTreeHostInProcess::AnimationHost::PushProperties"); | 501 TRACE_EVENT0("cc", "LayerTreeHostInProcess::AnimationHost::PushProperties"); |
| 486 DCHECK(host_impl->mutator_host()); | 502 DCHECK(host_impl->mutator_host()); |
| 487 layer_tree_->animation_host()->PushPropertiesTo(host_impl->mutator_host()); | 503 layer_tree_->animation_host()->PushPropertiesTo(host_impl->mutator_host()); |
| 488 } | 504 } |
| 489 | 505 |
| 490 micro_benchmark_controller_.ScheduleImplBenchmarks(host_impl); | 506 micro_benchmark_controller_.ScheduleImplBenchmarks(host_impl); |
| 491 layer_tree_->property_trees()->ResetAllChangeTracking(); | 507 layer_tree_->property_trees()->ResetAllChangeTracking(); |
| 508 reflected_main_frame_state_ = nullptr; |
| 492 } | 509 } |
| 493 | 510 |
| 494 void LayerTreeHostInProcess::WillCommit() { | 511 void LayerTreeHostInProcess::WillCommit() { |
| 495 swap_promise_manager_.WillCommit(); | 512 swap_promise_manager_.WillCommit(); |
| 496 client_->WillCommit(); | 513 client_->WillCommit(); |
| 497 } | 514 } |
| 498 | 515 |
| 499 void LayerTreeHostInProcess::UpdateHudLayer() {} | 516 void LayerTreeHostInProcess::UpdateHudLayer() {} |
| 500 | 517 |
| 501 void LayerTreeHostInProcess::CommitComplete() { | 518 void LayerTreeHostInProcess::CommitComplete() { |
| (...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 874 layer->SetScrollbarsHiddenFromImplSide(info->scrollbars[i].hidden); | 891 layer->SetScrollbarsHiddenFromImplSide(info->scrollbars[i].hidden); |
| 875 } | 892 } |
| 876 } | 893 } |
| 877 | 894 |
| 878 // This needs to happen after scroll deltas have been sent to prevent top | 895 // This needs to happen after scroll deltas have been sent to prevent top |
| 879 // controls from clamping the layout viewport both on the compositor and | 896 // controls from clamping the layout viewport both on the compositor and |
| 880 // on the main thread. | 897 // on the main thread. |
| 881 ApplyViewportDeltas(info); | 898 ApplyViewportDeltas(info); |
| 882 } | 899 } |
| 883 | 900 |
| 901 void LayerTreeHostInProcess::SetReflectedMainFrameState( |
| 902 std::unique_ptr<ReflectedMainFrameState> reflected_main_frame_state) { |
| 903 DCHECK(IsThreaded()); |
| 904 |
| 905 reflected_main_frame_state_ = std::move(reflected_main_frame_state); |
| 906 SetNeedsCommit(); |
| 907 } |
| 908 |
| 884 const base::WeakPtr<InputHandler>& LayerTreeHostInProcess::GetInputHandler() | 909 const base::WeakPtr<InputHandler>& LayerTreeHostInProcess::GetInputHandler() |
| 885 const { | 910 const { |
| 886 return input_handler_weak_ptr_; | 911 return input_handler_weak_ptr_; |
| 887 } | 912 } |
| 888 | 913 |
| 889 void LayerTreeHostInProcess::UpdateBrowserControlsState( | 914 void LayerTreeHostInProcess::UpdateBrowserControlsState( |
| 890 BrowserControlsState constraints, | 915 BrowserControlsState constraints, |
| 891 BrowserControlsState current, | 916 BrowserControlsState current, |
| 892 bool animate) { | 917 bool animate) { |
| 893 // Browser controls are only used in threaded or remote mode. | 918 // Browser controls are only used in threaded or remote mode. |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1028 | 1053 |
| 1029 debug_state_.FromProtobuf(proto.debug_state()); | 1054 debug_state_.FromProtobuf(proto.debug_state()); |
| 1030 has_gpu_rasterization_trigger_ = proto.has_gpu_rasterization_trigger(); | 1055 has_gpu_rasterization_trigger_ = proto.has_gpu_rasterization_trigger(); |
| 1031 content_is_suitable_for_gpu_rasterization_ = | 1056 content_is_suitable_for_gpu_rasterization_ = |
| 1032 proto.content_is_suitable_for_gpu_rasterization(); | 1057 proto.content_is_suitable_for_gpu_rasterization(); |
| 1033 id_ = proto.id(); | 1058 id_ = proto.id(); |
| 1034 next_commit_forces_redraw_ = proto.next_commit_forces_redraw(); | 1059 next_commit_forces_redraw_ = proto.next_commit_forces_redraw(); |
| 1035 } | 1060 } |
| 1036 | 1061 |
| 1037 } // namespace cc | 1062 } // namespace cc |
| OLD | NEW |