| OLD | NEW |
| 1 // Copyright 2010 The Chromium Authors. All rights reserved. | 1 // Copyright 2010 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 "cc/layers/layer.h" | 5 #include "cc/layers/layer.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <algorithm> | 10 #include <algorithm> |
| 11 | 11 |
| 12 #include "base/atomic_sequence_num.h" | 12 #include "base/atomic_sequence_num.h" |
| 13 #include "base/location.h" | 13 #include "base/location.h" |
| 14 #include "base/metrics/histogram.h" | 14 #include "base/metrics/histogram.h" |
| 15 #include "base/single_thread_task_runner.h" | 15 #include "base/single_thread_task_runner.h" |
| 16 #include "base/time/time.h" | 16 #include "base/time/time.h" |
| 17 #include "base/trace_event/trace_event.h" | 17 #include "base/trace_event/trace_event.h" |
| 18 #include "cc/animation/animation.h" | 18 #include "cc/animation/animation.h" |
| 19 #include "cc/animation/animation_registrar.h" | 19 #include "cc/animation/animation_registrar.h" |
| 20 #include "cc/animation/keyframed_animation_curve.h" | 20 #include "cc/animation/keyframed_animation_curve.h" |
| 21 #include "cc/animation/layer_animation_controller.h" | 21 #include "cc/animation/layer_animation_controller.h" |
| 22 #include "cc/animation/mutable_properties.h" | 22 #include "cc/animation/mutable_properties.h" |
| 23 #include "cc/base/simple_enclosed_region.h" | 23 #include "cc/base/simple_enclosed_region.h" |
| 24 #include "cc/debug/frame_viewer_instrumentation.h" | 24 #include "cc/debug/frame_viewer_instrumentation.h" |
| 25 #include "cc/debug/layer_debug_info.h" |
| 25 #include "cc/input/main_thread_scrolling_reason.h" | 26 #include "cc/input/main_thread_scrolling_reason.h" |
| 26 #include "cc/layers/layer_client.h" | 27 #include "cc/layers/layer_client.h" |
| 27 #include "cc/layers/layer_impl.h" | 28 #include "cc/layers/layer_impl.h" |
| 28 #include "cc/layers/layer_proto_converter.h" | 29 #include "cc/layers/layer_proto_converter.h" |
| 29 #include "cc/layers/layer_settings.h" | 30 #include "cc/layers/layer_settings.h" |
| 30 #include "cc/layers/scrollbar_layer_interface.h" | 31 #include "cc/layers/scrollbar_layer_interface.h" |
| 31 #include "cc/output/copy_output_request.h" | 32 #include "cc/output/copy_output_request.h" |
| 32 #include "cc/output/copy_output_result.h" | 33 #include "cc/output/copy_output_result.h" |
| 33 #include "cc/proto/cc_conversions.h" | 34 #include "cc/proto/cc_conversions.h" |
| 34 #include "cc/proto/gfx_conversions.h" | 35 #include "cc/proto/gfx_conversions.h" |
| (...skipping 1186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1221 // real property values, not the paint property values. | 1222 // real property values, not the paint property values. |
| 1222 bool use_paint_properties = paint_properties_.source_frame_number == | 1223 bool use_paint_properties = paint_properties_.source_frame_number == |
| 1223 layer_tree_host_->source_frame_number(); | 1224 layer_tree_host_->source_frame_number(); |
| 1224 | 1225 |
| 1225 layer->SetTransformOrigin(transform_origin_); | 1226 layer->SetTransformOrigin(transform_origin_); |
| 1226 layer->SetBackgroundColor(background_color_); | 1227 layer->SetBackgroundColor(background_color_); |
| 1227 layer->SetBounds(use_paint_properties ? paint_properties_.bounds | 1228 layer->SetBounds(use_paint_properties ? paint_properties_.bounds |
| 1228 : bounds_); | 1229 : bounds_); |
| 1229 | 1230 |
| 1230 #if defined(NDEBUG) | 1231 #if defined(NDEBUG) |
| 1231 if (frame_viewer_instrumentation::IsTracingLayerTreeSnapshots()) | 1232 if (frame_viewer_instrumentation::IsTracingLayerTreeSnapshots()) { |
| 1232 layer->SetDebugInfo(TakeDebugInfo()); | 1233 layer->SetDebugInfo( |
| 1234 make_scoped_refptr(new LayerDebugInfo(TakeDebugInfo()))); |
| 1235 } |
| 1233 #else | 1236 #else |
| 1234 layer->SetDebugInfo(TakeDebugInfo()); | 1237 layer->SetDebugInfo(make_scoped_refptr(new LayerDebugInfo(TakeDebugInfo()))); |
| 1235 #endif | 1238 #endif |
| 1236 | 1239 |
| 1237 layer->SetTransformTreeIndex(transform_tree_index()); | 1240 layer->SetTransformTreeIndex(transform_tree_index()); |
| 1238 layer->SetEffectTreeIndex(effect_tree_index()); | 1241 layer->SetEffectTreeIndex(effect_tree_index()); |
| 1239 layer->SetClipTreeIndex(clip_tree_index()); | 1242 layer->SetClipTreeIndex(clip_tree_index()); |
| 1240 layer->SetScrollTreeIndex(scroll_tree_index()); | 1243 layer->SetScrollTreeIndex(scroll_tree_index()); |
| 1241 layer->set_offset_to_transform_parent(offset_to_transform_parent_); | 1244 layer->set_offset_to_transform_parent(offset_to_transform_parent_); |
| 1242 layer->SetDoubleSided(double_sided_); | 1245 layer->SetDoubleSided(double_sided_); |
| 1243 layer->SetDrawsContent(DrawsContent()); | 1246 layer->SetDrawsContent(DrawsContent()); |
| 1244 layer->SetHideLayerAndSubtree(hide_layer_and_subtree_); | 1247 layer->SetHideLayerAndSubtree(hide_layer_and_subtree_); |
| (...skipping 498 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1743 DCHECK_EQ(layer_tree_host_->source_frame_number(), | 1746 DCHECK_EQ(layer_tree_host_->source_frame_number(), |
| 1744 paint_properties_.source_frame_number) << | 1747 paint_properties_.source_frame_number) << |
| 1745 "SavePaintProperties must be called for any layer that is painted."; | 1748 "SavePaintProperties must be called for any layer that is painted."; |
| 1746 return false; | 1749 return false; |
| 1747 } | 1750 } |
| 1748 | 1751 |
| 1749 bool Layer::IsSuitableForGpuRasterization() const { | 1752 bool Layer::IsSuitableForGpuRasterization() const { |
| 1750 return true; | 1753 return true; |
| 1751 } | 1754 } |
| 1752 | 1755 |
| 1753 scoped_refptr<base::trace_event::ConvertableToTraceFormat> | 1756 scoped_ptr<base::trace_event::ConvertableToTraceFormat> Layer::TakeDebugInfo() { |
| 1754 Layer::TakeDebugInfo() { | |
| 1755 if (client_) | 1757 if (client_) |
| 1756 return client_->TakeDebugInfo(this); | 1758 return client_->TakeDebugInfo(this); |
| 1757 else | 1759 else |
| 1758 return nullptr; | 1760 return nullptr; |
| 1759 } | 1761 } |
| 1760 | 1762 |
| 1761 void Layer::SetHasRenderSurface(bool has_render_surface) { | 1763 void Layer::SetHasRenderSurface(bool has_render_surface) { |
| 1762 if (has_render_surface_ == has_render_surface) | 1764 if (has_render_surface_ == has_render_surface) |
| 1763 return; | 1765 return; |
| 1764 has_render_surface_ = has_render_surface; | 1766 has_render_surface_ = has_render_surface; |
| (...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2076 this, layer_tree_host_->property_trees()->transform_tree); | 2078 this, layer_tree_host_->property_trees()->transform_tree); |
| 2077 } | 2079 } |
| 2078 | 2080 |
| 2079 gfx::Transform Layer::screen_space_transform() const { | 2081 gfx::Transform Layer::screen_space_transform() const { |
| 2080 DCHECK_NE(transform_tree_index_, -1); | 2082 DCHECK_NE(transform_tree_index_, -1); |
| 2081 return ScreenSpaceTransformFromPropertyTrees( | 2083 return ScreenSpaceTransformFromPropertyTrees( |
| 2082 this, layer_tree_host_->property_trees()->transform_tree); | 2084 this, layer_tree_host_->property_trees()->transform_tree); |
| 2083 } | 2085 } |
| 2084 | 2086 |
| 2085 } // namespace cc | 2087 } // namespace cc |
| OLD | NEW |