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