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