Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(677)

Side by Side Diff: cc/playback/display_item_list.h

Issue 1226503006: cc: More consistent reasoning about display list memory usage. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: capacity unit test Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 #ifndef CC_PLAYBACK_DISPLAY_ITEM_LIST_H_ 5 #ifndef CC_PLAYBACK_DISPLAY_ITEM_LIST_H_
6 #define CC_PLAYBACK_DISPLAY_ITEM_LIST_H_ 6 #define CC_PLAYBACK_DISPLAY_ITEM_LIST_H_
7 7
8 #include "base/gtest_prod_util.h" 8 #include "base/gtest_prod_util.h"
9 #include "base/memory/ref_counted.h" 9 #include "base/memory/ref_counted.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 // (since the data may already have been incorporated into cached picture 63 // (since the data may already have been incorporated into cached picture
64 // sizes, etc). 64 // sizes, etc).
65 void RemoveLast(); 65 void RemoveLast();
66 66
67 // Called after all items are appended, to process the items and, if 67 // Called after all items are appended, to process the items and, if
68 // applicable, create an internally cached SkPicture. 68 // applicable, create an internally cached SkPicture.
69 void Finalize(); 69 void Finalize();
70 70
71 bool IsSuitableForGpuRasterization() const; 71 bool IsSuitableForGpuRasterization() const;
72 int ApproximateOpCount() const; 72 int ApproximateOpCount() const;
73 size_t PictureMemoryUsage() const; 73 size_t ApproximateMemoryUsage() const;
74 74
75 bool RetainsIndividualDisplayItems() const; 75 bool RetainsIndividualDisplayItems() const;
76 76
77 scoped_refptr<base::trace_event::ConvertableToTraceFormat> AsValue( 77 scoped_refptr<base::trace_event::ConvertableToTraceFormat> AsValue(
78 bool include_items) const; 78 bool include_items) const;
79 79
80 void EmitTraceSnapshot() const; 80 void EmitTraceSnapshot() const;
81 81
82 void GatherPixelRefs(const gfx::Size& grid_cell_size); 82 void GatherPixelRefs(const gfx::Size& grid_cell_size);
83 83
(...skipping 23 matching lines...) Expand all
107 skia::RefPtr<SkPicture> picture_; 107 skia::RefPtr<SkPicture> picture_;
108 108
109 scoped_ptr<SkPictureRecorder> recorder_; 109 scoped_ptr<SkPictureRecorder> recorder_;
110 skia::RefPtr<SkCanvas> canvas_; 110 skia::RefPtr<SkCanvas> canvas_;
111 bool use_cached_picture_; 111 bool use_cached_picture_;
112 bool retain_individual_display_items_; 112 bool retain_individual_display_items_;
113 113
114 gfx::Rect layer_rect_; 114 gfx::Rect layer_rect_;
115 bool is_suitable_for_gpu_rasterization_; 115 bool is_suitable_for_gpu_rasterization_;
116 int approximate_op_count_; 116 int approximate_op_count_;
117
118 // Memory usage due to the cached SkPicture.
117 size_t picture_memory_usage_; 119 size_t picture_memory_usage_;
118 120
121 // Memory usage due to external data held by display items.
122 size_t external_memory_usage_;
123
119 scoped_ptr<PixelRefMap> pixel_refs_; 124 scoped_ptr<PixelRefMap> pixel_refs_;
120 125
121 friend class base::RefCountedThreadSafe<DisplayItemList>; 126 friend class base::RefCountedThreadSafe<DisplayItemList>;
122 friend class PixelRefMap::Iterator; 127 friend class PixelRefMap::Iterator;
123 FRIEND_TEST_ALL_PREFIXES(DisplayItemListTest, PictureMemoryUsage); 128 FRIEND_TEST_ALL_PREFIXES(DisplayItemListTest, ApproximateMemoryUsage);
124 DISALLOW_COPY_AND_ASSIGN(DisplayItemList); 129 DISALLOW_COPY_AND_ASSIGN(DisplayItemList);
125 }; 130 };
126 131
127 } // namespace cc 132 } // namespace cc
128 133
129 #endif // CC_PLAYBACK_DISPLAY_ITEM_LIST_H_ 134 #endif // CC_PLAYBACK_DISPLAY_ITEM_LIST_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698