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

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

Issue 647753004: Don't set sent_top_controls_delta when root layer doesn't exist. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove unused variable in unit test Created 6 years, 2 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
« no previous file with comments | « cc/trees/layer_tree_host_common.cc ('k') | cc/trees/layer_tree_host_impl_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_impl.h" 5 #include "cc/trees/layer_tree_host_impl.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <limits> 8 #include <limits>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
(...skipping 2886 matching lines...) Expand 10 before | Expand all | Expand 10 after
2897 pinch_gesture_end_should_clear_scrolling_layer_ = false; 2897 pinch_gesture_end_should_clear_scrolling_layer_ = false;
2898 ClearCurrentlyScrollingLayer(); 2898 ClearCurrentlyScrollingLayer();
2899 } 2899 }
2900 if (top_controls_manager_) 2900 if (top_controls_manager_)
2901 top_controls_manager_->PinchEnd(); 2901 top_controls_manager_->PinchEnd();
2902 client_->SetNeedsCommitOnImplThread(); 2902 client_->SetNeedsCommitOnImplThread();
2903 } 2903 }
2904 2904
2905 static void CollectScrollDeltas(ScrollAndScaleSet* scroll_info, 2905 static void CollectScrollDeltas(ScrollAndScaleSet* scroll_info,
2906 LayerImpl* layer_impl) { 2906 LayerImpl* layer_impl) {
2907 if (!layer_impl) 2907 DCHECK(layer_impl);
2908 return;
2909 2908
2910 gfx::Vector2d scroll_delta = 2909 gfx::Vector2d scroll_delta =
2911 gfx::ToFlooredVector2d(layer_impl->ScrollDelta()); 2910 gfx::ToFlooredVector2d(layer_impl->ScrollDelta());
2912 if (!scroll_delta.IsZero()) { 2911 if (!scroll_delta.IsZero()) {
2913 LayerTreeHostCommon::ScrollUpdateInfo scroll; 2912 LayerTreeHostCommon::ScrollUpdateInfo scroll;
2914 scroll.layer_id = layer_impl->id(); 2913 scroll.layer_id = layer_impl->id();
2915 scroll.scroll_delta = scroll_delta; 2914 scroll.scroll_delta = scroll_delta;
2916 scroll_info->scrolls.push_back(scroll); 2915 scroll_info->scrolls.push_back(scroll);
2917 layer_impl->SetSentScrollDelta(scroll_delta); 2916 layer_impl->SetSentScrollDelta(scroll_delta);
2918 } 2917 }
2919 2918
2920 for (size_t i = 0; i < layer_impl->children().size(); ++i) 2919 for (size_t i = 0; i < layer_impl->children().size(); ++i)
2921 CollectScrollDeltas(scroll_info, layer_impl->children()[i]); 2920 CollectScrollDeltas(scroll_info, layer_impl->children()[i]);
2922 } 2921 }
2923 2922
2924 scoped_ptr<ScrollAndScaleSet> LayerTreeHostImpl::ProcessScrollDeltas() { 2923 scoped_ptr<ScrollAndScaleSet> LayerTreeHostImpl::ProcessScrollDeltas() {
2925 scoped_ptr<ScrollAndScaleSet> scroll_info(new ScrollAndScaleSet()); 2924 scoped_ptr<ScrollAndScaleSet> scroll_info(new ScrollAndScaleSet());
2926 2925
2927 CollectScrollDeltas(scroll_info.get(), active_tree_->root_layer()); 2926 if (active_tree_->root_layer()) {
2928 scroll_info->page_scale_delta = active_tree_->page_scale_delta(); 2927 CollectScrollDeltas(scroll_info.get(), active_tree_->root_layer());
2929 active_tree_->set_sent_page_scale_delta(scroll_info->page_scale_delta); 2928 scroll_info->page_scale_delta = active_tree_->page_scale_delta();
2930 scroll_info->swap_promises.swap(swap_promises_for_main_thread_scroll_update_); 2929 active_tree_->set_sent_page_scale_delta(scroll_info->page_scale_delta);
2931 scroll_info->top_controls_delta = active_tree()->top_controls_delta(); 2930 scroll_info->swap_promises.swap(
2932 active_tree_->set_sent_top_controls_delta(scroll_info->top_controls_delta); 2931 swap_promises_for_main_thread_scroll_update_);
2932 scroll_info->top_controls_delta = active_tree()->top_controls_delta();
2933 active_tree_->set_sent_top_controls_delta(scroll_info->top_controls_delta);
2934 }
2933 2935
2934 return scroll_info.Pass(); 2936 return scroll_info.Pass();
2935 } 2937 }
2936 2938
2937 void LayerTreeHostImpl::SetFullRootLayerDamage() { 2939 void LayerTreeHostImpl::SetFullRootLayerDamage() {
2938 SetViewportDamage(gfx::Rect(DrawViewportSize())); 2940 SetViewportDamage(gfx::Rect(DrawViewportSize()));
2939 } 2941 }
2940 2942
2941 void LayerTreeHostImpl::ScrollViewportInnerFirst(gfx::Vector2dF scroll_delta) { 2943 void LayerTreeHostImpl::ScrollViewportInnerFirst(gfx::Vector2dF scroll_delta) {
2942 DCHECK(InnerViewportScrollLayer()); 2944 DCHECK(InnerViewportScrollLayer());
(...skipping 442 matching lines...) Expand 10 before | Expand all | Expand 10 after
3385 } 3387 }
3386 3388
3387 void LayerTreeHostImpl::UnregisterPictureLayerImpl(PictureLayerImpl* layer) { 3389 void LayerTreeHostImpl::UnregisterPictureLayerImpl(PictureLayerImpl* layer) {
3388 std::vector<PictureLayerImpl*>::iterator it = 3390 std::vector<PictureLayerImpl*>::iterator it =
3389 std::find(picture_layers_.begin(), picture_layers_.end(), layer); 3391 std::find(picture_layers_.begin(), picture_layers_.end(), layer);
3390 DCHECK(it != picture_layers_.end()); 3392 DCHECK(it != picture_layers_.end());
3391 picture_layers_.erase(it); 3393 picture_layers_.erase(it);
3392 } 3394 }
3393 3395
3394 } // namespace cc 3396 } // namespace cc
OLDNEW
« no previous file with comments | « cc/trees/layer_tree_host_common.cc ('k') | cc/trees/layer_tree_host_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698