Index: cc/resources/raster_worker_pool.h |
diff --git a/cc/resources/raster_worker_pool.h b/cc/resources/raster_worker_pool.h |
index b4a266a8fc0c3dd1bf8116e2a2bc98b7fee246ad..7a821fd1a82f75fb224fc30eb2891868cae8c3dd 100644 |
--- a/cc/resources/raster_worker_pool.h |
+++ b/cc/resources/raster_worker_pool.h |
@@ -12,39 +12,22 @@ |
#include "cc/debug/rendering_stats_instrumentation.h" |
#include "cc/resources/picture_pile_impl.h" |
#include "cc/resources/raster_mode.h" |
-#include "cc/resources/resource_format.h" |
-#include "cc/resources/task_graph_runner.h" |
+#include "cc/resources/resource.h" |
+#include "cc/resources/resource_provider.h" |
#include "cc/resources/tile_priority.h" |
+#include "cc/resources/worker_pool.h" |
+#include "third_party/khronos/GLES2/gl2.h" |
class SkPixelRef; |
namespace cc { |
- |
-class ContextProvider; |
-class Resource; |
-class ResourceProvider; |
- |
namespace internal { |
- |
-class CC_EXPORT WorkerPoolTask : public Task { |
- public: |
- virtual void CompleteOnOriginThread() = 0; |
- |
- void WillComplete(); |
- void DidComplete(); |
- bool HasCompleted() const; |
- |
- protected: |
- WorkerPoolTask(); |
- virtual ~WorkerPoolTask(); |
- |
- private: |
- bool did_complete_; |
-}; |
class CC_EXPORT RasterWorkerPoolTask |
: public base::RefCounted<RasterWorkerPoolTask> { |
public: |
+ typedef std::vector<scoped_refptr<WorkerPoolTask> > TaskVector; |
+ |
// Returns true if |buffer| was written to. False indicate that |
// the content of |buffer| is undefined and the resource doesn't |
// need to be initialized. |
@@ -64,14 +47,14 @@ |
bool HasCompleted() const; |
const Resource* resource() const { return resource_; } |
- const internal::Task::Vector& dependencies() const { return dependencies_; } |
+ const TaskVector& dependencies() const { return dependencies_; } |
bool use_gpu_rasterization() const { return use_gpu_rasterization_; } |
protected: |
friend class base::RefCounted<RasterWorkerPoolTask>; |
RasterWorkerPoolTask(const Resource* resource, |
- internal::Task::Vector* dependencies, |
+ TaskVector* dependencies, |
bool use_gpu_rasterization); |
virtual ~RasterWorkerPoolTask(); |
@@ -80,7 +63,7 @@ |
bool did_complete_; |
bool was_canceled_; |
const Resource* resource_; |
- Task::Vector dependencies_; |
+ TaskVector dependencies_; |
bool use_gpu_rasterization_; |
}; |
@@ -110,7 +93,7 @@ |
}; |
// A worker thread pool that runs raster tasks. |
-class CC_EXPORT RasterWorkerPool { |
+class CC_EXPORT RasterWorkerPool : public WorkerPool { |
public: |
class CC_EXPORT Task { |
public: |
@@ -127,7 +110,8 @@ |
friend class RasterWorkerPool; |
friend class RasterWorkerPoolTest; |
- internal::Task::Vector tasks_; |
+ typedef internal::RasterWorkerPoolTask::TaskVector TaskVector; |
+ TaskVector tasks_; |
}; |
Task(); |
@@ -190,9 +174,27 @@ |
virtual ~RasterWorkerPool(); |
- static void SetNumRasterThreads(int num_threads); |
- |
- static int GetNumRasterThreads(); |
+ void SetClient(RasterWorkerPoolClient* client); |
+ |
+ // Overidden from WorkerPool: |
+ virtual void Shutdown() OVERRIDE; |
+ |
+ // Schedule running of raster tasks in |queue| and all dependencies. |
+ // Previously scheduled tasks that are no longer needed to run |
+ // raster tasks in |queue| will be canceled unless already running. |
+ // Once scheduled, reply callbacks are guaranteed to run for all tasks |
+ // even if they later get canceled by another call to ScheduleTasks(). |
+ virtual void ScheduleTasks(RasterTask::Queue* queue) = 0; |
+ |
+ // Returns the target that needs to be used for raster task resources. |
+ virtual GLenum GetResourceTarget() const = 0; |
+ |
+ // Returns the format that needs to be used for raster task resources. |
+ virtual ResourceFormat GetResourceFormat() const = 0; |
+ |
+ // Force a check for completed raster tasks. |
+ // Calls completion callbacks on completed tasks. |
+ virtual void CheckForCompletedTasks(); |
// TODO(vmpstr): Figure out an elegant way to not pass this many parameters. |
static RasterTask CreateRasterTask( |
@@ -216,30 +218,7 @@ |
RenderingStatsInstrumentation* stats_instrumentation, |
const Task::Reply& reply); |
- void SetClient(RasterWorkerPoolClient* client); |
- |
- // Tells the worker pool to shutdown after canceling all previously |
- // scheduled tasks. Reply callbacks are still guaranteed to run. |
- virtual void Shutdown(); |
- |
- // Schedule running of raster tasks in |queue| and all dependencies. |
- // Previously scheduled tasks that are no longer needed to run |
- // raster tasks in |queue| will be canceled unless already running. |
- // Once scheduled, reply callbacks are guaranteed to run for all tasks |
- // even if they later get canceled by another call to ScheduleTasks(). |
- virtual void ScheduleTasks(RasterTask::Queue* queue) = 0; |
- |
- // Force a check for completed tasks. |
- virtual void CheckForCompletedTasks(); |
- |
- // Returns the target that needs to be used for raster task resources. |
- virtual unsigned GetResourceTarget() const = 0; |
- |
- // Returns the format that needs to be used for raster task resources. |
- virtual ResourceFormat GetResourceFormat() const = 0; |
- |
protected: |
- typedef internal::TaskGraphRunner::TaskGraph TaskGraph; |
typedef std::vector<scoped_refptr<internal::WorkerPoolTask> > TaskVector; |
typedef std::vector<scoped_refptr<internal::RasterWorkerPoolTask> > |
RasterTaskVector; |
@@ -247,17 +226,14 @@ |
RasterTaskDeque; |
typedef base::hash_set<internal::RasterWorkerPoolTask*> RasterTaskSet; |
typedef internal::RasterWorkerPoolTask* TaskMapKey; |
- typedef base::hash_map<TaskMapKey, scoped_refptr<internal::WorkerPoolTask> > |
- TaskMap; |
+ typedef base::hash_map<TaskMapKey, |
+ scoped_refptr<internal::WorkerPoolTask> > TaskMap; |
RasterWorkerPool(ResourceProvider* resource_provider, |
ContextProvider* context_provider); |
virtual void OnRasterTasksFinished() = 0; |
virtual void OnRasterTasksRequiredForActivationFinished() = 0; |
- |
- void CheckForCompletedWorkerPoolTasks(); |
- void SetTaskGraph(TaskGraph* graph); |
void SetRasterTasks(RasterTask::Queue* queue); |
bool IsRasterTaskRequiredForActivation( |
@@ -273,11 +249,12 @@ |
return raster_tasks_required_for_activation_; |
} |
void set_raster_finished_task( |
- internal::WorkerPoolTask* raster_finished_task) { |
+ scoped_refptr<internal::WorkerPoolTask> raster_finished_task) { |
raster_finished_task_ = raster_finished_task; |
} |
void set_raster_required_for_activation_finished_task( |
- internal::WorkerPoolTask* raster_required_for_activation_finished_task) { |
+ scoped_refptr<internal::WorkerPoolTask> |
+ raster_required_for_activation_finished_task) { |
raster_required_for_activation_finished_task_ = |
raster_required_for_activation_finished_task; |
} |
@@ -296,7 +273,7 @@ |
static internal::GraphNode* CreateGraphNodeForRasterTask( |
internal::WorkerPoolTask* raster_task, |
- const internal::Task::Vector& decode_tasks, |
+ const TaskVector& decode_tasks, |
unsigned priority, |
TaskGraph* graph); |
@@ -305,7 +282,6 @@ |
void OnRasterRequiredForActivationFinished( |
const internal::WorkerPoolTask* source); |
- internal::NamespaceToken namespace_token_; |
RasterWorkerPoolClient* client_; |
ResourceProvider* resource_provider_; |
ContextProvider* context_provider_; |