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

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

Issue 1717283003: tracing: Make ConvertableToTraceFormat move-only scoped_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 9 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 #include <utility> 8 #include <utility>
9 9
10 #include "base/auto_reset.h" 10 #include "base/auto_reset.h"
(...skipping 786 matching lines...) Expand 10 before | Expand all | Expand 10 after
797 if (force_render_surface_ == force) 797 if (force_render_surface_ == force)
798 return; 798 return;
799 799
800 force_render_surface_ = force; 800 force_render_surface_ = force;
801 cc_layer_->SetForceRenderSurface(force_render_surface_); 801 cc_layer_->SetForceRenderSurface(force_render_surface_);
802 } 802 }
803 803
804 class LayerDebugInfo : public base::trace_event::ConvertableToTraceFormat { 804 class LayerDebugInfo : public base::trace_event::ConvertableToTraceFormat {
805 public: 805 public:
806 explicit LayerDebugInfo(const std::string& name) : name_(name) {} 806 explicit LayerDebugInfo(const std::string& name) : name_(name) {}
807 ~LayerDebugInfo() override {}
807 void AppendAsTraceFormat(std::string* out) const override { 808 void AppendAsTraceFormat(std::string* out) const override {
808 base::DictionaryValue dictionary; 809 base::DictionaryValue dictionary;
809 dictionary.SetString("layer_name", name_); 810 dictionary.SetString("layer_name", name_);
810 base::JSONWriter::Write(dictionary, out); 811 base::JSONWriter::Write(dictionary, out);
811 } 812 }
812 813
813 private: 814 private:
814 ~LayerDebugInfo() override {}
815 std::string name_; 815 std::string name_;
816 }; 816 };
817 817
818 scoped_refptr<base::trace_event::ConvertableToTraceFormat> Layer::TakeDebugInfo( 818 scoped_ptr<base::trace_event::ConvertableToTraceFormat> Layer::TakeDebugInfo(
819 cc::Layer* layer) { 819 cc::Layer* layer) {
820 return new LayerDebugInfo(name_); 820 return make_scoped_ptr(new LayerDebugInfo(name_));
821 } 821 }
822 822
823 void Layer::CollectAnimators( 823 void Layer::CollectAnimators(
824 std::vector<scoped_refptr<LayerAnimator>>* animators) { 824 std::vector<scoped_refptr<LayerAnimator>>* animators) {
825 if (animator_ && animator_->is_animating()) 825 if (animator_ && animator_->is_animating())
826 animators->push_back(animator_); 826 animators->push_back(animator_);
827 for (auto* child : children_) 827 for (auto* child : children_)
828 child->CollectAnimators(animators); 828 child->CollectAnimators(animators);
829 } 829 }
830 830
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after
1098 animator_->ResetCompositor(compositor); 1098 animator_->ResetCompositor(compositor);
1099 if (animator_->is_animating()) 1099 if (animator_->is_animating())
1100 animator_->RemoveFromCollection(collection); 1100 animator_->RemoveFromCollection(collection);
1101 } 1101 }
1102 1102
1103 for (auto* child : children_) 1103 for (auto* child : children_)
1104 child->ResetCompositorForAnimatorsInTree(compositor); 1104 child->ResetCompositorForAnimatorsInTree(compositor);
1105 } 1105 }
1106 1106
1107 } // namespace ui 1107 } // namespace ui
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698