| OLD | NEW |
| 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_RASTER_SOURCE_H_ | 5 #ifndef CC_PLAYBACK_RASTER_SOURCE_H_ |
| 6 #define CC_PLAYBACK_RASTER_SOURCE_H_ | 6 #define CC_PLAYBACK_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" | |
| 17 #include "cc/base/cc_export.h" | 14 #include "cc/base/cc_export.h" |
| 18 #include "cc/debug/rendering_stats_instrumentation.h" | 15 #include "cc/debug/rendering_stats_instrumentation.h" |
| 19 #include "cc/playback/recording_source.h" | 16 #include "cc/playback/recording_source.h" |
| 20 #include "skia/ext/analysis_canvas.h" | 17 #include "skia/ext/analysis_canvas.h" |
| 21 #include "third_party/skia/include/core/SkPicture.h" | 18 #include "third_party/skia/include/core/SkPicture.h" |
| 22 | 19 |
| 23 namespace cc { | 20 namespace cc { |
| 24 class DisplayItemList; | 21 class DisplayItemList; |
| 25 class DrawImage; | 22 class DrawImage; |
| 26 class ImageDecodeController; | 23 class ImageDecodeController; |
| 27 | 24 |
| 28 class CC_EXPORT RasterSource : public base::trace_event::MemoryDumpProvider, | 25 class CC_EXPORT RasterSource : public base::RefCountedThreadSafe<RasterSource> { |
| 29 public base::RefCountedThreadSafe<RasterSource> { | |
| 30 public: | 26 public: |
| 31 struct CC_EXPORT PlaybackSettings { | 27 struct CC_EXPORT PlaybackSettings { |
| 32 PlaybackSettings(); | 28 PlaybackSettings(); |
| 33 | 29 |
| 34 // If set to true, this indicates that the canvas has already been | 30 // If set to true, this indicates that the canvas has already been |
| 35 // rasterized into. This means that the canvas cannot be cleared safely. | 31 // rasterized into. This means that the canvas cannot be cleared safely. |
| 36 bool playback_to_shared_canvas; | 32 bool playback_to_shared_canvas; |
| 37 | 33 |
| 38 // If set to true, none of the images will be rasterized. | 34 // If set to true, none of the images will be rasterized. |
| 39 bool skip_images; | 35 bool skip_images; |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 113 | 109 |
| 114 // Return true if LCD anti-aliasing may be used when rastering text. | 110 // Return true if LCD anti-aliasing may be used when rastering text. |
| 115 virtual bool CanUseLCDText() const; | 111 virtual bool CanUseLCDText() const; |
| 116 | 112 |
| 117 scoped_refptr<RasterSource> CreateCloneWithoutLCDText() const; | 113 scoped_refptr<RasterSource> CreateCloneWithoutLCDText() const; |
| 118 | 114 |
| 119 // Image decode controller should be set once. Its lifetime has to exceed that | 115 // Image decode controller should be set once. Its lifetime has to exceed that |
| 120 // of the raster source, since the raster source will access it during raster. | 116 // of the raster source, since the raster source will access it during raster. |
| 121 void SetImageDecodeController(ImageDecodeController* image_decode_controller); | 117 void SetImageDecodeController(ImageDecodeController* image_decode_controller); |
| 122 | 118 |
| 123 // base::trace_event::MemoryDumpProvider implementation | |
| 124 bool OnMemoryDump(const base::trace_event::MemoryDumpArgs& args, | |
| 125 base::trace_event::ProcessMemoryDump* pmd) override; | |
| 126 | |
| 127 protected: | 119 protected: |
| 128 friend class base::RefCountedThreadSafe<RasterSource>; | 120 friend class base::RefCountedThreadSafe<RasterSource>; |
| 129 | 121 |
| 130 RasterSource(const RecordingSource* other, bool can_use_lcd_text); | 122 RasterSource(const RecordingSource* other, bool can_use_lcd_text); |
| 131 RasterSource(const RasterSource* other, bool can_use_lcd_text); | 123 RasterSource(const RasterSource* other, bool can_use_lcd_text); |
| 132 ~RasterSource() override; | 124 virtual ~RasterSource(); |
| 133 | 125 |
| 134 // These members are const as this raster source may be in use on another | 126 // These members are const as this raster source may be in use on another |
| 135 // thread and so should not be touched after construction. | 127 // thread and so should not be touched after construction. |
| 136 const scoped_refptr<DisplayItemList> display_list_; | 128 const scoped_refptr<DisplayItemList> display_list_; |
| 137 const size_t painter_reported_memory_usage_; | 129 const size_t painter_reported_memory_usage_; |
| 138 const SkColor background_color_; | 130 const SkColor background_color_; |
| 139 const bool requires_clear_; | 131 const bool requires_clear_; |
| 140 const bool can_use_lcd_text_; | 132 const bool can_use_lcd_text_; |
| 141 const bool is_solid_color_; | 133 const bool is_solid_color_; |
| 142 const SkColor solid_color_; | 134 const SkColor solid_color_; |
| (...skipping 14 matching lines...) Expand all Loading... |
| 157 SkPicture::AbortCallback* callback, | 149 SkPicture::AbortCallback* callback, |
| 158 const gfx::Rect& canvas_bitmap_rect, | 150 const gfx::Rect& canvas_bitmap_rect, |
| 159 const gfx::Rect& canvas_playback_rect, | 151 const gfx::Rect& canvas_playback_rect, |
| 160 float contents_scale) const; | 152 float contents_scale) const; |
| 161 | 153 |
| 162 void PrepareForPlaybackToCanvas(SkCanvas* canvas, | 154 void PrepareForPlaybackToCanvas(SkCanvas* canvas, |
| 163 const gfx::Rect& canvas_bitmap_rect, | 155 const gfx::Rect& canvas_bitmap_rect, |
| 164 const gfx::Rect& canvas_playback_rect, | 156 const gfx::Rect& canvas_playback_rect, |
| 165 float contents_scale) const; | 157 float contents_scale) const; |
| 166 | 158 |
| 167 // Used to ensure that memory dump logic always happens on the same thread. | |
| 168 base::ThreadChecker memory_dump_thread_checker_; | |
| 169 | |
| 170 DISALLOW_COPY_AND_ASSIGN(RasterSource); | 159 DISALLOW_COPY_AND_ASSIGN(RasterSource); |
| 171 }; | 160 }; |
| 172 | 161 |
| 173 } // namespace cc | 162 } // namespace cc |
| 174 | 163 |
| 175 #endif // CC_PLAYBACK_RASTER_SOURCE_H_ | 164 #endif // CC_PLAYBACK_RASTER_SOURCE_H_ |
| OLD | NEW |