OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_RESOURCES_RASTER_WORKER_POOL_H_ | 5 #ifndef CC_RESOURCES_RASTER_WORKER_POOL_H_ |
6 #define CC_RESOURCES_RASTER_WORKER_POOL_H_ | 6 #define CC_RESOURCES_RASTER_WORKER_POOL_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/containers/hash_tables.h" | 10 #include "base/containers/hash_tables.h" |
11 #include "cc/debug/rendering_stats_instrumentation.h" | 11 #include "cc/debug/rendering_stats_instrumentation.h" |
12 #include "cc/resources/picture_pile_impl.h" | 12 #include "cc/resources/picture_pile_impl.h" |
13 #include "cc/resources/raster_mode.h" | 13 #include "cc/resources/raster_mode.h" |
14 #include "cc/resources/tile_priority.h" | 14 #include "cc/resources/tile_priority.h" |
15 #include "cc/resources/worker_pool.h" | 15 #include "cc/resources/worker_pool.h" |
16 | 16 |
17 class SkDevice; | |
18 | |
19 namespace skia { | 17 namespace skia { |
20 class LazyPixelRef; | 18 class LazyPixelRef; |
21 } | 19 } |
22 | 20 |
23 namespace cc { | 21 namespace cc { |
24 class PicturePileImpl; | 22 class PicturePileImpl; |
25 class PixelBufferRasterWorkerPool; | 23 class PixelBufferRasterWorkerPool; |
26 class Resource; | 24 class Resource; |
27 class ResourceProvider; | 25 class ResourceProvider; |
28 | 26 |
29 namespace internal { | 27 namespace internal { |
30 | 28 |
31 class CC_EXPORT RasterWorkerPoolTask | 29 class CC_EXPORT RasterWorkerPoolTask |
32 : public base::RefCounted<RasterWorkerPoolTask> { | 30 : public base::RefCounted<RasterWorkerPoolTask> { |
33 public: | 31 public: |
34 typedef std::vector<scoped_refptr<WorkerPoolTask> > TaskVector; | 32 typedef std::vector<scoped_refptr<WorkerPoolTask> > TaskVector; |
35 | 33 |
36 // Returns true if |device| was written to. False indicate that | 34 // Returns true if |device| was written to. False indicate that |
37 // the content of |device| is undefined and the resource doesn't | 35 // the content of |device| is undefined and the resource doesn't |
38 // need to be initialized. | 36 // need to be initialized. |
39 virtual bool RunOnWorkerThread(SkDevice* device, unsigned thread_index) = 0; | 37 virtual bool RunOnWorkerThread(unsigned thread_index, |
| 38 void* buffer, gfx::Size size) = 0; |
40 virtual void CompleteOnOriginThread() = 0; | 39 virtual void CompleteOnOriginThread() = 0; |
41 | 40 |
42 void DidRun(bool was_canceled); | 41 void DidRun(bool was_canceled); |
43 bool HasFinishedRunning() const; | 42 bool HasFinishedRunning() const; |
44 bool WasCanceled() const; | 43 bool WasCanceled() const; |
45 void WillComplete(); | 44 void WillComplete(); |
46 void DidComplete(); | 45 void DidComplete(); |
47 bool HasCompleted() const; | 46 bool HasCompleted() const; |
48 | 47 |
49 const Resource* resource() const { return resource_; } | 48 const Resource* resource() const { return resource_; } |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
190 gfx::Rect content_rect, | 189 gfx::Rect content_rect, |
191 float contents_scale, | 190 float contents_scale, |
192 RasterMode raster_mode, | 191 RasterMode raster_mode, |
193 bool is_tile_in_pending_tree_now_bin, | 192 bool is_tile_in_pending_tree_now_bin, |
194 TileResolution tile_resolution, | 193 TileResolution tile_resolution, |
195 int layer_id, | 194 int layer_id, |
196 const void* tile_id, | 195 const void* tile_id, |
197 int source_frame_number, | 196 int source_frame_number, |
198 RenderingStatsInstrumentation* rendering_stats, | 197 RenderingStatsInstrumentation* rendering_stats, |
199 const RasterTask::Reply& reply, | 198 const RasterTask::Reply& reply, |
200 Task::Set* dependencies); | 199 Task::Set* dependencies, |
| 200 bool use_16bit_tiles); |
201 | 201 |
202 static Task CreateImageDecodeTask( | 202 static Task CreateImageDecodeTask( |
203 skia::LazyPixelRef* pixel_ref, | 203 skia::LazyPixelRef* pixel_ref, |
204 int layer_id, | 204 int layer_id, |
205 RenderingStatsInstrumentation* stats_instrumentation, | 205 RenderingStatsInstrumentation* stats_instrumentation, |
206 const Task::Reply& reply); | 206 const Task::Reply& reply); |
207 | 207 |
208 protected: | 208 protected: |
209 typedef std::vector<scoped_refptr<internal::WorkerPoolTask> > TaskVector; | 209 typedef std::vector<scoped_refptr<internal::WorkerPoolTask> > TaskVector; |
210 typedef std::vector<scoped_refptr<internal::RasterWorkerPoolTask> > | 210 typedef std::vector<scoped_refptr<internal::RasterWorkerPoolTask> > |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
269 | 269 |
270 base::WeakPtrFactory<RasterWorkerPool> weak_ptr_factory_; | 270 base::WeakPtrFactory<RasterWorkerPool> weak_ptr_factory_; |
271 scoped_refptr<internal::WorkerPoolTask> raster_finished_task_; | 271 scoped_refptr<internal::WorkerPoolTask> raster_finished_task_; |
272 scoped_refptr<internal::WorkerPoolTask> | 272 scoped_refptr<internal::WorkerPoolTask> |
273 raster_required_for_activation_finished_task_; | 273 raster_required_for_activation_finished_task_; |
274 }; | 274 }; |
275 | 275 |
276 } // namespace cc | 276 } // namespace cc |
277 | 277 |
278 #endif // CC_RESOURCES_RASTER_WORKER_POOL_H_ | 278 #endif // CC_RESOURCES_RASTER_WORKER_POOL_H_ |
OLD | NEW |