diff options
author | reveman@chromium.org <reveman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-02-09 02:38:55 +0000 |
---|---|---|
committer | reveman@chromium.org <reveman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-02-09 02:38:55 +0000 |
commit | 2f2ccb15f5d975e120b4750fa0948920ec96e28d (patch) | |
tree | 317ed0edb5aeaa07ae3a62bd0232f893d86cd5d4 /cc/test/fake_tile_manager.cc | |
parent | fdedd90ef07671d480ef4f310678359d133341ef (diff) | |
download | chromium_src-2f2ccb15f5d975e120b4750fa0948920ec96e28d.zip chromium_src-2f2ccb15f5d975e120b4750fa0948920ec96e28d.tar.gz chromium_src-2f2ccb15f5d975e120b4750fa0948920ec96e28d.tar.bz2 |
cc: Refactor RasterWorkerPool for better testing support.
This makes a number of RasterWorkerPool changes that are necessary
to implement proper performance tests and replaces existing tests
with more useful tests using realistic raster task numbers.
RasterWorkerPool is modified to allow tests to use a different
TaskGraphRunner instance. PixelBufferRasterWorkerPool
implementation is adjusted so repeated calls to ScheduleTasks
doesn't flood the message loop with canceled tasks.
BUG=246546
Review URL: https://codereview.chromium.org/150783004
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@249959 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'cc/test/fake_tile_manager.cc')
-rw-r--r-- | cc/test/fake_tile_manager.cc | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/cc/test/fake_tile_manager.cc b/cc/test/fake_tile_manager.cc index 9f0649a..7740f33 100644 --- a/cc/test/fake_tile_manager.cc +++ b/cc/test/fake_tile_manager.cc @@ -13,9 +13,17 @@ namespace cc { namespace { +class FakeTaskGraphRunner : public internal::TaskGraphRunner { + public: + FakeTaskGraphRunner() : internal::TaskGraphRunner(0, "CompositorRaster") {} +}; +base::LazyInstance<FakeTaskGraphRunner> g_task_graph_runner = + LAZY_INSTANCE_INITIALIZER; + class FakeRasterWorkerPool : public RasterWorkerPool { public: - FakeRasterWorkerPool() : RasterWorkerPool(NULL, NULL) {} + FakeRasterWorkerPool() + : RasterWorkerPool(g_task_graph_runner.Pointer(), NULL, NULL) {} // Overridden from RasterWorkerPool: virtual void ScheduleTasks(RasterTask::Queue* queue) OVERRIDE { @@ -30,6 +38,9 @@ class FakeRasterWorkerPool : public RasterWorkerPool { } } virtual void CheckForCompletedTasks() OVERRIDE { + internal::Task::Vector completed_tasks; + CollectCompletedWorkerPoolTasks(&completed_tasks); + while (!completed_tasks_.empty()) { internal::WorkerPoolTask* task = completed_tasks_.front().get(); @@ -92,10 +103,7 @@ FakeTileManager::FakeTileManager(TileManagerClient* client, raster_task_limit_bytes, NULL) {} -FakeTileManager::~FakeTileManager() { - RasterWorkerPoolForTesting()->Shutdown(); - RasterWorkerPoolForTesting()->CheckForCompletedTasks(); -} +FakeTileManager::~FakeTileManager() {} void FakeTileManager::AssignMemoryToTiles( const GlobalStateThatImpactsTilePriority& state) { |