| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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_WORKER_POOL_H_ | 5 #ifndef CC_RASTER_WORKER_POOL_H_ |
| 6 #define CC_RASTER_WORKER_POOL_H_ | 6 #define CC_RASTER_WORKER_POOL_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 | 22 |
| 23 class RasterWorkerPool { | 23 class RasterWorkerPool { |
| 24 public: | 24 public: |
| 25 explicit RasterWorkerPool(size_t num_raster_threads); | 25 explicit RasterWorkerPool(size_t num_raster_threads); |
| 26 virtual ~RasterWorkerPool(); | 26 virtual ~RasterWorkerPool(); |
| 27 | 27 |
| 28 static scoped_ptr<RasterWorkerPool> Create(size_t num_raster_threads) { | 28 static scoped_ptr<RasterWorkerPool> Create(size_t num_raster_threads) { |
| 29 return make_scoped_ptr(new RasterWorkerPool(num_raster_threads)); | 29 return make_scoped_ptr(new RasterWorkerPool(num_raster_threads)); |
| 30 } | 30 } |
| 31 | 31 |
| 32 // Starts the worker pool. Returns true if the worker pool was successfully |
| 33 // started; otherwise, returns false. |
| 34 bool Start(); |
| 35 |
| 36 // Tells the worker pool to stop and returns once all pending tasks have |
| 37 // completed. |
| 38 void Stop(); |
| 39 |
| 40 // Returns true if the worker pool has been started, and not yet stopped. |
| 41 bool IsRunning() const; |
| 42 |
| 32 bool IsBusy(); | 43 bool IsBusy(); |
| 33 | 44 |
| 34 void PostRasterTaskAndReply(PicturePileImpl* picture_pile, | 45 void PostRasterTaskAndReply(PicturePileImpl* picture_pile, |
| 35 uint8* buffer, | 46 uint8* buffer, |
| 36 const gfx::Rect& rect, | 47 const gfx::Rect& rect, |
| 37 float contents_scale, | 48 float contents_scale, |
| 38 const base::Closure& reply); | 49 const base::Closure& reply); |
| 39 void PostImageDecodeTaskAndReply(skia::LazyPixelRef* pixel_ref, | 50 void PostImageDecodeTaskAndReply(skia::LazyPixelRef* pixel_ref, |
| 40 const base::Closure& reply); | 51 const base::Closure& reply); |
| 41 | 52 |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 | 93 |
| 83 Thread::Task* CreateTask(); | 94 Thread::Task* CreateTask(); |
| 84 void DestroyTask(Thread::Task* task); | 95 void DestroyTask(Thread::Task* task); |
| 85 | 96 |
| 86 void OnTaskCompleted(Thread::Task* task, | 97 void OnTaskCompleted(Thread::Task* task, |
| 87 const base::Closure& reply); | 98 const base::Closure& reply); |
| 88 void OnRasterTaskCompleted(Thread::Task* task, | 99 void OnRasterTaskCompleted(Thread::Task* task, |
| 89 scoped_refptr<PicturePileImpl> picture_pile, | 100 scoped_refptr<PicturePileImpl> picture_pile, |
| 90 const base::Closure& reply); | 101 const base::Closure& reply); |
| 91 | 102 |
| 103 void SortRasterThreadsIfNeeded(); |
| 104 |
| 105 bool is_running_; |
| 106 |
| 92 typedef std::vector<Thread*> ThreadVector; | 107 typedef std::vector<Thread*> ThreadVector; |
| 93 ThreadVector raster_threads_; | 108 ThreadVector raster_threads_; |
| 109 bool raster_threads_need_sorting_; |
| 94 | 110 |
| 95 DISALLOW_COPY_AND_ASSIGN(RasterWorkerPool); | 111 DISALLOW_COPY_AND_ASSIGN(RasterWorkerPool); |
| 96 }; | 112 }; |
| 97 | 113 |
| 98 } // namespace cc | 114 } // namespace cc |
| 99 | 115 |
| 100 #endif // CC_RASTER_WORKER_POOL_H_ | 116 #endif // CC_RASTER_WORKER_POOL_H_ |
| OLD | NEW |