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

Unified Diff: cc/trees/layer_tree_host_in_process.cc

Issue 2445093002: cc/blimp: Add synchronization for scroll/scale state. (Closed)
Patch Set: test compile Created 4 years, 1 month 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « cc/trees/layer_tree_host_in_process.h ('k') | cc/trees/layer_tree_host_unittest_scroll.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/trees/layer_tree_host_in_process.cc
diff --git a/cc/trees/layer_tree_host_in_process.cc b/cc/trees/layer_tree_host_in_process.cc
index 7709812cb661cc45510a8eba97a2c0494a12ee7a..678ce90d0ac39ba0853e48a9e8dc4a75d9732702 100644
--- a/cc/trees/layer_tree_host_in_process.cc
+++ b/cc/trees/layer_tree_host_in_process.cc
@@ -450,7 +450,10 @@ void LayerTreeHostInProcess::FinishCommitOnImplThread(
if (layer_tree_->needs_full_tree_sync())
TreeSynchronizer::SynchronizeTrees(layer_tree_->root_layer(), sync_tree);
- layer_tree_->PushPropertiesTo(sync_tree);
+ float page_scale_delta = 1.f;
+ if (reflected_main_frame_state_)
+ page_scale_delta = reflected_main_frame_state_->page_scale_delta;
+ layer_tree_->PushPropertiesTo(sync_tree, page_scale_delta);
sync_tree->PassSwapPromises(swap_promise_manager_.TakeSwapPromises());
@@ -471,6 +474,19 @@ void LayerTreeHostInProcess::FinishCommitOnImplThread(
TreeSynchronizer::PushLayerProperties(layer_tree_.get(), sync_tree);
+ if (reflected_main_frame_state_) {
+ for (const auto& scroll_update : reflected_main_frame_state_->scrolls) {
+ int layer_id = scroll_update.layer_id;
+ gfx::Vector2dF scroll_delta = scroll_update.scroll_delta;
+
+ PropertyTrees* property_trees = layer_tree_->property_trees();
+ property_trees->scroll_tree.SetScrollOffset(
+ layer_id, gfx::ScrollOffsetWithDelta(
+ layer_tree_->LayerById(layer_id)->scroll_offset(),
+ scroll_delta));
+ }
+ }
+
// This must happen after synchronizing property trees and after pushing
// properties, which updates the clobber_active_value flag.
sync_tree->UpdatePropertyTreeScrollOffset(layer_tree_->property_trees());
@@ -489,6 +505,7 @@ void LayerTreeHostInProcess::FinishCommitOnImplThread(
micro_benchmark_controller_.ScheduleImplBenchmarks(host_impl);
layer_tree_->property_trees()->ResetAllChangeTracking();
+ reflected_main_frame_state_ = nullptr;
}
void LayerTreeHostInProcess::WillCommit() {
@@ -881,6 +898,14 @@ void LayerTreeHostInProcess::ApplyScrollAndScale(ScrollAndScaleSet* info) {
ApplyViewportDeltas(info);
}
+void LayerTreeHostInProcess::SetReflectedMainFrameState(
+ std::unique_ptr<ReflectedMainFrameState> reflected_main_frame_state) {
+ DCHECK(IsThreaded());
+
+ reflected_main_frame_state_ = std::move(reflected_main_frame_state);
+ SetNeedsCommit();
+}
+
const base::WeakPtr<InputHandler>& LayerTreeHostInProcess::GetInputHandler()
const {
return input_handler_weak_ptr_;
« no previous file with comments | « cc/trees/layer_tree_host_in_process.h ('k') | cc/trees/layer_tree_host_unittest_scroll.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698