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

Side by Side Diff: cc/layers/layer_impl.cc

Issue 609663003: cc: Remove use of PassAs() and constructor-casting with scoped_ptr. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: cc-passas: PassAs-presubmit-warning 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/layers/layer.cc ('k') | cc/layers/layer_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 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 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/layers/layer_impl.h" 5 #include "cc/layers/layer_impl.h"
6 6
7 #include "base/debug/trace_event.h" 7 #include "base/debug/trace_event.h"
8 #include "base/debug/trace_event_argument.h" 8 #include "base/debug/trace_event_argument.h"
9 #include "base/json/json_reader.h" 9 #include "base/json/json_reader.h"
10 #include "base/strings/stringprintf.h" 10 #include "base/strings/stringprintf.h"
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 for (OwnedLayerImplList::iterator it = children_.begin(); 112 for (OwnedLayerImplList::iterator it = children_.begin();
113 it != children_.end(); 113 it != children_.end();
114 ++it) { 114 ++it) {
115 if (*it == child) { 115 if (*it == child) {
116 scoped_ptr<LayerImpl> ret = children_.take(it); 116 scoped_ptr<LayerImpl> ret = children_.take(it);
117 children_.erase(it); 117 children_.erase(it);
118 layer_tree_impl()->set_needs_update_draw_properties(); 118 layer_tree_impl()->set_needs_update_draw_properties();
119 return ret.Pass(); 119 return ret.Pass();
120 } 120 }
121 } 121 }
122 return scoped_ptr<LayerImpl>(); 122 return nullptr;
123 } 123 }
124 124
125 void LayerImpl::SetParent(LayerImpl* parent) { 125 void LayerImpl::SetParent(LayerImpl* parent) {
126 if (parent_should_know_need_push_properties()) { 126 if (parent_should_know_need_push_properties()) {
127 if (parent_) 127 if (parent_)
128 parent_->RemoveDependentNeedsPushProperties(); 128 parent_->RemoveDependentNeedsPushProperties();
129 if (parent) 129 if (parent)
130 parent->AddDependentNeedsPushProperties(); 130 parent->AddDependentNeedsPushProperties();
131 } 131 }
132 parent_ = parent; 132 parent_ = parent;
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
239 } 239 }
240 240
241 void LayerImpl::CreateRenderSurface() { 241 void LayerImpl::CreateRenderSurface() {
242 DCHECK(!draw_properties_.render_surface); 242 DCHECK(!draw_properties_.render_surface);
243 draw_properties_.render_surface = 243 draw_properties_.render_surface =
244 make_scoped_ptr(new RenderSurfaceImpl(this)); 244 make_scoped_ptr(new RenderSurfaceImpl(this));
245 draw_properties_.render_target = this; 245 draw_properties_.render_target = this;
246 } 246 }
247 247
248 void LayerImpl::ClearRenderSurface() { 248 void LayerImpl::ClearRenderSurface() {
249 draw_properties_.render_surface.reset(); 249 draw_properties_.render_surface = nullptr;
250 } 250 }
251 251
252 void LayerImpl::ClearRenderSurfaceLayerList() { 252 void LayerImpl::ClearRenderSurfaceLayerList() {
253 if (draw_properties_.render_surface) 253 if (draw_properties_.render_surface)
254 draw_properties_.render_surface->layer_list().clear(); 254 draw_properties_.render_surface->layer_list().clear();
255 } 255 }
256 256
257 void LayerImpl::PopulateSharedQuadState(SharedQuadState* state) const { 257 void LayerImpl::PopulateSharedQuadState(SharedQuadState* state) const {
258 state->SetAll(draw_properties_.target_space_transform, 258 state->SetAll(draw_properties_.target_space_transform,
259 draw_properties_.content_bounds, 259 draw_properties_.content_bounds,
(...skipping 1057 matching lines...) Expand 10 before | Expand all | Expand 10 after
1317 } 1317 }
1318 1318
1319 void LayerImpl::DidBecomeActive() { 1319 void LayerImpl::DidBecomeActive() {
1320 if (layer_tree_impl_->settings().scrollbar_animator == 1320 if (layer_tree_impl_->settings().scrollbar_animator ==
1321 LayerTreeSettings::NoAnimator) { 1321 LayerTreeSettings::NoAnimator) {
1322 return; 1322 return;
1323 } 1323 }
1324 1324
1325 bool need_scrollbar_animation_controller = scrollable() && scrollbars_; 1325 bool need_scrollbar_animation_controller = scrollable() && scrollbars_;
1326 if (!need_scrollbar_animation_controller) { 1326 if (!need_scrollbar_animation_controller) {
1327 scrollbar_animation_controller_.reset(); 1327 scrollbar_animation_controller_ = nullptr;
1328 return; 1328 return;
1329 } 1329 }
1330 1330
1331 if (scrollbar_animation_controller_) 1331 if (scrollbar_animation_controller_)
1332 return; 1332 return;
1333 1333
1334 scrollbar_animation_controller_ = 1334 scrollbar_animation_controller_ =
1335 layer_tree_impl_->CreateScrollbarAnimationController(this); 1335 layer_tree_impl_->CreateScrollbarAnimationController(this);
1336 } 1336 }
1337 1337
(...skipping 13 matching lines...) Expand all
1351 scrollbars_->insert(layer); 1351 scrollbars_->insert(layer);
1352 } 1352 }
1353 1353
1354 void LayerImpl::RemoveScrollbar(ScrollbarLayerImplBase* layer) { 1354 void LayerImpl::RemoveScrollbar(ScrollbarLayerImplBase* layer) {
1355 DCHECK(scrollbars_); 1355 DCHECK(scrollbars_);
1356 DCHECK(layer); 1356 DCHECK(layer);
1357 DCHECK(scrollbars_->find(layer) != scrollbars_->end()); 1357 DCHECK(scrollbars_->find(layer) != scrollbars_->end());
1358 1358
1359 scrollbars_->erase(layer); 1359 scrollbars_->erase(layer);
1360 if (scrollbars_->empty()) 1360 if (scrollbars_->empty())
1361 scrollbars_.reset(); 1361 scrollbars_ = nullptr;
1362 } 1362 }
1363 1363
1364 bool LayerImpl::HasScrollbar(ScrollbarOrientation orientation) const { 1364 bool LayerImpl::HasScrollbar(ScrollbarOrientation orientation) const {
1365 if (!scrollbars_) 1365 if (!scrollbars_)
1366 return false; 1366 return false;
1367 1367
1368 for (ScrollbarSet::iterator it = scrollbars_->begin(); 1368 for (ScrollbarSet::iterator it = scrollbars_->begin();
1369 it != scrollbars_->end(); 1369 it != scrollbars_->end();
1370 ++it) 1370 ++it)
1371 if ((*it)->orientation() == orientation) 1371 if ((*it)->orientation() == orientation)
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
1549 } 1549 }
1550 1550
1551 void LayerImpl::NotifyAnimationFinished( 1551 void LayerImpl::NotifyAnimationFinished(
1552 base::TimeTicks monotonic_time, 1552 base::TimeTicks monotonic_time,
1553 Animation::TargetProperty target_property) { 1553 Animation::TargetProperty target_property) {
1554 if (target_property == Animation::ScrollOffset) 1554 if (target_property == Animation::ScrollOffset)
1555 layer_tree_impl_->InputScrollAnimationFinished(); 1555 layer_tree_impl_->InputScrollAnimationFinished();
1556 } 1556 }
1557 1557
1558 } // namespace cc 1558 } // namespace cc
OLDNEW
« no previous file with comments | « cc/layers/layer.cc ('k') | cc/layers/layer_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698