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

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

Issue 1539583003: Convert Pass()→std::move() in ui/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years 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 | « ui/compositor/compositor.cc ('k') | ui/compositor/layer_animation_element.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 (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 #include <utility>
8 9
9 #include "base/auto_reset.h" 10 #include "base/auto_reset.h"
10 #include "base/command_line.h" 11 #include "base/command_line.h"
11 #include "base/json/json_writer.h" 12 #include "base/json/json_writer.h"
12 #include "base/lazy_instance.h" 13 #include "base/lazy_instance.h"
13 #include "base/logging.h" 14 #include "base/logging.h"
14 #include "base/memory/scoped_ptr.h" 15 #include "base/memory/scoped_ptr.h"
15 #include "base/trace_event/trace_event.h" 16 #include "base/trace_event/trace_event.h"
16 #include "cc/layers/delegated_renderer_layer.h" 17 #include "cc/layers/delegated_renderer_layer.h"
17 #include "cc/layers/layer_settings.h" 18 #include "cc/layers/layer_settings.h"
(...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after
356 } 357 }
357 358
358 void Layer::SetBackgroundZoom(float zoom, int inset) { 359 void Layer::SetBackgroundZoom(float zoom, int inset) {
359 zoom_ = zoom; 360 zoom_ = zoom;
360 zoom_inset_ = inset; 361 zoom_inset_ = inset;
361 362
362 SetLayerBackgroundFilters(); 363 SetLayerBackgroundFilters();
363 } 364 }
364 365
365 void Layer::SetAlphaShape(scoped_ptr<SkRegion> region) { 366 void Layer::SetAlphaShape(scoped_ptr<SkRegion> region) {
366 alpha_shape_ = region.Pass(); 367 alpha_shape_ = std::move(region);
367 368
368 SetLayerFilters(); 369 SetLayerFilters();
369 } 370 }
370 371
371 void Layer::SetLayerFilters() { 372 void Layer::SetLayerFilters() {
372 cc::FilterOperations filters; 373 cc::FilterOperations filters;
373 if (layer_saturation_) { 374 if (layer_saturation_) {
374 filters.Append(cc::FilterOperation::CreateSaturateFilter( 375 filters.Append(cc::FilterOperation::CreateSaturateFilter(
375 layer_saturation_)); 376 layer_saturation_));
376 } 377 }
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
545 cc::TextureLayer::CreateForMailbox(UILayerSettings(), this); 546 cc::TextureLayer::CreateForMailbox(UILayerSettings(), this);
546 new_layer->SetFlipped(true); 547 new_layer->SetFlipped(true);
547 SwitchToLayer(new_layer); 548 SwitchToLayer(new_layer);
548 texture_layer_ = new_layer; 549 texture_layer_ = new_layer;
549 // Reset the frame_size_in_dip_ so that SetTextureSize() will not early out, 550 // Reset the frame_size_in_dip_ so that SetTextureSize() will not early out,
550 // the frame_size_in_dip_ was for a previous (different) |texture_layer_|. 551 // the frame_size_in_dip_ was for a previous (different) |texture_layer_|.
551 frame_size_in_dip_ = gfx::Size(); 552 frame_size_in_dip_ = gfx::Size();
552 } 553 }
553 if (mailbox_release_callback_) 554 if (mailbox_release_callback_)
554 mailbox_release_callback_->Run(gpu::SyncToken(), false); 555 mailbox_release_callback_->Run(gpu::SyncToken(), false);
555 mailbox_release_callback_ = release_callback.Pass(); 556 mailbox_release_callback_ = std::move(release_callback);
556 mailbox_ = mailbox; 557 mailbox_ = mailbox;
557 SetTextureSize(texture_size_in_dip); 558 SetTextureSize(texture_size_in_dip);
558 } 559 }
559 560
560 void Layer::SetTextureSize(gfx::Size texture_size_in_dip) { 561 void Layer::SetTextureSize(gfx::Size texture_size_in_dip) {
561 DCHECK(texture_layer_.get()); 562 DCHECK(texture_layer_.get());
562 if (frame_size_in_dip_ == texture_size_in_dip) 563 if (frame_size_in_dip_ == texture_size_in_dip)
563 return; 564 return;
564 frame_size_in_dip_ = texture_size_in_dip; 565 frame_size_in_dip_ = texture_size_in_dip;
565 RecomputeDrawsContentAndUVRect(); 566 RecomputeDrawsContentAndUVRect();
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
738 } 739 }
739 740
740 void Layer::OnDelegatedFrameDamage(const gfx::Rect& damage_rect_in_dip) { 741 void Layer::OnDelegatedFrameDamage(const gfx::Rect& damage_rect_in_dip) {
741 DCHECK(delegated_renderer_layer_.get() || surface_layer_.get()); 742 DCHECK(delegated_renderer_layer_.get() || surface_layer_.get());
742 if (!delegate_) 743 if (!delegate_)
743 return; 744 return;
744 delegate_->OnDelegatedFrameDamage(damage_rect_in_dip); 745 delegate_->OnDelegatedFrameDamage(damage_rect_in_dip);
745 } 746 }
746 747
747 void Layer::RequestCopyOfOutput(scoped_ptr<cc::CopyOutputRequest> request) { 748 void Layer::RequestCopyOfOutput(scoped_ptr<cc::CopyOutputRequest> request) {
748 cc_layer_->RequestCopyOfOutput(request.Pass()); 749 cc_layer_->RequestCopyOfOutput(std::move(request));
749 } 750 }
750 751
751 gfx::Rect Layer::PaintableRegion() { 752 gfx::Rect Layer::PaintableRegion() {
752 return gfx::Rect(size()); 753 return gfx::Rect(size());
753 } 754 }
754 755
755 scoped_refptr<cc::DisplayItemList> Layer::PaintContentsToDisplayList( 756 scoped_refptr<cc::DisplayItemList> Layer::PaintContentsToDisplayList(
756 ContentLayerClient::PaintingControlSetting painting_control) { 757 ContentLayerClient::PaintingControlSetting painting_control) {
757 TRACE_EVENT1("ui", "Layer::PaintContentsToDisplayList", "name", name_); 758 TRACE_EVENT1("ui", "Layer::PaintContentsToDisplayList", "name", name_);
758 gfx::Rect local_bounds(bounds().size()); 759 gfx::Rect local_bounds(bounds().size());
(...skipping 20 matching lines...) Expand all
779 return 0; 780 return 0;
780 } 781 }
781 782
782 bool Layer::PrepareTextureMailbox( 783 bool Layer::PrepareTextureMailbox(
783 cc::TextureMailbox* mailbox, 784 cc::TextureMailbox* mailbox,
784 scoped_ptr<cc::SingleReleaseCallback>* release_callback, 785 scoped_ptr<cc::SingleReleaseCallback>* release_callback,
785 bool use_shared_memory) { 786 bool use_shared_memory) {
786 if (!mailbox_release_callback_) 787 if (!mailbox_release_callback_)
787 return false; 788 return false;
788 *mailbox = mailbox_; 789 *mailbox = mailbox_;
789 *release_callback = mailbox_release_callback_.Pass(); 790 *release_callback = std::move(mailbox_release_callback_);
790 return true; 791 return true;
791 } 792 }
792 793
793 void Layer::SetForceRenderSurface(bool force) { 794 void Layer::SetForceRenderSurface(bool force) {
794 if (force_render_surface_ == force) 795 if (force_render_surface_ == force)
795 return; 796 return;
796 797
797 force_render_surface_ = force; 798 force_render_surface_ = force;
798 cc_layer_->SetForceRenderSurface(force_render_surface_); 799 cc_layer_->SetForceRenderSurface(force_render_surface_);
799 } 800 }
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
966 967
967 float Layer::GetDeviceScaleFactor() const { 968 float Layer::GetDeviceScaleFactor() const {
968 return device_scale_factor_; 969 return device_scale_factor_;
969 } 970 }
970 971
971 void Layer::AddThreadedAnimation(scoped_ptr<cc::Animation> animation) { 972 void Layer::AddThreadedAnimation(scoped_ptr<cc::Animation> animation) {
972 DCHECK(cc_layer_); 973 DCHECK(cc_layer_);
973 // Until this layer has a compositor (and hence cc_layer_ has a 974 // Until this layer has a compositor (and hence cc_layer_ has a
974 // LayerTreeHost), addAnimation will fail. 975 // LayerTreeHost), addAnimation will fail.
975 if (GetCompositor()) 976 if (GetCompositor())
976 cc_layer_->AddAnimation(animation.Pass()); 977 cc_layer_->AddAnimation(std::move(animation));
977 else 978 else
978 pending_threaded_animations_.push_back(animation.Pass()); 979 pending_threaded_animations_.push_back(std::move(animation));
979 } 980 }
980 981
981 void Layer::RemoveThreadedAnimation(int animation_id) { 982 void Layer::RemoveThreadedAnimation(int animation_id) {
982 DCHECK(cc_layer_); 983 DCHECK(cc_layer_);
983 if (pending_threaded_animations_.size() == 0) { 984 if (pending_threaded_animations_.size() == 0) {
984 cc_layer_->RemoveAnimation(animation_id); 985 cc_layer_->RemoveAnimation(animation_id);
985 return; 986 return;
986 } 987 }
987 988
988 pending_threaded_animations_.erase( 989 pending_threaded_animations_.erase(
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
1072 animator_->RemoveFromCollection(collection); 1073 animator_->RemoveFromCollection(collection);
1073 for (auto* child : children_) 1074 for (auto* child : children_)
1074 child->RemoveAnimatorsInTreeFromCollection(collection); 1075 child->RemoveAnimatorsInTreeFromCollection(collection);
1075 } 1076 }
1076 1077
1077 bool Layer::IsAnimating() const { 1078 bool Layer::IsAnimating() const {
1078 return animator_.get() && animator_->is_animating(); 1079 return animator_.get() && animator_->is_animating();
1079 } 1080 }
1080 1081
1081 } // namespace ui 1082 } // namespace ui
OLDNEW
« no previous file with comments | « ui/compositor/compositor.cc ('k') | ui/compositor/layer_animation_element.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698