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

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

Issue 17625002: cc: Eliminate tile.h's dependency on tile_manager.h (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 years, 5 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
« no previous file with comments | « cc/resources/raster_mode.cc ('k') | cc/resources/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_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/resource_provider.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; 17 class SkDevice;
18 18
19 namespace skia { 19 namespace skia {
20 class LazyPixelRef; 20 class LazyPixelRef;
21 } 21 }
22 22
23 namespace cc { 23 namespace cc {
24 class PicturePileImpl; 24 class PicturePileImpl;
25 class PixelBufferRasterWorkerPool; 25 class PixelBufferRasterWorkerPool;
26 class Resource; 26 class Resource;
27 class ResourceProvider;
27 28
28 namespace internal { 29 namespace internal {
29 30
30 class CC_EXPORT RasterWorkerPoolTask 31 class CC_EXPORT RasterWorkerPoolTask
31 : public base::RefCounted<RasterWorkerPoolTask> { 32 : public base::RefCounted<RasterWorkerPoolTask> {
32 public: 33 public:
33 typedef std::vector<scoped_refptr<WorkerPoolTask> > TaskVector; 34 typedef std::vector<scoped_refptr<WorkerPoolTask> > TaskVector;
34 35
35 // Returns true if |device| was written to. False indicate that 36 // Returns true if |device| was written to. False indicate that
36 // the content of |device| is undefined and the resource doesn't 37 // the content of |device| is undefined and the resource doesn't
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 template <> struct hash<cc::internal::RasterWorkerPoolTask*> { 71 template <> struct hash<cc::internal::RasterWorkerPoolTask*> {
71 size_t operator()(cc::internal::RasterWorkerPoolTask* ptr) const { 72 size_t operator()(cc::internal::RasterWorkerPoolTask* ptr) const {
72 return hash<size_t>()(reinterpret_cast<size_t>(ptr)); 73 return hash<size_t>()(reinterpret_cast<size_t>(ptr));
73 } 74 }
74 }; 75 };
75 } // namespace BASE_HASH_NAMESPACE 76 } // namespace BASE_HASH_NAMESPACE
76 #endif // COMPILER 77 #endif // COMPILER
77 78
78 namespace cc { 79 namespace cc {
79 80
80 // Low quality implies no lcd test; high quality implies lcd text.
81 // Note that the order of these matters. It is organized in the order in which
82 // we can promote tiles. That is, we always move from higher number enum to
83 // lower number: low quality can be re-rastered as high quality with or without
84 // LCD text; high quality LCD can only move to high quality no LCD mode. We
85 // currently don't support moving from no LCD to LCD high quality.
86 // TODO(vmpstr): Find a better place for this.
87 enum RasterMode {
88 HIGH_QUALITY_NO_LCD_RASTER_MODE = 0,
89 HIGH_QUALITY_RASTER_MODE = 1,
90 LOW_QUALITY_RASTER_MODE = 2,
91 NUM_RASTER_MODES = 3
92 };
93
94 // Data that is passed to raster tasks.
95 // TODO(vmpstr): Find a better place for this.
96 struct RasterTaskMetadata {
97 scoped_ptr<base::Value> AsValue() const;
98 bool is_tile_in_pending_tree_now_bin;
99 TileResolution tile_resolution;
100 int layer_id;
101 const void* tile_id;
102 int source_frame_number;
103 };
104
105 class CC_EXPORT RasterWorkerPoolClient { 81 class CC_EXPORT RasterWorkerPoolClient {
106 public: 82 public:
107 virtual bool ShouldForceTasksRequiredForActivationToComplete() const = 0; 83 virtual bool ShouldForceTasksRequiredForActivationToComplete() const = 0;
108 84
109 protected: 85 protected:
110 virtual ~RasterWorkerPoolClient() {} 86 virtual ~RasterWorkerPoolClient() {}
111 }; 87 };
112 88
113 // A worker thread pool that runs raster tasks. 89 // A worker thread pool that runs raster tasks.
114 class CC_EXPORT RasterWorkerPool : public WorkerPool { 90 class CC_EXPORT RasterWorkerPool : public WorkerPool {
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
198 // scheduled tasks. Reply callbacks are still guaranteed to run. 174 // scheduled tasks. Reply callbacks are still guaranteed to run.
199 virtual void Shutdown() OVERRIDE; 175 virtual void Shutdown() OVERRIDE;
200 176
201 // Schedule running of raster tasks in |queue| and all dependencies. 177 // Schedule running of raster tasks in |queue| and all dependencies.
202 // Previously scheduled tasks that are no longer needed to run 178 // Previously scheduled tasks that are no longer needed to run
203 // raster tasks in |queue| will be canceled unless already running. 179 // raster tasks in |queue| will be canceled unless already running.
204 // Once scheduled, reply callbacks are guaranteed to run for all tasks 180 // Once scheduled, reply callbacks are guaranteed to run for all tasks
205 // even if they later get canceled by another call to ScheduleTasks(). 181 // even if they later get canceled by another call to ScheduleTasks().
206 virtual void ScheduleTasks(RasterTask::Queue* queue) = 0; 182 virtual void ScheduleTasks(RasterTask::Queue* queue) = 0;
207 183
184 // TODO(vmpstr): Figure out an elegant way to not pass this many parameters.
208 static RasterTask CreateRasterTask( 185 static RasterTask CreateRasterTask(
209 const Resource* resource, 186 const Resource* resource,
210 PicturePileImpl* picture_pile, 187 PicturePileImpl* picture_pile,
211 gfx::Rect content_rect, 188 gfx::Rect content_rect,
212 float contents_scale, 189 float contents_scale,
213 RasterMode raster_mode, 190 RasterMode raster_mode,
214 const RasterTaskMetadata& metadata, 191 bool is_tile_in_pending_tree_now_bin,
192 TileResolution tile_resolution,
193 int layer_id,
194 const void* tile_id,
195 int source_frame_number,
215 RenderingStatsInstrumentation* rendering_stats, 196 RenderingStatsInstrumentation* rendering_stats,
216 const RasterTask::Reply& reply, 197 const RasterTask::Reply& reply,
217 Task::Set* dependencies); 198 Task::Set* dependencies);
218 199
219 static Task CreateImageDecodeTask( 200 static Task CreateImageDecodeTask(
220 skia::LazyPixelRef* pixel_ref, 201 skia::LazyPixelRef* pixel_ref,
221 int layer_id, 202 int layer_id,
222 RenderingStatsInstrumentation* stats_instrumentation, 203 RenderingStatsInstrumentation* stats_instrumentation,
223 const Task::Reply& reply); 204 const Task::Reply& reply);
224 205
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
273 RasterTask::Queue::TaskSet raster_tasks_required_for_activation_; 254 RasterTask::Queue::TaskSet raster_tasks_required_for_activation_;
274 255
275 base::WeakPtrFactory<RasterWorkerPool> weak_ptr_factory_; 256 base::WeakPtrFactory<RasterWorkerPool> weak_ptr_factory_;
276 scoped_refptr<internal::WorkerPoolTask> raster_finished_task_; 257 scoped_refptr<internal::WorkerPoolTask> raster_finished_task_;
277 int64 schedule_raster_tasks_count_; 258 int64 schedule_raster_tasks_count_;
278 }; 259 };
279 260
280 } // namespace cc 261 } // namespace cc
281 262
282 #endif // CC_RESOURCES_RASTER_WORKER_POOL_H_ 263 #endif // CC_RESOURCES_RASTER_WORKER_POOL_H_
OLDNEW
« no previous file with comments | « cc/resources/raster_mode.cc ('k') | cc/resources/raster_worker_pool.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698