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

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

Issue 135493002: Plumb debug name via debug info (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 11 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 | Annotate | Revision Log
« no previous file with comments | « ui/compositor/layer.h ('k') | webkit/renderer/compositor_bindings/web_layer_impl.h » ('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 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 644 matching lines...) Expand 10 before | Expand all | Expand 10 after
655 } 655 }
656 656
657 void Layer::SetForceRenderSurface(bool force) { 657 void Layer::SetForceRenderSurface(bool force) {
658 if (force_render_surface_ == force) 658 if (force_render_surface_ == force)
659 return; 659 return;
660 660
661 force_render_surface_ = force; 661 force_render_surface_ = force;
662 cc_layer_->SetForceRenderSurface(force_render_surface_); 662 cc_layer_->SetForceRenderSurface(force_render_surface_);
663 } 663 }
664 664
665 std::string Layer::DebugName() { 665 class LayerDebugInfo : public base::debug::ConvertableToTraceFormat {
666 return name_; 666 public:
667 } 667 explicit LayerDebugInfo(std::string name) : name_(name) { }
668 virtual void AppendAsTraceFormat(std::string* out) const OVERRIDE {
669 out->append("{'layer_name', '" + name_ + "'}");
670 }
671
672 private:
673 virtual ~LayerDebugInfo() { }
674 std::string name_;
675 };
668 676
669 scoped_refptr<base::debug::ConvertableToTraceFormat> Layer::TakeDebugInfo() { 677 scoped_refptr<base::debug::ConvertableToTraceFormat> Layer::TakeDebugInfo() {
670 // TODO: return something useful here. 678 return new LayerDebugInfo(name_);
671 return NULL;
672 } 679 }
673 680
674 void Layer::OnAnimationStarted(const cc::AnimationEvent& event) { 681 void Layer::OnAnimationStarted(const cc::AnimationEvent& event) {
675 if (animator_.get()) 682 if (animator_.get())
676 animator_->OnThreadedAnimationStarted(event); 683 animator_->OnThreadedAnimationStarted(event);
677 } 684 }
678 685
679 void Layer::StackRelativeTo(Layer* child, Layer* other, bool above) { 686 void Layer::StackRelativeTo(Layer* child, Layer* other, bool above) {
680 DCHECK_NE(child, other); 687 DCHECK_NE(child, other);
681 DCHECK_EQ(this, child->parent()); 688 DCHECK_EQ(this, child->parent());
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after
961 cc_layer_->SetBounds(ConvertSizeToPixel(this, size)); 968 cc_layer_->SetBounds(ConvertSizeToPixel(this, size));
962 } 969 }
963 970
964 void Layer::RecomputePosition() { 971 void Layer::RecomputePosition() {
965 cc_layer_->SetPosition(gfx::ScalePoint( 972 cc_layer_->SetPosition(gfx::ScalePoint(
966 gfx::PointF(bounds_.x(), bounds_.y()), 973 gfx::PointF(bounds_.x(), bounds_.y()),
967 device_scale_factor_)); 974 device_scale_factor_));
968 } 975 }
969 976
970 } // namespace ui 977 } // namespace ui
OLDNEW
« no previous file with comments | « ui/compositor/layer.h ('k') | webkit/renderer/compositor_bindings/web_layer_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698