| OLD | NEW |
| 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/json/json_writer.h" | 10 #include "base/json/json_writer.h" |
| (...skipping 746 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 757 } | 757 } |
| 758 | 758 |
| 759 void Layer::SetForceRenderSurface(bool force) { | 759 void Layer::SetForceRenderSurface(bool force) { |
| 760 if (force_render_surface_ == force) | 760 if (force_render_surface_ == force) |
| 761 return; | 761 return; |
| 762 | 762 |
| 763 force_render_surface_ = force; | 763 force_render_surface_ = force; |
| 764 cc_layer_->SetForceRenderSurface(force_render_surface_); | 764 cc_layer_->SetForceRenderSurface(force_render_surface_); |
| 765 } | 765 } |
| 766 | 766 |
| 767 class LayerDebugInfo : public base::debug::ConvertableToTraceFormat { | 767 class LayerDebugInfo : public base::trace_event::ConvertableToTraceFormat { |
| 768 public: | 768 public: |
| 769 explicit LayerDebugInfo(std::string name) : name_(name) { } | 769 explicit LayerDebugInfo(std::string name) : name_(name) { } |
| 770 void AppendAsTraceFormat(std::string* out) const override { | 770 void AppendAsTraceFormat(std::string* out) const override { |
| 771 base::DictionaryValue dictionary; | 771 base::DictionaryValue dictionary; |
| 772 dictionary.SetString("layer_name", name_); | 772 dictionary.SetString("layer_name", name_); |
| 773 base::JSONWriter::Write(&dictionary, out); | 773 base::JSONWriter::Write(&dictionary, out); |
| 774 } | 774 } |
| 775 | 775 |
| 776 private: | 776 private: |
| 777 ~LayerDebugInfo() override {} | 777 ~LayerDebugInfo() override {} |
| 778 std::string name_; | 778 std::string name_; |
| 779 }; | 779 }; |
| 780 | 780 |
| 781 scoped_refptr<base::debug::ConvertableToTraceFormat> Layer::TakeDebugInfo() { | 781 scoped_refptr<base::trace_event::ConvertableToTraceFormat> |
| 782 Layer::TakeDebugInfo() { |
| 782 return new LayerDebugInfo(name_); | 783 return new LayerDebugInfo(name_); |
| 783 } | 784 } |
| 784 | 785 |
| 785 void Layer::OnAnimationStarted(const cc::AnimationEvent& event) { | 786 void Layer::OnAnimationStarted(const cc::AnimationEvent& event) { |
| 786 if (animator_.get()) | 787 if (animator_.get()) |
| 787 animator_->OnThreadedAnimationStarted(event); | 788 animator_->OnThreadedAnimationStarted(event); |
| 788 } | 789 } |
| 789 | 790 |
| 790 void Layer::CollectAnimators( | 791 void Layer::CollectAnimators( |
| 791 std::vector<scoped_refptr<LayerAnimator> >* animators) { | 792 std::vector<scoped_refptr<LayerAnimator> >* animators) { |
| (...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1066 children_.end(), | 1067 children_.end(), |
| 1067 std::bind2nd(std::mem_fun(&Layer::RemoveAnimatorsInTreeFromCollection), | 1068 std::bind2nd(std::mem_fun(&Layer::RemoveAnimatorsInTreeFromCollection), |
| 1068 collection)); | 1069 collection)); |
| 1069 } | 1070 } |
| 1070 | 1071 |
| 1071 bool Layer::IsAnimating() const { | 1072 bool Layer::IsAnimating() const { |
| 1072 return animator_.get() && animator_->is_animating(); | 1073 return animator_.get() && animator_->is_animating(); |
| 1073 } | 1074 } |
| 1074 | 1075 |
| 1075 } // namespace ui | 1076 } // namespace ui |
| OLD | NEW |