| 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 #include "cc/resources/raster_worker_pool.h" | 5 #include "cc/resources/raster_worker_pool.h" |
| 6 | 6 |
| 7 #include "cc/resources/picture_pile_impl.h" | 7 #include "cc/resources/picture_pile_impl.h" |
| 8 | 8 |
| 9 namespace cc { | 9 namespace cc { |
| 10 | 10 |
| 11 namespace { | 11 namespace { |
| 12 | 12 |
| 13 class RasterWorkerPoolTaskImpl : public internal::WorkerPoolTask { | 13 class RasterWorkerPoolTaskImpl : public internal::WorkerPoolTask { |
| 14 public: | 14 public: |
| 15 RasterWorkerPoolTaskImpl(PicturePileImpl* picture_pile, | 15 RasterWorkerPoolTaskImpl(PicturePileImpl* picture_pile, |
| 16 bool is_cheap, | 16 bool is_cheap, |
| 17 const RasterWorkerPool::RasterCallback& task, | 17 const RasterWorkerPool::RasterCallback& task, |
| 18 const base::Closure& reply) | 18 const base::Closure& reply) |
| 19 : internal::WorkerPoolTask(reply), | 19 : internal::WorkerPoolTask(reply), |
| 20 picture_pile_(picture_pile), | 20 picture_pile_(picture_pile), |
| 21 is_cheap_(is_cheap), | 21 is_cheap_(is_cheap), |
| 22 task_(task) { | 22 task_(task) { |
| 23 DCHECK(picture_pile_); | 23 DCHECK(picture_pile_); |
| 24 } | 24 } |
| 25 | 25 |
| 26 virtual bool IsCheap() OVERRIDE { return is_cheap_; } | 26 virtual bool IsCheap() OVERRIDE { return is_cheap_; } |
| 27 | 27 |
| 28 virtual void Run(RenderingStats* rendering_stats) OVERRIDE { | 28 virtual void Run() OVERRIDE { |
| 29 task_.Run(picture_pile_.get(), rendering_stats); | 29 task_.Run(picture_pile_.get()); |
| 30 } | 30 } |
| 31 | 31 |
| 32 virtual void RunOnThread( | 32 virtual void RunOnThread(unsigned thread_index) OVERRIDE { |
| 33 RenderingStats* rendering_stats, unsigned thread_index) OVERRIDE { | 33 task_.Run(picture_pile_->GetCloneForDrawingOnThread(thread_index)); |
| 34 task_.Run(picture_pile_->GetCloneForDrawingOnThread(thread_index), | |
| 35 rendering_stats); | |
| 36 } | 34 } |
| 37 | 35 |
| 38 private: | 36 private: |
| 39 scoped_refptr<PicturePileImpl> picture_pile_; | 37 scoped_refptr<PicturePileImpl> picture_pile_; |
| 40 bool is_cheap_; | 38 bool is_cheap_; |
| 41 RasterWorkerPool::RasterCallback task_; | 39 RasterWorkerPool::RasterCallback task_; |
| 42 }; | 40 }; |
| 43 | 41 |
| 44 const char* kWorkerThreadNamePrefix = "CompositorRaster"; | 42 const char* kWorkerThreadNamePrefix = "CompositorRaster"; |
| 45 | 43 |
| (...skipping 17 matching lines...) Expand all Loading... |
| 63 const RasterCallback& task, | 61 const RasterCallback& task, |
| 64 const base::Closure& reply) { | 62 const base::Closure& reply) { |
| 65 PostTask(make_scoped_ptr(new RasterWorkerPoolTaskImpl( | 63 PostTask(make_scoped_ptr(new RasterWorkerPoolTaskImpl( |
| 66 picture_pile, | 64 picture_pile, |
| 67 is_cheap, | 65 is_cheap, |
| 68 task, | 66 task, |
| 69 reply)).PassAs<internal::WorkerPoolTask>()); | 67 reply)).PassAs<internal::WorkerPoolTask>()); |
| 70 } | 68 } |
| 71 | 69 |
| 72 } // namespace cc | 70 } // namespace cc |
| OLD | NEW |