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 <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/atomic_sequence_num.h" | 9 #include "base/atomic_sequence_num.h" |
10 #include "base/location.h" | 10 #include "base/location.h" |
11 #include "base/metrics/histogram.h" | 11 #include "base/metrics/histogram.h" |
12 #include "base/single_thread_task_runner.h" | 12 #include "base/single_thread_task_runner.h" |
13 #include "base/time/time.h" | 13 #include "base/time/time.h" |
14 #include "base/trace_event/trace_event.h" | 14 #include "base/trace_event/trace_event.h" |
15 #include "cc/animation/animation.h" | 15 #include "cc/animation/animation.h" |
16 #include "cc/animation/animation_events.h" | 16 #include "cc/animation/animation_events.h" |
17 #include "cc/animation/animation_registrar.h" | 17 #include "cc/animation/animation_registrar.h" |
18 #include "cc/animation/keyframed_animation_curve.h" | 18 #include "cc/animation/keyframed_animation_curve.h" |
19 #include "cc/animation/layer_animation_controller.h" | 19 #include "cc/animation/layer_animation_controller.h" |
20 #include "cc/base/simple_enclosed_region.h" | 20 #include "cc/base/simple_enclosed_region.h" |
| 21 #include "cc/debug/frame_viewer_instrumentation.h" |
21 #include "cc/layers/layer_client.h" | 22 #include "cc/layers/layer_client.h" |
22 #include "cc/layers/layer_impl.h" | 23 #include "cc/layers/layer_impl.h" |
23 #include "cc/layers/scrollbar_layer_interface.h" | 24 #include "cc/layers/scrollbar_layer_interface.h" |
24 #include "cc/output/copy_output_request.h" | 25 #include "cc/output/copy_output_request.h" |
25 #include "cc/output/copy_output_result.h" | 26 #include "cc/output/copy_output_result.h" |
26 #include "cc/trees/layer_tree_host.h" | 27 #include "cc/trees/layer_tree_host.h" |
27 #include "cc/trees/layer_tree_impl.h" | 28 #include "cc/trees/layer_tree_impl.h" |
28 #include "third_party/skia/include/core/SkImageFilter.h" | 29 #include "third_party/skia/include/core/SkImageFilter.h" |
29 #include "ui/gfx/geometry/rect_conversions.h" | 30 #include "ui/gfx/geometry/rect_conversions.h" |
30 #include "ui/gfx/geometry/vector2d_conversions.h" | 31 #include "ui/gfx/geometry/vector2d_conversions.h" |
(...skipping 859 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
890 bool use_paint_properties = paint_properties_.source_frame_number == | 891 bool use_paint_properties = paint_properties_.source_frame_number == |
891 layer_tree_host_->source_frame_number(); | 892 layer_tree_host_->source_frame_number(); |
892 | 893 |
893 layer->SetTransformOrigin(transform_origin_); | 894 layer->SetTransformOrigin(transform_origin_); |
894 layer->SetBackgroundColor(background_color_); | 895 layer->SetBackgroundColor(background_color_); |
895 layer->SetBounds(use_paint_properties ? paint_properties_.bounds | 896 layer->SetBounds(use_paint_properties ? paint_properties_.bounds |
896 : bounds_); | 897 : bounds_); |
897 layer->SetContentBounds(content_bounds()); | 898 layer->SetContentBounds(content_bounds()); |
898 layer->SetContentsScale(contents_scale_x(), contents_scale_y()); | 899 layer->SetContentsScale(contents_scale_x(), contents_scale_y()); |
899 | 900 |
900 bool is_tracing; | 901 if (frame_viewer_instrumentation::IsTracingLayerTreeSnapshots()) |
901 TRACE_EVENT_CATEGORY_GROUP_ENABLED( | |
902 TRACE_DISABLED_BY_DEFAULT("cc.debug") "," TRACE_DISABLED_BY_DEFAULT( | |
903 "devtools.timeline.layers"), | |
904 &is_tracing); | |
905 if (is_tracing) | |
906 layer->SetDebugInfo(TakeDebugInfo()); | 902 layer->SetDebugInfo(TakeDebugInfo()); |
907 | 903 |
908 layer->SetDoubleSided(double_sided_); | 904 layer->SetDoubleSided(double_sided_); |
909 layer->SetDrawCheckerboardForMissingTiles( | 905 layer->SetDrawCheckerboardForMissingTiles( |
910 draw_checkerboard_for_missing_tiles_); | 906 draw_checkerboard_for_missing_tiles_); |
911 layer->SetDrawsContent(DrawsContent()); | 907 layer->SetDrawsContent(DrawsContent()); |
912 layer->SetHideLayerAndSubtree(hide_layer_and_subtree_); | 908 layer->SetHideLayerAndSubtree(hide_layer_and_subtree_); |
913 layer->SetHasRenderSurface(has_render_surface_ || layer->HasCopyRequest()); | 909 layer->SetHasRenderSurface(has_render_surface_ || layer->HasCopyRequest()); |
914 if (!layer->FilterIsAnimatingOnImplOnly() && !FilterIsAnimating()) | 910 if (!layer->FilterIsAnimatingOnImplOnly() && !FilterIsAnimating()) |
915 layer->SetFilters(filters_); | 911 layer->SetFilters(filters_); |
(...skipping 431 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1347 return draw_opacity; | 1343 return draw_opacity; |
1348 } | 1344 } |
1349 | 1345 |
1350 void Layer::SetFrameTimingRequests( | 1346 void Layer::SetFrameTimingRequests( |
1351 const std::vector<FrameTimingRequest>& requests) { | 1347 const std::vector<FrameTimingRequest>& requests) { |
1352 frame_timing_requests_ = requests; | 1348 frame_timing_requests_ = requests; |
1353 frame_timing_requests_dirty_ = true; | 1349 frame_timing_requests_dirty_ = true; |
1354 SetNeedsCommit(); | 1350 SetNeedsCommit(); |
1355 } | 1351 } |
1356 | 1352 |
| 1353 void Layer::DidBeginTracing() { |
| 1354 // We'll be dumping layer trees as part of trace, so make sure |
| 1355 // PushPropertiesTo() propagates layer debug info to the impl |
| 1356 // side -- otherwise this won't happen for the the layers that |
| 1357 // remain unchanged since tracing started. |
| 1358 SetNeedsPushProperties(); |
| 1359 } |
| 1360 |
1357 } // namespace cc | 1361 } // namespace cc |
OLD | NEW |