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/debug/trace_event.h" | 10 #include "base/debug/trace_event.h" |
11 #include "base/json/json_writer.h" | 11 #include "base/json/json_writer.h" |
12 #include "base/logging.h" | 12 #include "base/logging.h" |
13 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
14 #include "cc/base/scoped_ptr_algorithm.h" | 14 #include "cc/base/scoped_ptr_algorithm.h" |
| 15 #include "cc/debug/layer_debug_info.h" |
15 #include "cc/layers/content_layer.h" | 16 #include "cc/layers/content_layer.h" |
16 #include "cc/layers/delegated_renderer_layer.h" | 17 #include "cc/layers/delegated_renderer_layer.h" |
17 #include "cc/layers/nine_patch_layer.h" | 18 #include "cc/layers/nine_patch_layer.h" |
18 #include "cc/layers/picture_layer.h" | 19 #include "cc/layers/picture_layer.h" |
19 #include "cc/layers/solid_color_layer.h" | 20 #include "cc/layers/solid_color_layer.h" |
20 #include "cc/layers/surface_layer.h" | 21 #include "cc/layers/surface_layer.h" |
21 #include "cc/layers/texture_layer.h" | 22 #include "cc/layers/texture_layer.h" |
22 #include "cc/output/copy_output_request.h" | 23 #include "cc/output/copy_output_request.h" |
23 #include "cc/output/delegated_frame_data.h" | 24 #include "cc/output/delegated_frame_data.h" |
24 #include "cc/output/filter_operation.h" | 25 #include "cc/output/filter_operation.h" |
(...skipping 707 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
732 } | 733 } |
733 | 734 |
734 void Layer::SetForceRenderSurface(bool force) { | 735 void Layer::SetForceRenderSurface(bool force) { |
735 if (force_render_surface_ == force) | 736 if (force_render_surface_ == force) |
736 return; | 737 return; |
737 | 738 |
738 force_render_surface_ = force; | 739 force_render_surface_ = force; |
739 cc_layer_->SetForceRenderSurface(force_render_surface_); | 740 cc_layer_->SetForceRenderSurface(force_render_surface_); |
740 } | 741 } |
741 | 742 |
742 class LayerDebugInfo : public base::debug::ConvertableToTraceFormat { | 743 class UILayerDebugInfo : public cc::LayerDebugInfo { |
743 public: | 744 public: |
744 explicit LayerDebugInfo(std::string name) : name_(name) { } | 745 explicit UILayerDebugInfo(std::string name) : name_(name) {} |
745 virtual void AppendAsTraceFormat(std::string* out) const OVERRIDE { | 746 virtual void AppendAsTraceFormat(std::string* out) const OVERRIDE { |
746 base::DictionaryValue dictionary; | 747 base::DictionaryValue dictionary; |
747 dictionary.SetString("layer_name", name_); | 748 dictionary.SetString("layer_name", name_); |
748 base::JSONWriter::Write(&dictionary, out); | 749 base::JSONWriter::Write(&dictionary, out); |
749 } | 750 } |
750 | 751 |
751 private: | 752 private: |
752 virtual ~LayerDebugInfo() { } | 753 virtual ~UILayerDebugInfo() {} |
753 std::string name_; | 754 std::string name_; |
754 }; | 755 }; |
755 | 756 |
756 scoped_refptr<base::debug::ConvertableToTraceFormat> Layer::TakeDebugInfo() { | 757 scoped_refptr<cc::LayerDebugInfo> Layer::TakeDebugInfo() { |
757 return new LayerDebugInfo(name_); | 758 return new UILayerDebugInfo(name_); |
758 } | 759 } |
759 | 760 |
760 void Layer::OnAnimationStarted(const cc::AnimationEvent& event) { | 761 void Layer::OnAnimationStarted(const cc::AnimationEvent& event) { |
761 if (animator_.get()) | 762 if (animator_.get()) |
762 animator_->OnThreadedAnimationStarted(event); | 763 animator_->OnThreadedAnimationStarted(event); |
763 } | 764 } |
764 | 765 |
765 void Layer::CollectAnimators( | 766 void Layer::CollectAnimators( |
766 std::vector<scoped_refptr<LayerAnimator> >* animators) { | 767 std::vector<scoped_refptr<LayerAnimator> >* animators) { |
767 if (IsAnimating()) | 768 if (IsAnimating()) |
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1041 children_.end(), | 1042 children_.end(), |
1042 std::bind2nd(std::mem_fun(&Layer::RemoveAnimatorsInTreeFromCollection), | 1043 std::bind2nd(std::mem_fun(&Layer::RemoveAnimatorsInTreeFromCollection), |
1043 collection)); | 1044 collection)); |
1044 } | 1045 } |
1045 | 1046 |
1046 bool Layer::IsAnimating() const { | 1047 bool Layer::IsAnimating() const { |
1047 return animator_.get() && animator_->is_animating(); | 1048 return animator_.get() && animator_->is_animating(); |
1048 } | 1049 } |
1049 | 1050 |
1050 } // namespace ui | 1051 } // namespace ui |
OLD | NEW |