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

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

Issue 2541183002: cc: Rename ImageDecodeController to ImageDecodeCache. (Closed)
Patch Set: rename: update Created 4 years 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 | « cc/playback/image_hijack_canvas.cc ('k') | cc/playback/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_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 <memory> 10 #include <memory>
11 #include <vector> 11 #include <vector>
12 12
13 #include "base/macros.h" 13 #include "base/macros.h"
14 #include "cc/base/cc_export.h" 14 #include "cc/base/cc_export.h"
15 #include "cc/debug/rendering_stats_instrumentation.h" 15 #include "cc/debug/rendering_stats_instrumentation.h"
16 #include "cc/playback/recording_source.h" 16 #include "cc/playback/recording_source.h"
17 #include "skia/ext/analysis_canvas.h" 17 #include "skia/ext/analysis_canvas.h"
18 #include "third_party/skia/include/core/SkPicture.h" 18 #include "third_party/skia/include/core/SkPicture.h"
19 19
20 namespace gfx { 20 namespace gfx {
21 class ColorSpace; 21 class ColorSpace;
22 } 22 }
23 23
24 namespace cc { 24 namespace cc {
25 class DisplayItemList; 25 class DisplayItemList;
26 class DrawImage; 26 class DrawImage;
27 class ImageDecodeController; 27 class ImageDecodeCache;
28 28
29 class CC_EXPORT RasterSource : public base::RefCountedThreadSafe<RasterSource> { 29 class CC_EXPORT RasterSource : public base::RefCountedThreadSafe<RasterSource> {
30 public: 30 public:
31 struct CC_EXPORT PlaybackSettings { 31 struct CC_EXPORT PlaybackSettings {
32 PlaybackSettings(); 32 PlaybackSettings();
33 33
34 // If set to true, this indicates that the canvas has already been 34 // If set to true, this indicates that the canvas has already been
35 // rasterized into. This means that the canvas cannot be cleared safely. 35 // rasterized into. This means that the canvas cannot be cleared safely.
36 bool playback_to_shared_canvas; 36 bool playback_to_shared_canvas;
37 37
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 virtual sk_sp<SkPicture> GetFlattenedPicture(); 121 virtual sk_sp<SkPicture> GetFlattenedPicture();
122 virtual size_t GetPictureMemoryUsage() const; 122 virtual size_t GetPictureMemoryUsage() const;
123 123
124 // Return true if LCD anti-aliasing may be used when rastering text. 124 // Return true if LCD anti-aliasing may be used when rastering text.
125 virtual bool CanUseLCDText() const; 125 virtual bool CanUseLCDText() const;
126 126
127 scoped_refptr<RasterSource> CreateCloneWithoutLCDText() const; 127 scoped_refptr<RasterSource> CreateCloneWithoutLCDText() const;
128 128
129 // Image decode controller should be set once. Its lifetime has to exceed that 129 // Image decode controller should be set once. Its lifetime has to exceed that
130 // of the raster source, since the raster source will access it during raster. 130 // of the raster source, since the raster source will access it during raster.
131 void set_image_decode_controller( 131 void set_image_decode_cache(ImageDecodeCache* image_decode_cache) {
132 ImageDecodeController* image_decode_controller) { 132 DCHECK(image_decode_cache);
133 DCHECK(image_decode_controller); 133 image_decode_cache_ = image_decode_cache;
134 image_decode_controller_ = image_decode_controller;
135 } 134 }
136 135
137 // Returns the ImageDecodeController, currently only used by 136 // Returns the ImageDecodeCache, currently only used by
138 // GpuRasterBufferProvider in order to create its own ImageHijackCanvas. 137 // GpuRasterBufferProvider in order to create its own ImageHijackCanvas.
139 // Because of the MultiPictureDraw approach used by GPU raster, it does not 138 // Because of the MultiPictureDraw approach used by GPU raster, it does not
140 // integrate well with the use of the ImageHijackCanvas internal to this 139 // integrate well with the use of the ImageHijackCanvas internal to this
141 // class. See gpu_raster_buffer_provider.cc for more information. 140 // class. See gpu_raster_buffer_provider.cc for more information.
142 // TODO(crbug.com/628394): Redesign this to avoid exposing 141 // TODO(crbug.com/628394): Redesign this to avoid exposing
143 // ImageDecodeController from the raster source. 142 // ImageDecodeCache from the raster source.
144 ImageDecodeController* image_decode_controller() const { 143 ImageDecodeCache* image_decode_cache() const { return image_decode_cache_; }
145 return image_decode_controller_;
146 }
147 144
148 protected: 145 protected:
149 friend class base::RefCountedThreadSafe<RasterSource>; 146 friend class base::RefCountedThreadSafe<RasterSource>;
150 147
151 RasterSource(const RecordingSource* other, bool can_use_lcd_text); 148 RasterSource(const RecordingSource* other, bool can_use_lcd_text);
152 RasterSource(const RasterSource* other, bool can_use_lcd_text); 149 RasterSource(const RasterSource* other, bool can_use_lcd_text);
153 virtual ~RasterSource(); 150 virtual ~RasterSource();
154 151
155 // These members are const as this raster source may be in use on another 152 // These members are const as this raster source may be in use on another
156 // thread and so should not be touched after construction. 153 // thread and so should not be touched after construction.
157 const scoped_refptr<DisplayItemList> display_list_; 154 const scoped_refptr<DisplayItemList> display_list_;
158 const size_t painter_reported_memory_usage_; 155 const size_t painter_reported_memory_usage_;
159 const SkColor background_color_; 156 const SkColor background_color_;
160 const bool requires_clear_; 157 const bool requires_clear_;
161 const bool can_use_lcd_text_; 158 const bool can_use_lcd_text_;
162 const bool is_solid_color_; 159 const bool is_solid_color_;
163 const SkColor solid_color_; 160 const SkColor solid_color_;
164 const gfx::Rect recorded_viewport_; 161 const gfx::Rect recorded_viewport_;
165 const gfx::Size size_; 162 const gfx::Size size_;
166 const bool clear_canvas_with_debug_color_; 163 const bool clear_canvas_with_debug_color_;
167 const int slow_down_raster_scale_factor_for_debug_; 164 const int slow_down_raster_scale_factor_for_debug_;
168 // TODO(enne/vmiura): this has a read/write race between raster and compositor 165 // TODO(enne/vmiura): this has a read/write race between raster and compositor
169 // threads with multi-threaded Ganesh. Make this const or remove it. 166 // threads with multi-threaded Ganesh. Make this const or remove it.
170 bool should_attempt_to_use_distance_field_text_; 167 bool should_attempt_to_use_distance_field_text_;
171 168
172 // In practice, this is only set once before raster begins, so it's ok with 169 // In practice, this is only set once before raster begins, so it's ok with
173 // respect to threading. 170 // respect to threading.
174 ImageDecodeController* image_decode_controller_; 171 ImageDecodeCache* image_decode_cache_;
175 172
176 private: 173 private:
177 void RasterCommon(SkCanvas* canvas, SkPicture::AbortCallback* callback) const; 174 void RasterCommon(SkCanvas* canvas, SkPicture::AbortCallback* callback) const;
178 175
179 void PrepareForPlaybackToCanvas(SkCanvas* canvas) const; 176 void PrepareForPlaybackToCanvas(SkCanvas* canvas) const;
180 177
181 DISALLOW_COPY_AND_ASSIGN(RasterSource); 178 DISALLOW_COPY_AND_ASSIGN(RasterSource);
182 }; 179 };
183 180
184 } // namespace cc 181 } // namespace cc
185 182
186 #endif // CC_PLAYBACK_RASTER_SOURCE_H_ 183 #endif // CC_PLAYBACK_RASTER_SOURCE_H_
OLDNEW
« no previous file with comments | « cc/playback/image_hijack_canvas.cc ('k') | cc/playback/raster_source.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698