diff options
author | vivek.vg@samsung.com <vivek.vg@samsung.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-12-10 05:48:48 +0000 |
---|---|---|
committer | vivek.vg@samsung.com <vivek.vg@samsung.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-12-10 05:48:48 +0000 |
commit | c55f3fc4f7d6e50b33489678eaf18c3c0be21114 (patch) | |
tree | 302209f76884a43a09ca4ea8d64f256a7c8b2279 /cc | |
parent | 5cc0de5a3ee6bfb79c843445ff6fbeb48896e77d (diff) | |
download | chromium_src-c55f3fc4f7d6e50b33489678eaf18c3c0be21114.zip chromium_src-c55f3fc4f7d6e50b33489678eaf18c3c0be21114.tar.gz chromium_src-c55f3fc4f7d6e50b33489678eaf18c3c0be21114.tar.bz2 |
Use bit fields inside cc to reduce memory usage.
Using bitfields we get the memory usage as follows
+-----+---------------------------+------------------------+---------+
|.No..|.Class/Structure/File......|.Size.of.object.(bytes).|.Memory..|
|.....|...........................+------------------------+.Reduced.|
|.....|...........................|...Before..|...After....|.........|
+-----+---------------------------+-----------+------------+---------+
|..1..|.cc::Layer.................|......840..|.....824....|......16.|
+-----+---------------------------+-----------+------------+---------+
|..2..|.cc::LayerImpl.............|......880..|.....864....|......16.|
+-----+---------------------------+-----------+------------+---------+
|..3..|.cc::RenderSurfaceImpl.....|......408..|.....400....|.......8.|
+-----+---------------------------+-----------+------------+---------+
Review URL: https://codereview.chromium.org/102733006
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@239682 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'cc')
-rw-r--r-- | cc/layers/layer.cc | 12 | ||||
-rw-r--r-- | cc/layers/layer.h | 32 | ||||
-rw-r--r-- | cc/layers/layer_impl.cc | 7 | ||||
-rw-r--r-- | cc/layers/layer_impl.h | 49 | ||||
-rw-r--r-- | cc/layers/render_surface_impl.cc | 2 | ||||
-rw-r--r-- | cc/layers/render_surface_impl.h | 14 |
6 files changed, 57 insertions, 59 deletions
diff --git a/cc/layers/layer.cc b/cc/layers/layer.cc index 3e14e70..f7682fd 100644 --- a/cc/layers/layer.cc +++ b/cc/layers/layer.cc @@ -44,13 +44,7 @@ Layer::Layer() have_wheel_event_handlers_(false), user_scrollable_horizontal_(true), user_scrollable_vertical_(true), - anchor_point_(0.5f, 0.5f), - background_color_(0), - compositing_reasons_(kCompositingReasonUnknown), - opacity_(1.f), - blend_mode_(SkXfermode::kSrcOver_Mode), is_root_for_isolated_group_(false), - anchor_point_z_(0.f), is_container_for_fixed_position_layers_(false), is_drawable_(false), hide_layer_and_subtree_(false), @@ -61,6 +55,12 @@ Layer::Layer() use_parent_backface_visibility_(false), draw_checkerboard_for_missing_tiles_(false), force_render_surface_(false), + anchor_point_(0.5f, 0.5f), + background_color_(0), + compositing_reasons_(kCompositingReasonUnknown), + opacity_(1.f), + blend_mode_(SkXfermode::kSrcOver_Mode), + anchor_point_z_(0.f), scroll_parent_(NULL), clip_parent_(NULL), replica_layer_(NULL), diff --git a/cc/layers/layer.h b/cc/layers/layer.h index 59991e6..f0bca17 100644 --- a/cc/layers/layer.h +++ b/cc/layers/layer.h @@ -573,11 +573,22 @@ class CC_EXPORT Layer : public base::RefCounted<Layer>, gfx::Vector2d scroll_offset_; gfx::Vector2d max_scroll_offset_; - bool scrollable_; - bool should_scroll_on_main_thread_; - bool have_wheel_event_handlers_; - bool user_scrollable_horizontal_; - bool user_scrollable_vertical_; + bool scrollable_ : 1; + bool should_scroll_on_main_thread_ : 1; + bool have_wheel_event_handlers_ : 1; + bool user_scrollable_horizontal_ : 1; + bool user_scrollable_vertical_ : 1; + bool is_root_for_isolated_group_ : 1; + bool is_container_for_fixed_position_layers_ : 1; + bool is_drawable_ : 1; + bool hide_layer_and_subtree_ : 1; + bool masks_to_bounds_ : 1; + bool contents_opaque_ : 1; + bool double_sided_ : 1; + bool preserves_3d_ : 1; + bool use_parent_backface_visibility_ : 1; + bool draw_checkerboard_for_missing_tiles_ : 1; + bool force_render_surface_ : 1; Region non_fast_scrollable_region_; Region touch_event_handler_region_; gfx::PointF position_; @@ -586,21 +597,10 @@ class CC_EXPORT Layer : public base::RefCounted<Layer>, CompositingReasons compositing_reasons_; float opacity_; SkXfermode::Mode blend_mode_; - bool is_root_for_isolated_group_; FilterOperations filters_; FilterOperations background_filters_; float anchor_point_z_; - bool is_container_for_fixed_position_layers_; LayerPositionConstraint position_constraint_; - bool is_drawable_; - bool hide_layer_and_subtree_; - bool masks_to_bounds_; - bool contents_opaque_; - bool double_sided_; - bool preserves_3d_; - bool use_parent_backface_visibility_; - bool draw_checkerboard_for_missing_tiles_; - bool force_render_surface_; Layer* scroll_parent_; scoped_ptr<std::set<Layer*> > scroll_children_; diff --git a/cc/layers/layer_impl.cc b/cc/layers/layer_impl.cc index f60ae81..e94728f 100644 --- a/cc/layers/layer_impl.cc +++ b/cc/layers/layer_impl.cc @@ -30,7 +30,6 @@ #include "ui/gfx/rect_conversions.h" namespace cc { - LayerImpl::LayerImpl(LayerTreeImpl* tree_impl, int id) : parent_(NULL), scroll_parent_(NULL), @@ -47,14 +46,11 @@ LayerImpl::LayerImpl(LayerTreeImpl* tree_impl, int id) have_wheel_event_handlers_(false), user_scrollable_horizontal_(true), user_scrollable_vertical_(true), - background_color_(0), stacking_order_changed_(false), double_sided_(true), layer_property_changed_(false), masks_to_bounds_(false), contents_opaque_(false), - opacity_(1.0), - blend_mode_(SkXfermode::kSrcOver_Mode), is_root_for_isolated_group_(false), preserves_3d_(false), use_parent_backface_visibility_(false), @@ -63,6 +59,9 @@ LayerImpl::LayerImpl(LayerTreeImpl* tree_impl, int id) hide_layer_and_subtree_(false), force_render_surface_(false), is_container_for_fixed_position_layers_(false), + background_color_(0), + opacity_(1.0), + blend_mode_(SkXfermode::kSrcOver_Mode), draw_depth_(0.f), compositing_reasons_(kCompositingReasonUnknown), current_draw_mode_(DRAW_MODE_NONE), diff --git a/cc/layers/layer_impl.h b/cc/layers/layer_impl.h index 13e2876..35147913 100644 --- a/cc/layers/layer_impl.h +++ b/cc/layers/layer_impl.h @@ -52,7 +52,6 @@ class QuadSink; class Renderer; class ScrollbarAnimationController; class ScrollbarLayerImplBase; -class Layer; struct AppendQuadsData; @@ -576,40 +575,40 @@ class CC_EXPORT LayerImpl : public LayerAnimationValueObserver, gfx::Size bounds_; gfx::Vector2d scroll_offset_; LayerScrollOffsetDelegate* scroll_offset_delegate_; - bool scrollable_; - bool should_scroll_on_main_thread_; - bool have_wheel_event_handlers_; - bool user_scrollable_horizontal_; - bool user_scrollable_vertical_; - Region non_fast_scrollable_region_; - Region touch_event_handler_region_; - SkColor background_color_; - bool stacking_order_changed_; - + bool scrollable_ : 1; + bool should_scroll_on_main_thread_ : 1; + bool have_wheel_event_handlers_ : 1; + bool user_scrollable_horizontal_ : 1; + bool user_scrollable_vertical_ : 1; + bool stacking_order_changed_ : 1; // Whether the "back" of this layer should draw. - bool double_sided_; + bool double_sided_ : 1; // Tracks if drawing-related properties have changed since last redraw. - bool layer_property_changed_; + bool layer_property_changed_ : 1; + + bool masks_to_bounds_ : 1; + bool contents_opaque_ : 1; + bool is_root_for_isolated_group_ : 1; + bool preserves_3d_ : 1; + bool use_parent_backface_visibility_ : 1; + bool draw_checkerboard_for_missing_tiles_ : 1; + bool draws_content_ : 1; + bool hide_layer_and_subtree_ : 1; + bool force_render_surface_ : 1; + + // Set for the layer that other layers are fixed to. + bool is_container_for_fixed_position_layers_ : 1; + Region non_fast_scrollable_region_; + Region touch_event_handler_region_; + SkColor background_color_; - bool masks_to_bounds_; - bool contents_opaque_; float opacity_; SkXfermode::Mode blend_mode_; - bool is_root_for_isolated_group_; gfx::PointF position_; - bool preserves_3d_; - bool use_parent_backface_visibility_; - bool draw_checkerboard_for_missing_tiles_; gfx::Transform sublayer_transform_; gfx::Transform transform_; - bool draws_content_; - bool hide_layer_and_subtree_; - bool force_render_surface_; - - // Set for the layer that other layers are fixed to. - bool is_container_for_fixed_position_layers_; // This property is effective when // is_container_for_fixed_position_layers_ == true, gfx::Vector2dF fixed_container_size_delta_; diff --git a/cc/layers/render_surface_impl.cc b/cc/layers/render_surface_impl.cc index 50a098c..a8336bc 100644 --- a/cc/layers/render_surface_impl.cc +++ b/cc/layers/render_surface_impl.cc @@ -28,12 +28,12 @@ namespace cc { RenderSurfaceImpl::RenderSurfaceImpl(LayerImpl* owning_layer) : owning_layer_(owning_layer), surface_property_changed_(false), - draw_opacity_(1), draw_opacity_is_animating_(false), target_surface_transforms_are_animating_(false), screen_space_transforms_are_animating_(false), is_clipped_(false), contributes_to_drawn_surface_(false), + draw_opacity_(1), nearest_occlusion_immune_ancestor_(NULL), target_render_surface_layer_index_history_(0), current_layer_index_history_(0) { diff --git a/cc/layers/render_surface_impl.h b/cc/layers/render_surface_impl.h index 91f7d72..c02a3194 100644 --- a/cc/layers/render_surface_impl.h +++ b/cc/layers/render_surface_impl.h @@ -145,19 +145,19 @@ class CC_EXPORT RenderSurfaceImpl { // Uses this surface's space. gfx::Rect content_rect_; - bool surface_property_changed_; + bool surface_property_changed_ : 1; + bool draw_opacity_is_animating_ : 1; + bool target_surface_transforms_are_animating_ : 1; + bool screen_space_transforms_are_animating_ : 1; + + bool is_clipped_ : 1; + bool contributes_to_drawn_surface_ : 1; float draw_opacity_; - bool draw_opacity_is_animating_; gfx::Transform draw_transform_; gfx::Transform screen_space_transform_; gfx::Transform replica_draw_transform_; gfx::Transform replica_screen_space_transform_; - bool target_surface_transforms_are_animating_; - bool screen_space_transforms_are_animating_; - - bool is_clipped_; - bool contributes_to_drawn_surface_; // Uses the space of the surface's target surface. gfx::Rect clip_rect_; |