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

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

Issue 2445093002: cc/blimp: Add synchronization for scroll/scale state. (Closed)
Patch Set: minor fix 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 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_impl.h" 5 #include "cc/trees/layer_tree_impl.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 2061 matching lines...) Expand 10 before | Expand all | Expand 10 after
2072 } 2072 }
2073 2073
2074 void LayerTreeImpl::ResetAllChangeTracking() { 2074 void LayerTreeImpl::ResetAllChangeTracking() {
2075 layers_that_should_push_properties_.clear(); 2075 layers_that_should_push_properties_.clear();
2076 // Iterate over all layers, including masks. 2076 // Iterate over all layers, including masks.
2077 for (auto& layer : *layers_) 2077 for (auto& layer : *layers_)
2078 layer->ResetChangeTracking(); 2078 layer->ResetChangeTracking();
2079 property_trees_.ResetAllChangeTracking(); 2079 property_trees_.ResetAllChangeTracking();
2080 } 2080 }
2081 2081
2082 void LayerTreeImpl::SetReflectedMainFrameState(
2083 std::unique_ptr<ReflectedMainFrameState> reflected_main_frame_state) {
2084 reflected_main_frame_state_ = std::move(reflected_main_frame_state);
2085 }
2086
2087 void LayerTreeImpl::ApplyReflectedMainFrameState() {
2088 DCHECK(!IsActiveTree());
2089
2090 if (reflected_main_frame_state_) {
2091 for (const auto& scroll_update : reflected_main_frame_state_->scrolls) {
2092 // The reflected scroll updates should have been sent only for layers
2093 // in the main frame, and the updates are applied after the main frame is
2094 // committed to the pending tree, so the layer must be present in the
2095 // pending tree.
2096 DCHECK(LayerById(scroll_update.layer_id));
2097
2098 property_trees()->scroll_tree.AddUnappliedDeltaOnPendingTree(
2099 scroll_update.layer_id,
2100 gfx::ScrollOffset(scroll_update.scroll_delta));
2101 DidUpdateScrollOffset(scroll_update.layer_id);
2102 }
2103
2104 float page_scale_delta = reflected_main_frame_state_->page_scale_delta;
2105 if (page_scale_delta != 1.0f) {
2106 page_scale_factor_->AddUnappliedDeltaToPendingBase(page_scale_delta);
2107 DidUpdatePageScale();
2108 }
2109
2110 reflected_main_frame_state_ = nullptr;
2111 }
2112 }
2113
2082 } // namespace cc 2114 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698