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 internal::Task::Vector* dependencies, | 37 TaskVector* 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 // Overridden from internal::RasterWorkerPoolTask: | 45 // Overridden from internal::WorkerPoolTask: |
46 virtual bool RunOnWorkerThread(unsigned thread_index, | 46 virtual bool RunOnWorkerThread(unsigned thread_index, |
47 void* buffer, | 47 void* buffer, |
48 gfx::Size size, | 48 gfx::Size size, |
49 int stride) OVERRIDE { | 49 int stride) OVERRIDE { |
50 raster_thread_ = RASTER_THREAD_WORKER; | 50 raster_thread_ = RASTER_THREAD_WORKER; |
51 return true; | 51 return true; |
52 } | 52 } |
53 virtual void RunOnOriginThread(ResourceProvider* resource_provider, | 53 virtual void RunOnOriginThread(ResourceProvider* resource_provider, |
54 ContextProvider* context_provider) OVERRIDE { | 54 ContextProvider* context_provider) OVERRIDE { |
55 raster_thread_ = RASTER_THREAD_ORIGIN; | 55 raster_thread_ = RASTER_THREAD_ORIGIN; |
(...skipping 12 matching lines...) Expand all Loading... |
68 RasterThread raster_thread_; | 68 RasterThread raster_thread_; |
69 | 69 |
70 DISALLOW_COPY_AND_ASSIGN(TestRasterWorkerPoolTaskImpl); | 70 DISALLOW_COPY_AND_ASSIGN(TestRasterWorkerPoolTaskImpl); |
71 }; | 71 }; |
72 | 72 |
73 class BlockingRasterWorkerPoolTaskImpl : public TestRasterWorkerPoolTaskImpl { | 73 class BlockingRasterWorkerPoolTaskImpl : public TestRasterWorkerPoolTaskImpl { |
74 public: | 74 public: |
75 BlockingRasterWorkerPoolTaskImpl(const Resource* resource, | 75 BlockingRasterWorkerPoolTaskImpl(const Resource* resource, |
76 const Reply& reply, | 76 const Reply& reply, |
77 base::Lock* lock, | 77 base::Lock* lock, |
78 internal::Task::Vector* dependencies, | 78 TaskVector* dependencies, |
79 bool use_gpu_rasterization) | 79 bool use_gpu_rasterization) |
80 : TestRasterWorkerPoolTaskImpl(resource, | 80 : TestRasterWorkerPoolTaskImpl(resource, |
81 reply, | 81 reply, |
82 dependencies, | 82 dependencies, |
83 use_gpu_rasterization), | 83 use_gpu_rasterization), |
84 lock_(lock) {} | 84 lock_(lock) {} |
85 | 85 |
86 // Overridden from internal::RasterWorkerPoolTask: | 86 // Overridden from TestRasterWorkerPoolTaskImpl: |
87 virtual bool RunOnWorkerThread(unsigned thread_index, | 87 virtual bool RunOnWorkerThread(unsigned thread_index, |
88 void* buffer, | 88 void* buffer, |
89 gfx::Size size, | 89 gfx::Size size, |
90 int stride) OVERRIDE { | 90 int stride) OVERRIDE { |
91 base::AutoLock lock(*lock_); | 91 base::AutoLock lock(*lock_); |
92 return TestRasterWorkerPoolTaskImpl::RunOnWorkerThread( | 92 return TestRasterWorkerPoolTaskImpl::RunOnWorkerThread( |
93 thread_index, buffer, size, stride); | 93 thread_index, buffer, size, stride); |
94 } | 94 } |
95 virtual void CompleteOnOriginThread() OVERRIDE {} | 95 virtual void CompleteOnOriginThread() OVERRIDE {} |
96 | 96 |
(...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
462 } | 462 } |
463 | 463 |
464 base::Lock lock_; | 464 base::Lock lock_; |
465 }; | 465 }; |
466 | 466 |
467 PIXEL_BUFFER_AND_IMAGE_TEST_F(RasterWorkerPoolTestFalseThrottling); | 467 PIXEL_BUFFER_AND_IMAGE_TEST_F(RasterWorkerPoolTestFalseThrottling); |
468 | 468 |
469 } // namespace | 469 } // namespace |
470 | 470 |
471 } // namespace cc | 471 } // namespace cc |
OLD | NEW |