summaryrefslogtreecommitdiffstats
path: root/cc/test/fake_tile_manager.cc
diff options
context:
space:
mode:
authorreveman@chromium.org <reveman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-01-28 23:24:10 +0000
committerreveman@chromium.org <reveman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-01-28 23:24:10 +0000
commitb9128259612ca9072585e5124f8341d395e33de0 (patch)
tree6ea4d71f4ec9dc74fb84717f01ec97260f2d321f /cc/test/fake_tile_manager.cc
parentd7c8ee6ab8b0c834f8fcff9642032e6c58a68bdf (diff)
downloadchromium_src-b9128259612ca9072585e5124f8341d395e33de0.zip
chromium_src-b9128259612ca9072585e5124f8341d395e33de0.tar.gz
chromium_src-b9128259612ca9072585e5124f8341d395e33de0.tar.bz2
cc: Make internal::RasterWorkerPoolTask an internal::Task.
Clean up RasterWorkerPool by making internal::RasterWorkerPoolTask a real task that can be run by TaskGraphRunner. Reduces the complexity of our RasterWorkerPool implementations significantly and improves performance by reducing the number of heap allocations performed when scheduling tasks. Also makes PixelBufferRasterWorkerPool only run image decode reply callbacks when CheckForCompletedTasks() is called. BUG=246546 Review URL: https://codereview.chromium.org/133933004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@247521 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'cc/test/fake_tile_manager.cc')
-rw-r--r--cc/test/fake_tile_manager.cc30
1 files changed, 25 insertions, 5 deletions
diff --git a/cc/test/fake_tile_manager.cc b/cc/test/fake_tile_manager.cc
index d5bc80b..347d14f 100644
--- a/cc/test/fake_tile_manager.cc
+++ b/cc/test/fake_tile_manager.cc
@@ -13,23 +13,31 @@ namespace cc {
namespace {
-class FakeRasterWorkerPool : public RasterWorkerPool {
+class FakeRasterWorkerPool : public RasterWorkerPool,
+ public internal::WorkerPoolTaskClient {
public:
FakeRasterWorkerPool() : RasterWorkerPool(NULL, NULL) {}
+ // Overridden from RasterWorkerPool:
virtual void ScheduleTasks(RasterTask::Queue* queue) OVERRIDE {
RasterWorkerPool::SetRasterTasks(queue);
for (RasterTaskVector::const_iterator it = raster_tasks().begin();
it != raster_tasks().end(); ++it) {
+ internal::WorkerPoolTask* task = it->get();
+
+ task->DidSchedule();
+
completed_tasks_.push_back(it->get());
}
}
virtual void CheckForCompletedTasks() OVERRIDE {
while (!completed_tasks_.empty()) {
- internal::RasterWorkerPoolTask* task = completed_tasks_.front().get();
+ internal::WorkerPoolTask* task = completed_tasks_.front().get();
+
task->WillComplete();
- task->CompleteOnOriginThread();
task->DidComplete();
+ task->RunReplyOnOriginThread();
+
completed_tasks_.pop_front();
}
}
@@ -39,11 +47,23 @@ class FakeRasterWorkerPool : public RasterWorkerPool {
virtual ResourceFormat GetResourceFormat() const OVERRIDE {
return RGBA_8888;
}
+
+ // Overridden from internal::WorkerPoolTaskClient:
+ virtual void* AcquireBufferForRaster(internal::RasterWorkerPoolTask* task,
+ int* stride) OVERRIDE {
+ return NULL;
+ }
+ virtual void OnRasterCompleted(internal::RasterWorkerPoolTask* task,
+ const PicturePileImpl::Analysis& analysis)
+ OVERRIDE {}
+ virtual void OnImageDecodeCompleted(internal::WorkerPoolTask* task) OVERRIDE {
+ }
+
+ private:
+ // Overridden from RasterWorkerPool:
virtual void OnRasterTasksFinished() OVERRIDE {}
virtual void OnRasterTasksRequiredForActivationFinished() OVERRIDE {}
- private:
- typedef std::deque<scoped_refptr<internal::RasterWorkerPoolTask> > TaskDeque;
TaskDeque completed_tasks_;
};