| 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 #include "third_party/khronos/GLES2/gl2.h" | 16 #include "third_party/khronos/GLES2/gl2.h" |
| 17 // TODO(robertphillips): change this to "class SkBaseDevice;" | |
| 18 #include "third_party/skia/include/core/SkDevice.h" | |
| 19 | 17 |
| 20 namespace skia { | 18 namespace skia { |
| 21 class LazyPixelRef; | 19 class LazyPixelRef; |
| 22 } | 20 } |
| 23 | 21 |
| 24 namespace cc { | 22 namespace cc { |
| 25 class PicturePileImpl; | 23 class PicturePileImpl; |
| 26 class PixelBufferRasterWorkerPool; | 24 class PixelBufferRasterWorkerPool; |
| 27 class Resource; | 25 class Resource; |
| 28 class ResourceProvider; | 26 class ResourceProvider; |
| 29 | 27 |
| 30 namespace internal { | 28 namespace internal { |
| 31 | 29 |
| 32 class CC_EXPORT RasterWorkerPoolTask | 30 class CC_EXPORT RasterWorkerPoolTask |
| 33 : public base::RefCounted<RasterWorkerPoolTask> { | 31 : public base::RefCounted<RasterWorkerPoolTask> { |
| 34 public: | 32 public: |
| 35 typedef std::vector<scoped_refptr<WorkerPoolTask> > TaskVector; | 33 typedef std::vector<scoped_refptr<WorkerPoolTask> > TaskVector; |
| 36 | 34 |
| 37 // Returns true if |device| was written to. False indicate that | 35 // Returns true if |buffer| was written to. False indicate that |
| 38 // the content of |device| is undefined and the resource doesn't | 36 // the content of |buffer| is undefined and the resource doesn't |
| 39 // need to be initialized. | 37 // need to be initialized. |
| 40 virtual bool RunOnWorkerThread(SkBaseDevice* device, | 38 virtual bool RunOnWorkerThread(unsigned thread_index, |
| 41 unsigned thread_index) = 0; | 39 void* buffer, |
| 40 gfx::Size size) = 0; |
| 42 virtual void CompleteOnOriginThread() = 0; | 41 virtual void CompleteOnOriginThread() = 0; |
| 43 | 42 |
| 44 void DidRun(bool was_canceled); | 43 void DidRun(bool was_canceled); |
| 45 bool HasFinishedRunning() const; | 44 bool HasFinishedRunning() const; |
| 46 bool WasCanceled() const; | 45 bool WasCanceled() const; |
| 47 void WillComplete(); | 46 void WillComplete(); |
| 48 void DidComplete(); | 47 void DidComplete(); |
| 49 bool HasCompleted() const; | 48 bool HasCompleted() const; |
| 50 | 49 |
| 51 const Resource* resource() const { return resource_; } | 50 const Resource* resource() const { return resource_; } |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 195 gfx::Rect content_rect, | 194 gfx::Rect content_rect, |
| 196 float contents_scale, | 195 float contents_scale, |
| 197 RasterMode raster_mode, | 196 RasterMode raster_mode, |
| 198 bool is_tile_in_pending_tree_now_bin, | 197 bool is_tile_in_pending_tree_now_bin, |
| 199 TileResolution tile_resolution, | 198 TileResolution tile_resolution, |
| 200 int layer_id, | 199 int layer_id, |
| 201 const void* tile_id, | 200 const void* tile_id, |
| 202 int source_frame_number, | 201 int source_frame_number, |
| 203 RenderingStatsInstrumentation* rendering_stats, | 202 RenderingStatsInstrumentation* rendering_stats, |
| 204 const RasterTask::Reply& reply, | 203 const RasterTask::Reply& reply, |
| 205 Task::Set* dependencies); | 204 Task::Set* dependencies, |
| 205 bool use_16bit_tiles); |
| 206 | 206 |
| 207 static Task CreateImageDecodeTask( | 207 static Task CreateImageDecodeTask( |
| 208 skia::LazyPixelRef* pixel_ref, | 208 skia::LazyPixelRef* pixel_ref, |
| 209 int layer_id, | 209 int layer_id, |
| 210 RenderingStatsInstrumentation* stats_instrumentation, | 210 RenderingStatsInstrumentation* stats_instrumentation, |
| 211 const Task::Reply& reply); | 211 const Task::Reply& reply); |
| 212 | 212 |
| 213 protected: | 213 protected: |
| 214 typedef std::vector<scoped_refptr<internal::WorkerPoolTask> > TaskVector; | 214 typedef std::vector<scoped_refptr<internal::WorkerPoolTask> > TaskVector; |
| 215 typedef std::vector<scoped_refptr<internal::RasterWorkerPoolTask> > | 215 typedef std::vector<scoped_refptr<internal::RasterWorkerPoolTask> > |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 274 | 274 |
| 275 base::WeakPtrFactory<RasterWorkerPool> weak_ptr_factory_; | 275 base::WeakPtrFactory<RasterWorkerPool> weak_ptr_factory_; |
| 276 scoped_refptr<internal::WorkerPoolTask> raster_finished_task_; | 276 scoped_refptr<internal::WorkerPoolTask> raster_finished_task_; |
| 277 scoped_refptr<internal::WorkerPoolTask> | 277 scoped_refptr<internal::WorkerPoolTask> |
| 278 raster_required_for_activation_finished_task_; | 278 raster_required_for_activation_finished_task_; |
| 279 }; | 279 }; |
| 280 | 280 |
| 281 } // namespace cc | 281 } // namespace cc |
| 282 | 282 |
| 283 #endif // CC_RESOURCES_RASTER_WORKER_POOL_H_ | 283 #endif // CC_RESOURCES_RASTER_WORKER_POOL_H_ |
| OLD | NEW |