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

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

Issue 19305002: Merge 210098 "cc: Eliminate tile.h's dependency on tile_manager.h" (Closed) Base URL: svn://svn.chromium.org/chrome/branches/1547/src/
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 | Annotate | Revision Log
« 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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 template <> struct hash<cc::internal::RasterWorkerPoolTask*> { 70 template <> struct hash<cc::internal::RasterWorkerPoolTask*> {
70 size_t operator()(cc::internal::RasterWorkerPoolTask* ptr) const { 71 size_t operator()(cc::internal::RasterWorkerPoolTask* ptr) const {
71 return hash<size_t>()(reinterpret_cast<size_t>(ptr)); 72 return hash<size_t>()(reinterpret_cast<size_t>(ptr));
72 } 73 }
73 }; 74 };
74 } // namespace BASE_HASH_NAMESPACE 75 } // namespace BASE_HASH_NAMESPACE
75 #endif // COMPILER 76 #endif // COMPILER
76 77
77 namespace cc { 78 namespace cc {
78 79
79 // Low quality implies no lcd test;
80 // high quality implies lcd text.
81 // Note that the order of these matters, from "better" to "worse" in terms of
82 // quality.
83 // TODO(vmpstr): Find a better place for this.
84 enum RasterMode {
85 HIGH_QUALITY_RASTER_MODE = 0,
86 HIGH_QUALITY_NO_LCD_RASTER_MODE = 1,
87 LOW_QUALITY_RASTER_MODE = 2,
88 NUM_RASTER_MODES = 3
89 };
90
91 // Data that is passed to raster tasks.
92 // TODO(vmpstr): Find a better place for this.
93 struct RasterTaskMetadata {
94 scoped_ptr<base::Value> AsValue() const;
95 bool is_tile_in_pending_tree_now_bin;
96 TileResolution tile_resolution;
97 int layer_id;
98 const void* tile_id;
99 int source_frame_number;
100 };
101
102 class CC_EXPORT RasterWorkerPoolClient { 80 class CC_EXPORT RasterWorkerPoolClient {
103 public: 81 public:
104 virtual bool ShouldForceTasksRequiredForActivationToComplete() const = 0; 82 virtual bool ShouldForceTasksRequiredForActivationToComplete() const = 0;
105 virtual void DidFinishedRunningTasks() = 0; 83 virtual void DidFinishedRunningTasks() = 0;
106 virtual void DidFinishedRunningTasksRequiredForActivation() = 0; 84 virtual void DidFinishedRunningTasksRequiredForActivation() = 0;
107 85
108 protected: 86 protected:
109 virtual ~RasterWorkerPoolClient() {} 87 virtual ~RasterWorkerPoolClient() {}
110 }; 88 };
111 89
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
197 // scheduled tasks. Reply callbacks are still guaranteed to run. 175 // scheduled tasks. Reply callbacks are still guaranteed to run.
198 virtual void Shutdown() OVERRIDE; 176 virtual void Shutdown() OVERRIDE;
199 177
200 // Schedule running of raster tasks in |queue| and all dependencies. 178 // Schedule running of raster tasks in |queue| and all dependencies.
201 // Previously scheduled tasks that are no longer needed to run 179 // Previously scheduled tasks that are no longer needed to run
202 // raster tasks in |queue| will be canceled unless already running. 180 // raster tasks in |queue| will be canceled unless already running.
203 // Once scheduled, reply callbacks are guaranteed to run for all tasks 181 // Once scheduled, reply callbacks are guaranteed to run for all tasks
204 // even if they later get canceled by another call to ScheduleTasks(). 182 // even if they later get canceled by another call to ScheduleTasks().
205 virtual void ScheduleTasks(RasterTask::Queue* queue) = 0; 183 virtual void ScheduleTasks(RasterTask::Queue* queue) = 0;
206 184
207 // TODO(vmpstr): Try to elimiate some variables. 185 // TODO(vmpstr): Figure out an elegant way to not pass this many parameters.
208 static RasterTask CreateRasterTask( 186 static RasterTask CreateRasterTask(
209 const Resource* resource, 187 const Resource* resource,
210 PicturePileImpl* picture_pile, 188 PicturePileImpl* picture_pile,
211 gfx::Rect content_rect, 189 gfx::Rect content_rect,
212 float contents_scale, 190 float contents_scale,
213 RasterMode raster_mode, 191 RasterMode raster_mode,
214 bool use_color_estimator, 192 bool use_color_estimator,
215 const RasterTaskMetadata& metadata, 193 bool is_tile_in_pending_tree_now_bin,
194 TileResolution tile_resolution,
195 int layer_id,
196 const void* tile_id,
197 int source_frame_number,
216 RenderingStatsInstrumentation* rendering_stats, 198 RenderingStatsInstrumentation* rendering_stats,
217 const RasterTask::Reply& reply, 199 const RasterTask::Reply& reply,
218 Task::Set* dependencies); 200 Task::Set* dependencies);
219 201
220 static Task CreateImageDecodeTask( 202 static Task CreateImageDecodeTask(
221 skia::LazyPixelRef* pixel_ref, 203 skia::LazyPixelRef* pixel_ref,
222 int layer_id, 204 int layer_id,
223 RenderingStatsInstrumentation* stats_instrumentation, 205 RenderingStatsInstrumentation* stats_instrumentation,
224 const Task::Reply& reply); 206 const Task::Reply& reply);
225 207
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
285 267
286 base::WeakPtrFactory<RasterWorkerPool> weak_ptr_factory_; 268 base::WeakPtrFactory<RasterWorkerPool> weak_ptr_factory_;
287 scoped_refptr<internal::WorkerPoolTask> raster_finished_task_; 269 scoped_refptr<internal::WorkerPoolTask> raster_finished_task_;
288 scoped_refptr<internal::WorkerPoolTask> 270 scoped_refptr<internal::WorkerPoolTask>
289 raster_required_for_activation_finished_task_; 271 raster_required_for_activation_finished_task_;
290 }; 272 };
291 273
292 } // namespace cc 274 } // namespace cc
293 275
294 #endif // CC_RESOURCES_RASTER_WORKER_POOL_H_ 276 #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