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

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

Issue 1725553002: Dump DisplayListRasterSource memory (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: add missing include for windows build Created 4 years, 10 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
« no previous file with comments | « no previous file | cc/playback/display_list_raster_source.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_LIST_RASTER_SOURCE_H_ 5 #ifndef CC_PLAYBACK_DISPLAY_LIST_RASTER_SOURCE_H_
6 #define CC_PLAYBACK_DISPLAY_LIST_RASTER_SOURCE_H_ 6 #define CC_PLAYBACK_DISPLAY_LIST_RASTER_SOURCE_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 9
10 #include <vector> 10 #include <vector>
11 11
12 #include "base/macros.h" 12 #include "base/macros.h"
13 #include "base/memory/scoped_ptr.h" 13 #include "base/memory/scoped_ptr.h"
14 #include "base/threading/thread_checker.h"
15 #include "base/trace_event/memory_allocator_dump.h"
16 #include "base/trace_event/memory_dump_provider.h"
14 #include "cc/base/cc_export.h" 17 #include "cc/base/cc_export.h"
15 #include "cc/debug/rendering_stats_instrumentation.h" 18 #include "cc/debug/rendering_stats_instrumentation.h"
16 #include "cc/playback/display_list_recording_source.h" 19 #include "cc/playback/display_list_recording_source.h"
17 #include "skia/ext/analysis_canvas.h" 20 #include "skia/ext/analysis_canvas.h"
18 #include "skia/ext/refptr.h" 21 #include "skia/ext/refptr.h"
19 #include "third_party/skia/include/core/SkPicture.h" 22 #include "third_party/skia/include/core/SkPicture.h"
20 23
21 namespace cc { 24 namespace cc {
22 class DisplayItemList; 25 class DisplayItemList;
23 class DrawImage; 26 class DrawImage;
24 class ImageDecodeController; 27 class ImageDecodeController;
25 28
26 class CC_EXPORT DisplayListRasterSource 29 class CC_EXPORT DisplayListRasterSource
27 : public base::RefCountedThreadSafe<DisplayListRasterSource> { 30 : public base::trace_event::MemoryDumpProvider,
31 public base::RefCountedThreadSafe<DisplayListRasterSource> {
28 public: 32 public:
29 static scoped_refptr<DisplayListRasterSource> 33 static scoped_refptr<DisplayListRasterSource>
30 CreateFromDisplayListRecordingSource(const DisplayListRecordingSource* other, 34 CreateFromDisplayListRecordingSource(const DisplayListRecordingSource* other,
31 bool can_use_lcd_text); 35 bool can_use_lcd_text);
32 36
33 // Raster a subrect of this RasterSource into the given canvas. It is 37 // Raster a subrect of this RasterSource into the given canvas. It is
34 // assumed that contents_scale has already been applied to this canvas. 38 // assumed that contents_scale has already been applied to this canvas.
35 // Writes the total number of pixels rasterized and the time spent 39 // Writes the total number of pixels rasterized and the time spent
36 // rasterizing to the stats if the respective pointer is not nullptr. 40 // rasterizing to the stats if the respective pointer is not nullptr.
37 // It is assumed that the canvas passed here will only be rasterized by 41 // It is assumed that the canvas passed here will only be rasterized by
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 108
105 // Return true if LCD anti-aliasing may be used when rastering text. 109 // Return true if LCD anti-aliasing may be used when rastering text.
106 virtual bool CanUseLCDText() const; 110 virtual bool CanUseLCDText() const;
107 111
108 scoped_refptr<DisplayListRasterSource> CreateCloneWithoutLCDText() const; 112 scoped_refptr<DisplayListRasterSource> CreateCloneWithoutLCDText() const;
109 113
110 // Image decode controller should be set once. Its lifetime has to exceed that 114 // Image decode controller should be set once. Its lifetime has to exceed that
111 // of the raster source, since the raster source will access it during raster. 115 // of the raster source, since the raster source will access it during raster.
112 void SetImageDecodeController(ImageDecodeController* image_decode_controller); 116 void SetImageDecodeController(ImageDecodeController* image_decode_controller);
113 117
118 // base::trace_event::MemoryDumpProvider implementation
119 bool OnMemoryDump(const base::trace_event::MemoryDumpArgs& args,
120 base::trace_event::ProcessMemoryDump* pmd) override;
121
114 protected: 122 protected:
115 friend class base::RefCountedThreadSafe<DisplayListRasterSource>; 123 friend class base::RefCountedThreadSafe<DisplayListRasterSource>;
116 124
117 DisplayListRasterSource(const DisplayListRecordingSource* other, 125 DisplayListRasterSource(const DisplayListRecordingSource* other,
118 bool can_use_lcd_text); 126 bool can_use_lcd_text);
119 DisplayListRasterSource(const DisplayListRasterSource* other, 127 DisplayListRasterSource(const DisplayListRasterSource* other,
120 bool can_use_lcd_text); 128 bool can_use_lcd_text);
121 virtual ~DisplayListRasterSource(); 129 ~DisplayListRasterSource() override;
122 130
123 // These members are const as this raster source may be in use on another 131 // These members are const as this raster source may be in use on another
124 // thread and so should not be touched after construction. 132 // thread and so should not be touched after construction.
125 const scoped_refptr<DisplayItemList> display_list_; 133 const scoped_refptr<DisplayItemList> display_list_;
126 const size_t painter_reported_memory_usage_; 134 const size_t painter_reported_memory_usage_;
127 const SkColor background_color_; 135 const SkColor background_color_;
128 const bool requires_clear_; 136 const bool requires_clear_;
129 const bool can_use_lcd_text_; 137 const bool can_use_lcd_text_;
130 const bool is_solid_color_; 138 const bool is_solid_color_;
131 const SkColor solid_color_; 139 const SkColor solid_color_;
(...skipping 20 matching lines...) Expand all
152 SkPicture::AbortCallback* callback, 160 SkPicture::AbortCallback* callback,
153 const gfx::Rect& canvas_bitmap_rect, 161 const gfx::Rect& canvas_bitmap_rect,
154 const gfx::Rect& canvas_playback_rect, 162 const gfx::Rect& canvas_playback_rect,
155 float contents_scale) const; 163 float contents_scale) const;
156 164
157 void PrepareForPlaybackToCanvas(SkCanvas* canvas, 165 void PrepareForPlaybackToCanvas(SkCanvas* canvas,
158 const gfx::Rect& canvas_bitmap_rect, 166 const gfx::Rect& canvas_bitmap_rect,
159 const gfx::Rect& canvas_playback_rect, 167 const gfx::Rect& canvas_playback_rect,
160 float contents_scale) const; 168 float contents_scale) const;
161 169
170 // Used to ensure that memory dump logic always happens on the same thread.
171 base::ThreadChecker memory_dump_thread_checker_;
172
162 DISALLOW_COPY_AND_ASSIGN(DisplayListRasterSource); 173 DISALLOW_COPY_AND_ASSIGN(DisplayListRasterSource);
163 }; 174 };
164 175
165 } // namespace cc 176 } // namespace cc
166 177
167 #endif // CC_PLAYBACK_DISPLAY_LIST_RASTER_SOURCE_H_ 178 #endif // CC_PLAYBACK_DISPLAY_LIST_RASTER_SOURCE_H_
OLDNEW
« no previous file with comments | « no previous file | cc/playback/display_list_raster_source.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698