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/resource.h" |
| 15 #include "cc/resources/resource_provider.h" |
14 #include "cc/resources/tile_priority.h" | 16 #include "cc/resources/tile_priority.h" |
15 #include "cc/resources/worker_pool.h" | 17 #include "cc/resources/worker_pool.h" |
16 #include "third_party/khronos/GLES2/gl2.h" | 18 #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 | 19 |
20 namespace skia { | 20 namespace skia { |
21 class LazyPixelRef; | 21 class LazyPixelRef; |
22 } | 22 } |
23 | 23 |
24 namespace cc { | 24 namespace cc { |
25 class PicturePileImpl; | 25 class PicturePileImpl; |
26 class PixelBufferRasterWorkerPool; | 26 class PixelBufferRasterWorkerPool; |
27 class Resource; | |
28 class ResourceProvider; | 27 class ResourceProvider; |
29 | 28 |
30 namespace internal { | 29 namespace internal { |
31 | 30 |
32 class CC_EXPORT RasterWorkerPoolTask | 31 class CC_EXPORT RasterWorkerPoolTask |
33 : public base::RefCounted<RasterWorkerPoolTask> { | 32 : public base::RefCounted<RasterWorkerPoolTask> { |
34 public: | 33 public: |
35 typedef std::vector<scoped_refptr<WorkerPoolTask> > TaskVector; | 34 typedef std::vector<scoped_refptr<WorkerPoolTask> > TaskVector; |
36 | 35 |
37 // Returns true if |device| was written to. False indicate that | 36 // Returns true if |buffer| was written to. False indicate that |
38 // the content of |device| is undefined and the resource doesn't | 37 // the content of |buffer| is undefined and the resource doesn't |
39 // need to be initialized. | 38 // need to be initialized. |
40 virtual bool RunOnWorkerThread(SkBaseDevice* device, | 39 virtual bool RunOnWorkerThread(unsigned thread_index, |
41 unsigned thread_index) = 0; | 40 void* buffer, |
| 41 gfx::Size size, |
| 42 int stride) = 0; |
42 virtual void CompleteOnOriginThread() = 0; | 43 virtual void CompleteOnOriginThread() = 0; |
43 | 44 |
44 void DidRun(bool was_canceled); | 45 void DidRun(bool was_canceled); |
45 bool HasFinishedRunning() const; | 46 bool HasFinishedRunning() const; |
46 bool WasCanceled() const; | 47 bool WasCanceled() const; |
47 void WillComplete(); | 48 void WillComplete(); |
48 void DidComplete(); | 49 void DidComplete(); |
49 bool HasCompleted() const; | 50 bool HasCompleted() const; |
50 | 51 |
51 const Resource* resource() const { return resource_; } | 52 const Resource* resource() const { return resource_; } |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
179 virtual void Shutdown() OVERRIDE; | 180 virtual void Shutdown() OVERRIDE; |
180 | 181 |
181 // Schedule running of raster tasks in |queue| and all dependencies. | 182 // Schedule running of raster tasks in |queue| and all dependencies. |
182 // Previously scheduled tasks that are no longer needed to run | 183 // Previously scheduled tasks that are no longer needed to run |
183 // raster tasks in |queue| will be canceled unless already running. | 184 // raster tasks in |queue| will be canceled unless already running. |
184 // Once scheduled, reply callbacks are guaranteed to run for all tasks | 185 // Once scheduled, reply callbacks are guaranteed to run for all tasks |
185 // even if they later get canceled by another call to ScheduleTasks(). | 186 // even if they later get canceled by another call to ScheduleTasks(). |
186 virtual void ScheduleTasks(RasterTask::Queue* queue) = 0; | 187 virtual void ScheduleTasks(RasterTask::Queue* queue) = 0; |
187 | 188 |
188 // Returns the format that needs to be used for raster task resources. | 189 // Returns the format that needs to be used for raster task resources. |
189 virtual GLenum GetResourceFormat() const = 0; | 190 virtual ResourceFormat GetResourceFormat() const = 0; |
190 | 191 |
191 // TODO(vmpstr): Figure out an elegant way to not pass this many parameters. | 192 // TODO(vmpstr): Figure out an elegant way to not pass this many parameters. |
192 static RasterTask CreateRasterTask( | 193 static RasterTask CreateRasterTask( |
193 const Resource* resource, | 194 const Resource* resource, |
194 PicturePileImpl* picture_pile, | 195 PicturePileImpl* picture_pile, |
195 gfx::Rect content_rect, | 196 gfx::Rect content_rect, |
196 float contents_scale, | 197 float contents_scale, |
197 RasterMode raster_mode, | 198 RasterMode raster_mode, |
198 bool is_tile_in_pending_tree_now_bin, | 199 bool is_tile_in_pending_tree_now_bin, |
199 TileResolution tile_resolution, | 200 TileResolution tile_resolution, |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
274 | 275 |
275 base::WeakPtrFactory<RasterWorkerPool> weak_ptr_factory_; | 276 base::WeakPtrFactory<RasterWorkerPool> weak_ptr_factory_; |
276 scoped_refptr<internal::WorkerPoolTask> raster_finished_task_; | 277 scoped_refptr<internal::WorkerPoolTask> raster_finished_task_; |
277 scoped_refptr<internal::WorkerPoolTask> | 278 scoped_refptr<internal::WorkerPoolTask> |
278 raster_required_for_activation_finished_task_; | 279 raster_required_for_activation_finished_task_; |
279 }; | 280 }; |
280 | 281 |
281 } // namespace cc | 282 } // namespace cc |
282 | 283 |
283 #endif // CC_RESOURCES_RASTER_WORKER_POOL_H_ | 284 #endif // CC_RESOURCES_RASTER_WORKER_POOL_H_ |
OLD | NEW |