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

Unified Diff: cc/test/fake_tile_task_manager.cc

Issue 1910213005: cc: Refactor TileTaskWorkerPool. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@task_states
Patch Set: feedback Created 4 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « cc/test/fake_tile_task_manager.h ('k') | cc/test/layer_tree_pixel_resource_test.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/test/fake_tile_task_manager.cc
diff --git a/cc/test/fake_tile_task_manager.cc b/cc/test/fake_tile_task_manager.cc
new file mode 100644
index 0000000000000000000000000000000000000000..9b28d55067754e971f6854c7ab393f2246a2bf90
--- /dev/null
+++ b/cc/test/fake_tile_task_manager.cc
@@ -0,0 +1,51 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "cc/test/fake_tile_task_manager.h"
+
+#include "base/memory/ptr_util.h"
+
+namespace cc {
+
+FakeTileTaskManagerImpl::FakeTileTaskManagerImpl()
+ : raster_buffer_provider_(base::WrapUnique<RasterBufferProvider>(
+ new FakeRasterBufferProviderImpl)) {}
+
+FakeTileTaskManagerImpl::FakeTileTaskManagerImpl(
+ std::unique_ptr<RasterBufferProvider> raster_buffer_provider)
+ : raster_buffer_provider_(std::move(raster_buffer_provider)) {}
+
+FakeTileTaskManagerImpl::~FakeTileTaskManagerImpl() {}
+
+void FakeTileTaskManagerImpl::ScheduleTasks(TaskGraph* graph) {
+ for (const auto& node : graph->nodes) {
+ TileTask* task = static_cast<TileTask*>(node.task);
+
+ task->WillSchedule();
+ task->ScheduleOnOriginThread(raster_buffer_provider_.get());
+ task->DidSchedule();
+
+ completed_tasks_.push_back(task);
+ }
+}
+
+void FakeTileTaskManagerImpl::CheckForCompletedTasks() {
+ for (Task::Vector::iterator it = completed_tasks_.begin();
+ it != completed_tasks_.end(); ++it) {
+ TileTask* task = static_cast<TileTask*>(it->get());
+
+ task->WillComplete();
+ task->CompleteOnOriginThread(raster_buffer_provider_.get());
+ task->DidComplete();
+ }
+ completed_tasks_.clear();
+}
+
+void FakeTileTaskManagerImpl::Shutdown() {}
+
+RasterBufferProvider* FakeTileTaskManagerImpl::GetRasterBufferProvider() const {
+ return raster_buffer_provider_.get();
+}
+
+} // namespace cc
« no previous file with comments | « cc/test/fake_tile_task_manager.h ('k') | cc/test/layer_tree_pixel_resource_test.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698