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

Side by Side Diff: cc/resources/image_raster_worker_pool.h

Issue 228173002: cc: Separate RasterWorkerPool interface from implementation details. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: address review feedback Created 6 years, 8 months 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 | Annotate | Revision Log
« no previous file with comments | « cc/resources/direct_raster_worker_pool.cc ('k') | cc/resources/image_raster_worker_pool.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 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_IMAGE_RASTER_WORKER_POOL_H_ 5 #ifndef CC_RESOURCES_IMAGE_RASTER_WORKER_POOL_H_
6 #define CC_RESOURCES_IMAGE_RASTER_WORKER_POOL_H_ 6 #define CC_RESOURCES_IMAGE_RASTER_WORKER_POOL_H_
7 7
8 #include "base/memory/weak_ptr.h" 8 #include "base/memory/weak_ptr.h"
9 #include "base/values.h" 9 #include "base/values.h"
10 #include "cc/resources/raster_worker_pool.h" 10 #include "cc/resources/raster_worker_pool.h"
11 #include "cc/resources/rasterizer.h"
11 12
12 namespace cc { 13 namespace cc {
13 class ResourceProvider; 14 class ResourceProvider;
14 15
15 class CC_EXPORT ImageRasterWorkerPool : public RasterWorkerPool, 16 class CC_EXPORT ImageRasterWorkerPool : public RasterWorkerPool,
16 public internal::WorkerPoolTaskClient { 17 public Rasterizer,
18 public internal::RasterizerTaskClient {
17 public: 19 public:
18 virtual ~ImageRasterWorkerPool(); 20 virtual ~ImageRasterWorkerPool();
19 21
20 static scoped_ptr<ImageRasterWorkerPool> Create( 22 static scoped_ptr<RasterWorkerPool> Create(
21 base::SequencedTaskRunner* task_runner, 23 base::SequencedTaskRunner* task_runner,
24 internal::TaskGraphRunner* task_graph_runner,
22 ResourceProvider* resource_provider, 25 ResourceProvider* resource_provider,
23 unsigned texture_target); 26 unsigned texture_target);
24 27
25 // Overridden from RasterWorkerPool: 28 // Overridden from RasterWorkerPool:
26 virtual void SetClient(RasterWorkerPoolClient* client) OVERRIDE; 29 virtual Rasterizer* AsRasterizer() OVERRIDE;
30
31 // Overridden from Rasterizer:
32 virtual void SetClient(RasterizerClient* client) OVERRIDE;
27 virtual void Shutdown() OVERRIDE; 33 virtual void Shutdown() OVERRIDE;
28 virtual void ScheduleTasks(RasterTaskQueue* queue) OVERRIDE; 34 virtual void ScheduleTasks(RasterTaskQueue* queue) OVERRIDE;
29 virtual unsigned GetResourceTarget() const OVERRIDE; 35 virtual unsigned GetResourceTarget() const OVERRIDE;
30 virtual ResourceFormat GetResourceFormat() const OVERRIDE; 36 virtual ResourceFormat GetResourceFormat() const OVERRIDE;
31 virtual void CheckForCompletedTasks() OVERRIDE; 37 virtual void CheckForCompletedTasks() OVERRIDE;
32 38
33 // Overridden from internal::WorkerPoolTaskClient: 39 // Overridden from internal::RasterizerTaskClient:
34 virtual SkCanvas* AcquireCanvasForRaster(internal::WorkerPoolTask* task, 40 virtual SkCanvas* AcquireCanvasForRaster(internal::RasterTask* task) OVERRIDE;
35 const Resource* resource) OVERRIDE; 41 virtual void ReleaseCanvasForRaster(internal::RasterTask* task) OVERRIDE;
36 virtual void ReleaseCanvasForRaster(internal::WorkerPoolTask* task,
37 const Resource* resource) OVERRIDE;
38 42
39 protected: 43 protected:
40 ImageRasterWorkerPool(base::SequencedTaskRunner* task_runner, 44 ImageRasterWorkerPool(base::SequencedTaskRunner* task_runner,
41 internal::TaskGraphRunner* task_graph_runner, 45 internal::TaskGraphRunner* task_graph_runner,
42 ResourceProvider* resource_provider, 46 ResourceProvider* resource_provider,
43 unsigned texture_target); 47 unsigned texture_target);
44 48
45 private: 49 private:
46 void OnRasterFinished(); 50 void OnRasterFinished();
47 void OnRasterRequiredForActivationFinished(); 51 void OnRasterRequiredForActivationFinished();
48 scoped_ptr<base::Value> StateAsValue() const; 52 scoped_ptr<base::Value> StateAsValue() const;
49 53
50 scoped_refptr<base::SequencedTaskRunner> task_runner_; 54 scoped_refptr<base::SequencedTaskRunner> task_runner_;
51 internal::TaskGraphRunner* task_graph_runner_; 55 internal::TaskGraphRunner* task_graph_runner_;
52 const internal::NamespaceToken namespace_token_; 56 const internal::NamespaceToken namespace_token_;
53 RasterWorkerPoolClient* client_; 57 RasterizerClient* client_;
54 ResourceProvider* resource_provider_; 58 ResourceProvider* resource_provider_;
55 const unsigned texture_target_; 59 const unsigned texture_target_;
56 60
57 bool raster_tasks_pending_; 61 bool raster_tasks_pending_;
58 bool raster_tasks_required_for_activation_pending_; 62 bool raster_tasks_required_for_activation_pending_;
59 63
60 base::WeakPtrFactory<ImageRasterWorkerPool> raster_finished_weak_ptr_factory_; 64 base::WeakPtrFactory<ImageRasterWorkerPool> raster_finished_weak_ptr_factory_;
61 65
62 scoped_refptr<internal::WorkerPoolTask> raster_finished_task_; 66 scoped_refptr<internal::RasterizerTask> raster_finished_task_;
63 scoped_refptr<internal::WorkerPoolTask> 67 scoped_refptr<internal::RasterizerTask>
64 raster_required_for_activation_finished_task_; 68 raster_required_for_activation_finished_task_;
65 69
66 // Task graph used when scheduling tasks and vector used to gather 70 // Task graph used when scheduling tasks and vector used to gather
67 // completed tasks. 71 // completed tasks.
68 internal::TaskGraph graph_; 72 internal::TaskGraph graph_;
69 internal::Task::Vector completed_tasks_; 73 internal::Task::Vector completed_tasks_;
70 74
71 DISALLOW_COPY_AND_ASSIGN(ImageRasterWorkerPool); 75 DISALLOW_COPY_AND_ASSIGN(ImageRasterWorkerPool);
72 }; 76 };
73 77
74 } // namespace cc 78 } // namespace cc
75 79
76 #endif // CC_RESOURCES_IMAGE_RASTER_WORKER_POOL_H_ 80 #endif // CC_RESOURCES_IMAGE_RASTER_WORKER_POOL_H_
OLDNEW
« no previous file with comments | « cc/resources/direct_raster_worker_pool.cc ('k') | cc/resources/image_raster_worker_pool.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698