Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(253)

Side by Side Diff: cc/resources/raster_worker_pool_unittest.cc

Issue 17244003: cc: Move task graph construction to RasterWorkerPool classes. (Closed) Base URL: http://git.chromium.org/chromium/src.git@wp-run-count
Patch Set: add missing CC_EXPORT Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « cc/resources/raster_worker_pool_perftest.cc ('k') | cc/resources/tile_manager.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 <vector> 7 #include <vector>
8 8
9 #include "cc/resources/image_raster_worker_pool.h" 9 #include "cc/resources/image_raster_worker_pool.h"
10 #include "cc/resources/picture_pile.h" 10 #include "cc/resources/picture_pile.h"
11 #include "cc/resources/picture_pile_impl.h" 11 #include "cc/resources/picture_pile_impl.h"
12 #include "cc/resources/pixel_buffer_raster_worker_pool.h" 12 #include "cc/resources/pixel_buffer_raster_worker_pool.h"
13 #include "cc/resources/resource_provider.h" 13 #include "cc/resources/resource_provider.h"
14 #include "cc/resources/scoped_resource.h" 14 #include "cc/resources/scoped_resource.h"
15 #include "cc/test/fake_output_surface.h" 15 #include "cc/test/fake_output_surface.h"
16 #include "testing/gtest/include/gtest/gtest.h" 16 #include "testing/gtest/include/gtest/gtest.h"
17 17
18 namespace cc { 18 namespace cc {
19 19
20 class TestRasterWorkerPoolTaskImpl : public internal::RasterWorkerPoolTask { 20 class TestRasterWorkerPoolTaskImpl : public internal::RasterWorkerPoolTask {
21 public: 21 public:
22 typedef base::Callback<void(const PicturePileImpl::Analysis& analysis, 22 typedef base::Callback<void(const PicturePileImpl::Analysis& analysis,
23 bool was_canceled, 23 bool was_canceled,
24 bool did_raster)> Reply; 24 bool did_raster)> Reply;
25 25
26 TestRasterWorkerPoolTaskImpl( 26 TestRasterWorkerPoolTaskImpl(
27 const Resource* resource, 27 const Resource* resource,
28 const Reply& reply, 28 const Reply& reply,
29 internal::WorkerPoolTask::TaskVector* dependencies) 29 TaskVector* dependencies)
30 : internal::RasterWorkerPoolTask(resource, dependencies), 30 : internal::RasterWorkerPoolTask(resource, dependencies),
31 reply_(reply), 31 reply_(reply),
32 did_raster_(false) {} 32 did_raster_(false) {}
33 33
34 // Overridden from internal::WorkerPoolTask:
34 virtual bool RunOnThread(SkDevice* device, unsigned thread_index) OVERRIDE { 35 virtual bool RunOnThread(SkDevice* device, unsigned thread_index) OVERRIDE {
35 did_raster_ = true; 36 did_raster_ = true;
36 return true; 37 return true;
37 } 38 }
38 virtual void DispatchCompletionCallback() OVERRIDE { 39 virtual void DispatchCompletionCallback() OVERRIDE {
39 reply_.Run(PicturePileImpl::Analysis(), !HasFinishedRunning(), did_raster_); 40 reply_.Run(PicturePileImpl::Analysis(), !HasFinishedRunning(), did_raster_);
40 } 41 }
41 42
42 protected: 43 protected:
43 virtual ~TestRasterWorkerPoolTaskImpl() {} 44 virtual ~TestRasterWorkerPoolTaskImpl() {}
44 45
45 private: 46 private:
46 const Reply reply_; 47 const Reply reply_;
47 bool did_raster_; 48 bool did_raster_;
49
50 DISALLOW_COPY_AND_ASSIGN(TestRasterWorkerPoolTaskImpl);
48 }; 51 };
49 52
50 class RasterWorkerPoolTest : public testing::Test, 53 class RasterWorkerPoolTest : public testing::Test,
51 public RasterWorkerPoolClient { 54 public RasterWorkerPoolClient {
52 public: 55 public:
53 RasterWorkerPoolTest() 56 RasterWorkerPoolTest()
54 : output_surface_(FakeOutputSurface::Create3d()), 57 : output_surface_(FakeOutputSurface::Create3d()),
55 resource_provider_( 58 resource_provider_(
56 ResourceProvider::Create(output_surface_.get(), 0)), 59 ResourceProvider::Create(output_surface_.get(), 0)),
57 check_interval_milliseconds_(1), 60 check_interval_milliseconds_(1),
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after
265 ASSERT_EQ(1u, tasks_.size()); 268 ASSERT_EQ(1u, tasks_.size());
266 tasks_.clear(); 269 tasks_.clear();
267 } 270 }
268 }; 271 };
269 272
270 PIXEL_BUFFER_AND_IMAGE_TEST_F(RasterWorkerPoolTestFailedMapResource); 273 PIXEL_BUFFER_AND_IMAGE_TEST_F(RasterWorkerPoolTestFailedMapResource);
271 274
272 } // namespace 275 } // namespace
273 276
274 } // namespace cc 277 } // namespace cc
OLDNEW
« no previous file with comments | « cc/resources/raster_worker_pool_perftest.cc ('k') | cc/resources/tile_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698