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 #include "cc/resources/raster_worker_pool.h" | 5 #include "cc/resources/raster_worker_pool.h" |
6 | 6 |
7 #include <limits> | 7 #include <limits> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "cc/resources/image_raster_worker_pool.h" | 10 #include "cc/resources/image_raster_worker_pool.h" |
(...skipping 16 matching lines...) Expand all Loading... |
27 RASTER_THREAD_ORIGIN, | 27 RASTER_THREAD_ORIGIN, |
28 RASTER_THREAD_WORKER | 28 RASTER_THREAD_WORKER |
29 }; | 29 }; |
30 typedef base::Callback<void(const PicturePileImpl::Analysis& analysis, | 30 typedef base::Callback<void(const PicturePileImpl::Analysis& analysis, |
31 bool was_canceled, | 31 bool was_canceled, |
32 RasterThread raster_thread)> Reply; | 32 RasterThread raster_thread)> Reply; |
33 | 33 |
34 TestRasterWorkerPoolTaskImpl( | 34 TestRasterWorkerPoolTaskImpl( |
35 const Resource* resource, | 35 const Resource* resource, |
36 const Reply& reply, | 36 const Reply& reply, |
37 TaskVector* dependencies, | 37 internal::Task::Vector* dependencies, |
38 bool use_gpu_rasterization) | 38 bool use_gpu_rasterization) |
39 : internal::RasterWorkerPoolTask(resource, | 39 : internal::RasterWorkerPoolTask(resource, |
40 dependencies, | 40 dependencies, |
41 use_gpu_rasterization), | 41 use_gpu_rasterization), |
42 reply_(reply), | 42 reply_(reply), |
43 raster_thread_(RASTER_THREAD_NONE) {} | 43 raster_thread_(RASTER_THREAD_NONE) { |
| 44 } |
44 | 45 |
45 // Overridden from internal::WorkerPoolTask: | 46 // Overridden from internal::RasterWorkerPoolTask: |
46 virtual bool RunOnWorkerThread(unsigned thread_index, | 47 virtual bool RunOnWorkerThread(unsigned thread_index, |
47 void* buffer, | 48 void* buffer, |
48 gfx::Size size, | 49 gfx::Size size, |
49 int stride) OVERRIDE { | 50 int stride) OVERRIDE { |
50 raster_thread_ = RASTER_THREAD_WORKER; | 51 raster_thread_ = RASTER_THREAD_WORKER; |
51 return true; | 52 return true; |
52 } | 53 } |
53 virtual void RunOnOriginThread(ResourceProvider* resource_provider, | 54 virtual void RunOnOriginThread(ResourceProvider* resource_provider, |
54 ContextProvider* context_provider) OVERRIDE { | 55 ContextProvider* context_provider) OVERRIDE { |
55 raster_thread_ = RASTER_THREAD_ORIGIN; | 56 raster_thread_ = RASTER_THREAD_ORIGIN; |
(...skipping 12 matching lines...) Expand all Loading... |
68 RasterThread raster_thread_; | 69 RasterThread raster_thread_; |
69 | 70 |
70 DISALLOW_COPY_AND_ASSIGN(TestRasterWorkerPoolTaskImpl); | 71 DISALLOW_COPY_AND_ASSIGN(TestRasterWorkerPoolTaskImpl); |
71 }; | 72 }; |
72 | 73 |
73 class BlockingRasterWorkerPoolTaskImpl : public TestRasterWorkerPoolTaskImpl { | 74 class BlockingRasterWorkerPoolTaskImpl : public TestRasterWorkerPoolTaskImpl { |
74 public: | 75 public: |
75 BlockingRasterWorkerPoolTaskImpl(const Resource* resource, | 76 BlockingRasterWorkerPoolTaskImpl(const Resource* resource, |
76 const Reply& reply, | 77 const Reply& reply, |
77 base::Lock* lock, | 78 base::Lock* lock, |
78 TaskVector* dependencies, | 79 internal::Task::Vector* dependencies, |
79 bool use_gpu_rasterization) | 80 bool use_gpu_rasterization) |
80 : TestRasterWorkerPoolTaskImpl(resource, | 81 : TestRasterWorkerPoolTaskImpl(resource, |
81 reply, | 82 reply, |
82 dependencies, | 83 dependencies, |
83 use_gpu_rasterization), | 84 use_gpu_rasterization), |
84 lock_(lock) {} | 85 lock_(lock) { |
| 86 } |
85 | 87 |
86 // Overridden from TestRasterWorkerPoolTaskImpl: | 88 // Overridden from internal::RasterWorkerPoolTask: |
87 virtual bool RunOnWorkerThread(unsigned thread_index, | 89 virtual bool RunOnWorkerThread(unsigned thread_index, |
88 void* buffer, | 90 void* buffer, |
89 gfx::Size size, | 91 gfx::Size size, |
90 int stride) OVERRIDE { | 92 int stride) OVERRIDE { |
91 base::AutoLock lock(*lock_); | 93 base::AutoLock lock(*lock_); |
92 return TestRasterWorkerPoolTaskImpl::RunOnWorkerThread( | 94 return TestRasterWorkerPoolTaskImpl::RunOnWorkerThread( |
93 thread_index, buffer, size, stride); | 95 thread_index, buffer, size, stride); |
94 } | 96 } |
95 virtual void CompleteOnOriginThread() OVERRIDE {} | 97 virtual void CompleteOnOriginThread() OVERRIDE {} |
96 | 98 |
(...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
462 } | 464 } |
463 | 465 |
464 base::Lock lock_; | 466 base::Lock lock_; |
465 }; | 467 }; |
466 | 468 |
467 PIXEL_BUFFER_AND_IMAGE_TEST_F(RasterWorkerPoolTestFalseThrottling); | 469 PIXEL_BUFFER_AND_IMAGE_TEST_F(RasterWorkerPoolTestFalseThrottling); |
468 | 470 |
469 } // namespace | 471 } // namespace |
470 | 472 |
471 } // namespace cc | 473 } // namespace cc |
OLD | NEW |