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

Side by Side Diff: ui/compositor/layer.cc

Issue 496313004: Remove implicit conversions from scoped_refptr to T* in ui/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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 "ui/compositor/layer.h" 5 #include "ui/compositor/layer.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/debug/trace_event.h" 10 #include "base/debug/trace_event.h"
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 if (GetCompositor()) 167 if (GetCompositor())
168 child->SendPendingThreadedAnimations(); 168 child->SendPendingThreadedAnimations();
169 LayerAnimatorCollection* collection = GetLayerAnimatorCollection(); 169 LayerAnimatorCollection* collection = GetLayerAnimatorCollection();
170 if (collection) 170 if (collection)
171 child->AddAnimatorsInTreeToCollection(collection); 171 child->AddAnimatorsInTreeToCollection(collection);
172 } 172 }
173 173
174 void Layer::Remove(Layer* child) { 174 void Layer::Remove(Layer* child) {
175 // Current bounds are used to calculate offsets when layers are reparented. 175 // Current bounds are used to calculate offsets when layers are reparented.
176 // Stop (and complete) an ongoing animation to update the bounds immediately. 176 // Stop (and complete) an ongoing animation to update the bounds immediately.
177 LayerAnimator* child_animator = child->animator_; 177 LayerAnimator* child_animator = child->animator_.get();
178 if (child_animator) 178 if (child_animator)
179 child_animator->StopAnimatingProperty(ui::LayerAnimationElement::BOUNDS); 179 child_animator->StopAnimatingProperty(ui::LayerAnimationElement::BOUNDS);
180 LayerAnimatorCollection* collection = GetLayerAnimatorCollection(); 180 LayerAnimatorCollection* collection = GetLayerAnimatorCollection();
181 if (collection) 181 if (collection)
182 child->RemoveAnimatorsInTreeFromCollection(collection); 182 child->RemoveAnimatorsInTreeFromCollection(collection);
183 183
184 std::vector<Layer*>::iterator i = 184 std::vector<Layer*>::iterator i =
185 std::find(children_.begin(), children_.end(), child); 185 std::find(children_.begin(), children_.end(), child);
186 DCHECK(i != children_.end()); 186 DCHECK(i != children_.end());
187 children_.erase(i); 187 children_.erase(i);
(...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after
523 } 523 }
524 524
525 void Layer::SetTextureMailbox( 525 void Layer::SetTextureMailbox(
526 const cc::TextureMailbox& mailbox, 526 const cc::TextureMailbox& mailbox,
527 scoped_ptr<cc::SingleReleaseCallback> release_callback, 527 scoped_ptr<cc::SingleReleaseCallback> release_callback,
528 gfx::Size texture_size_in_dip) { 528 gfx::Size texture_size_in_dip) {
529 DCHECK_EQ(type_, LAYER_TEXTURED); 529 DCHECK_EQ(type_, LAYER_TEXTURED);
530 DCHECK(!solid_color_layer_.get()); 530 DCHECK(!solid_color_layer_.get());
531 DCHECK(mailbox.IsValid()); 531 DCHECK(mailbox.IsValid());
532 DCHECK(release_callback); 532 DCHECK(release_callback);
533 if (!texture_layer_) { 533 if (!texture_layer_.get()) {
534 scoped_refptr<cc::TextureLayer> new_layer = 534 scoped_refptr<cc::TextureLayer> new_layer =
535 cc::TextureLayer::CreateForMailbox(this); 535 cc::TextureLayer::CreateForMailbox(this);
536 new_layer->SetFlipped(true); 536 new_layer->SetFlipped(true);
537 SwitchToLayer(new_layer); 537 SwitchToLayer(new_layer);
538 texture_layer_ = new_layer; 538 texture_layer_ = new_layer;
539 } 539 }
540 if (mailbox_release_callback_) 540 if (mailbox_release_callback_)
541 mailbox_release_callback_->Run(0, false); 541 mailbox_release_callback_->Run(0, false);
542 mailbox_release_callback_ = release_callback.Pass(); 542 mailbox_release_callback_ = release_callback.Pass();
543 mailbox_ = mailbox; 543 mailbox_ = mailbox;
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
684 SchedulePaint(gfx::Rect(bounds_.size())); 684 SchedulePaint(gfx::Rect(bounds_.size()));
685 if (delegate_) 685 if (delegate_)
686 delegate_->OnDeviceScaleFactorChanged(device_scale_factor); 686 delegate_->OnDeviceScaleFactorChanged(device_scale_factor);
687 for (size_t i = 0; i < children_.size(); ++i) 687 for (size_t i = 0; i < children_.size(); ++i)
688 children_[i]->OnDeviceScaleFactorChanged(device_scale_factor); 688 children_[i]->OnDeviceScaleFactorChanged(device_scale_factor);
689 if (layer_mask_) 689 if (layer_mask_)
690 layer_mask_->OnDeviceScaleFactorChanged(device_scale_factor); 690 layer_mask_->OnDeviceScaleFactorChanged(device_scale_factor);
691 } 691 }
692 692
693 void Layer::OnDelegatedFrameDamage(const gfx::Rect& damage_rect_in_dip) { 693 void Layer::OnDelegatedFrameDamage(const gfx::Rect& damage_rect_in_dip) {
694 DCHECK(delegated_renderer_layer_ || surface_layer_); 694 DCHECK(delegated_renderer_layer_.get() || surface_layer_.get());
695 if (!delegate_) 695 if (!delegate_)
696 return; 696 return;
697 delegate_->OnDelegatedFrameDamage(damage_rect_in_dip); 697 delegate_->OnDelegatedFrameDamage(damage_rect_in_dip);
698 } 698 }
699 699
700 void Layer::RequestCopyOfOutput(scoped_ptr<cc::CopyOutputRequest> request) { 700 void Layer::RequestCopyOfOutput(scoped_ptr<cc::CopyOutputRequest> request) {
701 cc_layer_->RequestCopyOfOutput(request.Pass()); 701 cc_layer_->RequestCopyOfOutput(request.Pass());
702 } 702 }
703 703
704 void Layer::PaintContents(SkCanvas* sk_canvas, 704 void Layer::PaintContents(SkCanvas* sk_canvas,
(...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after
1031 if (IsAnimating()) 1031 if (IsAnimating())
1032 animator_->RemoveFromCollection(collection); 1032 animator_->RemoveFromCollection(collection);
1033 std::for_each( 1033 std::for_each(
1034 children_.begin(), 1034 children_.begin(),
1035 children_.end(), 1035 children_.end(),
1036 std::bind2nd(std::mem_fun(&Layer::RemoveAnimatorsInTreeFromCollection), 1036 std::bind2nd(std::mem_fun(&Layer::RemoveAnimatorsInTreeFromCollection),
1037 collection)); 1037 collection));
1038 } 1038 }
1039 1039
1040 bool Layer::IsAnimating() const { 1040 bool Layer::IsAnimating() const {
1041 return animator_ && animator_->is_animating(); 1041 return animator_.get() && animator_->is_animating();
1042 } 1042 }
1043 1043
1044 } // namespace ui 1044 } // namespace ui
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698