| 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_RASTER_TILE_TASK_WORKER_POOL_H_ |   5 #ifndef CC_RASTER_TILE_TASK_WORKER_POOL_H_ | 
|   6 #define CC_RASTER_TILE_TASK_WORKER_POOL_H_ |   6 #define CC_RASTER_TILE_TASK_WORKER_POOL_H_ | 
|   7  |   7  | 
|   8 #include "cc/raster/tile_task_runner.h" |   8 #include "cc/raster/tile_task_runner.h" | 
|   9 #include "ui/gfx/geometry/rect.h" |   9 #include "ui/gfx/geometry/rect.h" | 
|  10 #include "ui/gfx/geometry/size.h" |  10 #include "ui/gfx/geometry/size.h" | 
|  11  |  11  | 
|  12 namespace base { |  12 namespace base { | 
|  13 class SequencedTaskRunner; |  13 class SequencedTaskRunner; | 
|  14 } |  14 } | 
|  15  |  15  | 
|  16 namespace cc { |  16 namespace cc { | 
|  17 class DisplayListRasterSource; |  17 class DisplayListRasterSource; | 
|  18 class RenderingStatsInstrumentation; |  18 class RenderingStatsInstrumentation; | 
|  19  |  19  | 
|  20 class CC_EXPORT TileTaskWorkerPool { |  20 class CC_EXPORT TileTaskWorkerPool { | 
|  21  public: |  21  public: | 
|  22   static size_t kBenchmarkTaskPriority; |  | 
|  23   static size_t kTaskSetFinishedTaskPriorityBase; |  | 
|  24   static size_t kTileTaskPriorityBase; |  | 
|  25  |  | 
|  26   TileTaskWorkerPool(); |  22   TileTaskWorkerPool(); | 
|  27   virtual ~TileTaskWorkerPool(); |  23   virtual ~TileTaskWorkerPool(); | 
|  28  |  24  | 
|  29   // Utility function that can be used to create a "Task set finished" task that |  | 
|  30   // posts |callback| to |task_runner| when run. |  | 
|  31   static scoped_refptr<TileTask> CreateTaskSetFinishedTask( |  | 
|  32       base::SequencedTaskRunner* task_runner, |  | 
|  33       const base::Closure& callback); |  | 
|  34  |  | 
|  35   // Utility function that can be used to call ::ScheduleOnOriginThread() for |  25   // Utility function that can be used to call ::ScheduleOnOriginThread() for | 
|  36   // each task in |graph|. |  26   // each task in |graph|. | 
|  37   static void ScheduleTasksOnOriginThread(TileTaskClient* client, |  27   static void ScheduleTasksOnOriginThread(TileTaskClient* client, | 
|  38                                           TaskGraph* graph); |  28                                           TaskGraph* graph); | 
|  39  |  29  | 
|  40   // Utility function that can be used to build a task graph. Inserts a node |  | 
|  41   // that represents |task| in |graph|. See TaskGraph definition for valid |  | 
|  42   // |priority| values. |  | 
|  43   static void InsertNodeForTask(TaskGraph* graph, |  | 
|  44                                 TileTask* task, |  | 
|  45                                 size_t priority, |  | 
|  46                                 size_t dependencies); |  | 
|  47  |  | 
|  48   // Utility function that can be used to build a task graph. Inserts nodes that |  | 
|  49   // represent |task| and all its image decode dependencies in |graph|. |  | 
|  50   static void InsertNodesForRasterTask( |  | 
|  51       TaskGraph* graph, |  | 
|  52       RasterTask* task, |  | 
|  53       const ImageDecodeTask::Vector& decode_tasks, |  | 
|  54       size_t priority); |  | 
|  55  |  | 
|  56   // Utility function that will create a temporary bitmap and copy pixels to |  30   // Utility function that will create a temporary bitmap and copy pixels to | 
|  57   // |memory| when necessary. The |canvas_bitmap_rect| is the rect of the bitmap |  31   // |memory| when necessary. The |canvas_bitmap_rect| is the rect of the bitmap | 
|  58   // being played back in the pixel space of the source, ie a rect in the source |  32   // being played back in the pixel space of the source, ie a rect in the source | 
|  59   // that will cover the resulting |memory|. The |canvas_playback_rect| can be a |  33   // that will cover the resulting |memory|. The |canvas_playback_rect| can be a | 
|  60   // smaller contained rect inside the |canvas_bitmap_rect| if the |memory| is |  34   // smaller contained rect inside the |canvas_bitmap_rect| if the |memory| is | 
|  61   // already partially complete, and only the subrect needs to be played back. |  35   // already partially complete, and only the subrect needs to be played back. | 
|  62   static void PlaybackToMemory(void* memory, |  36   static void PlaybackToMemory(void* memory, | 
|  63                                ResourceFormat format, |  37                                ResourceFormat format, | 
|  64                                const gfx::Size& size, |  38                                const gfx::Size& size, | 
|  65                                size_t stride, |  39                                size_t stride, | 
|  66                                const DisplayListRasterSource* raster_source, |  40                                const DisplayListRasterSource* raster_source, | 
|  67                                const gfx::Rect& canvas_bitmap_rect, |  41                                const gfx::Rect& canvas_bitmap_rect, | 
|  68                                const gfx::Rect& canvas_playback_rect, |  42                                const gfx::Rect& canvas_playback_rect, | 
|  69                                float scale, |  43                                float scale, | 
|  70                                bool include_images); |  44                                bool include_images); | 
|  71  |  45  | 
|  72   // Type-checking downcast routine. |  46   // Type-checking downcast routine. | 
|  73   virtual TileTaskRunner* AsTileTaskRunner() = 0; |  47   virtual TileTaskRunner* AsTileTaskRunner() = 0; | 
|  74 }; |  48 }; | 
|  75  |  49  | 
|  76 }  // namespace cc |  50 }  // namespace cc | 
|  77  |  51  | 
|  78 #endif  // CC_RASTER_TILE_TASK_WORKER_POOL_H_ |  52 #endif  // CC_RASTER_TILE_TASK_WORKER_POOL_H_ | 
| OLD | NEW |