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/debug/trace_event.h" | 10 #include "base/debug/trace_event.h" |
(...skipping 22 matching lines...) Expand all Loading... | |
33 base::StaticAtomicSequenceNumber g_next_layer_id; | 33 base::StaticAtomicSequenceNumber g_next_layer_id; |
34 | 34 |
35 scoped_refptr<Layer> Layer::Create() { | 35 scoped_refptr<Layer> Layer::Create() { |
36 return make_scoped_refptr(new Layer()); | 36 return make_scoped_refptr(new Layer()); |
37 } | 37 } |
38 | 38 |
39 Layer::Layer() | 39 Layer::Layer() |
40 : needs_push_properties_(false), | 40 : needs_push_properties_(false), |
41 num_dependents_need_push_properties_(false), | 41 num_dependents_need_push_properties_(false), |
42 stacking_order_changed_(false), | 42 stacking_order_changed_(false), |
43 includes_first_paint_invalidation_(false), | |
43 // Layer IDs start from 1. | 44 // Layer IDs start from 1. |
44 layer_id_(g_next_layer_id.GetNext() + 1), | 45 layer_id_(g_next_layer_id.GetNext() + 1), |
45 ignore_set_needs_commit_(false), | 46 ignore_set_needs_commit_(false), |
46 sorting_context_id_(0), | 47 sorting_context_id_(0), |
47 parent_(NULL), | 48 parent_(NULL), |
48 layer_tree_host_(NULL), | 49 layer_tree_host_(NULL), |
49 scroll_clip_layer_id_(INVALID_ID), | 50 scroll_clip_layer_id_(INVALID_ID), |
50 num_descendants_that_draw_content_(0), | 51 num_descendants_that_draw_content_(0), |
51 should_scroll_on_main_thread_(false), | 52 should_scroll_on_main_thread_(false), |
52 have_wheel_event_handlers_(false), | 53 have_wheel_event_handlers_(false), |
(...skipping 810 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
863 : bounds_); | 864 : bounds_); |
864 layer->SetContentBounds(content_bounds()); | 865 layer->SetContentBounds(content_bounds()); |
865 layer->SetContentsScale(contents_scale_x(), contents_scale_y()); | 866 layer->SetContentsScale(contents_scale_x(), contents_scale_y()); |
866 | 867 |
867 bool is_tracing; | 868 bool is_tracing; |
868 TRACE_EVENT_CATEGORY_GROUP_ENABLED( | 869 TRACE_EVENT_CATEGORY_GROUP_ENABLED( |
869 TRACE_DISABLED_BY_DEFAULT("cc.debug") "," TRACE_DISABLED_BY_DEFAULT( | 870 TRACE_DISABLED_BY_DEFAULT("cc.debug") "," TRACE_DISABLED_BY_DEFAULT( |
870 "devtools.timeline.layers"), | 871 "devtools.timeline.layers"), |
871 &is_tracing); | 872 &is_tracing); |
872 if (is_tracing) | 873 if (is_tracing) |
873 layer->SetDebugInfo(TakeDebugInfo()); | 874 layer->SetDebugInfo(TakeDebugInfo()); |
chrishtr
2014/08/20 04:28:56
Let's extend the GraphicsLayerDebugInfo struct to
| |
874 | 875 |
875 layer->SetDoubleSided(double_sided_); | 876 layer->SetDoubleSided(double_sided_); |
876 layer->SetDrawCheckerboardForMissingTiles( | 877 layer->SetDrawCheckerboardForMissingTiles( |
877 draw_checkerboard_for_missing_tiles_); | 878 draw_checkerboard_for_missing_tiles_); |
878 layer->SetForceRenderSurface(force_render_surface_); | 879 layer->SetForceRenderSurface(force_render_surface_); |
879 layer->SetDrawsContent(DrawsContent()); | 880 layer->SetDrawsContent(DrawsContent()); |
880 layer->SetHideLayerAndSubtree(hide_layer_and_subtree_); | 881 layer->SetHideLayerAndSubtree(hide_layer_and_subtree_); |
881 if (!layer->FilterIsAnimatingOnImplOnly() && !FilterIsAnimating()) | 882 if (!layer->FilterIsAnimatingOnImplOnly() && !FilterIsAnimating()) |
882 layer->SetFilters(filters_); | 883 layer->SetFilters(filters_); |
883 DCHECK(!(FilterIsAnimating() && layer->FilterIsAnimatingOnImplOnly())); | 884 DCHECK(!(FilterIsAnimating() && layer->FilterIsAnimatingOnImplOnly())); |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
985 } | 986 } |
986 copy_requests_.clear(); | 987 copy_requests_.clear(); |
987 layer->PassCopyRequests(&main_thread_copy_requests); | 988 layer->PassCopyRequests(&main_thread_copy_requests); |
988 | 989 |
989 // If the main thread commits multiple times before the impl thread actually | 990 // If the main thread commits multiple times before the impl thread actually |
990 // draws, then damage tracking will become incorrect if we simply clobber the | 991 // draws, then damage tracking will become incorrect if we simply clobber the |
991 // update_rect here. The LayerImpl's update_rect needs to accumulate (i.e. | 992 // update_rect here. The LayerImpl's update_rect needs to accumulate (i.e. |
992 // union) any update changes that have occurred on the main thread. | 993 // union) any update changes that have occurred on the main thread. |
993 update_rect_.Union(layer->update_rect()); | 994 update_rect_.Union(layer->update_rect()); |
994 layer->SetUpdateRect(update_rect_); | 995 layer->SetUpdateRect(update_rect_); |
996 layer->SetIncludesFirstPaintInvalidation(includes_first_paint_invalidation_); | |
997 includes_first_paint_invalidation_ = false; | |
995 | 998 |
996 layer->SetStackingOrderChanged(stacking_order_changed_); | 999 layer->SetStackingOrderChanged(stacking_order_changed_); |
997 | 1000 |
998 layer_animation_controller_->PushAnimationUpdatesTo( | 1001 layer_animation_controller_->PushAnimationUpdatesTo( |
999 layer->layer_animation_controller()); | 1002 layer->layer_animation_controller()); |
1000 | 1003 |
1001 // Reset any state that should be cleared for the next update. | 1004 // Reset any state that should be cleared for the next update. |
1002 stacking_order_changed_ = false; | 1005 stacking_order_changed_ = false; |
1003 update_rect_ = gfx::RectF(); | 1006 update_rect_ = gfx::RectF(); |
1004 | 1007 |
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1236 | 1239 |
1237 void Layer::RunMicroBenchmark(MicroBenchmark* benchmark) { | 1240 void Layer::RunMicroBenchmark(MicroBenchmark* benchmark) { |
1238 benchmark->RunOnLayer(this); | 1241 benchmark->RunOnLayer(this); |
1239 } | 1242 } |
1240 | 1243 |
1241 bool Layer::HasDelegatedContent() const { | 1244 bool Layer::HasDelegatedContent() const { |
1242 return false; | 1245 return false; |
1243 } | 1246 } |
1244 | 1247 |
1245 } // namespace cc | 1248 } // namespace cc |
OLD | NEW |