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

Unified Diff: cc/tiles/tile_manager_unittest.cc

Issue 1854723002: cc: Simplify task and its derived classes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Corrected scope of dependencies. 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
Index: cc/tiles/tile_manager_unittest.cc
diff --git a/cc/tiles/tile_manager_unittest.cc b/cc/tiles/tile_manager_unittest.cc
index 745fee4ca853a48a593c4839a87b8a14602f1d63..074240ed88222c46337af741320660478a802cb7 100644
--- a/cc/tiles/tile_manager_unittest.cc
+++ b/cc/tiles/tile_manager_unittest.cc
@@ -9,7 +9,6 @@
#include "base/thread_task_runner_handle.h"
#include "cc/playback/raster_source.h"
#include "cc/playback/recording_source.h"
-#include "cc/raster/raster_buffer.h"
#include "cc/resources/resource_pool.h"
#include "cc/test/begin_frame_args_test.h"
#include "cc/test/fake_impl_task_runner_provider.h"
@@ -1820,11 +1819,21 @@ TEST_F(TileManagerTest, LowResHasNoImage) {
}
// Fake TileTaskRunner that just no-ops all calls.
-class FakeTileTaskRunner : public TileTaskRunner, public TileTaskClient {
+class FakeTileTaskRunner : public TileTaskRunner {
public:
FakeTileTaskRunner() {}
~FakeTileTaskRunner() override {}
+ // RasterBufferProvider methods.
+ scoped_ptr<RasterBuffer> AcquireBufferForRaster(
+ const Resource* resource,
+ uint64_t resource_content_id,
+ uint64_t previous_content_id) override {
+ NOTREACHED();
+ return nullptr;
+ }
+ void ReleaseBufferForRaster(scoped_ptr<RasterBuffer> buffer) override {}
+
// TileTaskRunner methods.
void Shutdown() override {}
void CheckForCompletedTasks() override {}
@@ -1836,16 +1845,6 @@ class FakeTileTaskRunner : public TileTaskRunner, public TileTaskClient {
}
void ScheduleTasks(TaskGraph* graph) override {}
-
- // TileTaskClient methods.
- scoped_ptr<RasterBuffer> AcquireBufferForRaster(
- const Resource* resource,
- uint64_t resource_content_id,
- uint64_t previous_content_id) override {
- NOTREACHED();
- return nullptr;
- }
- void ReleaseBufferForRaster(scoped_ptr<RasterBuffer> buffer) override {}
};
// Fake TileTaskRunner that just cancels all scheduled tasks immediately.
@@ -1858,7 +1857,7 @@ class CancellingTileTaskRunner : public FakeTileTaskRunner {
// Just call CompleteOnOriginThread on each item in the queue. As none of
// these items have run yet, they will be treated as cancelled tasks.
for (const auto& node : graph->nodes) {
- static_cast<TileTask*>(node.task)->CompleteOnOriginThread(this);
+ node.task->CompleteOnOriginThread();
}
}
};
@@ -1931,17 +1930,7 @@ class VerifyResourceContentIdTileTaskRunner : public FakeTileTaskRunner {
: expected_resource_id_(expected_resource_id) {}
~VerifyResourceContentIdTileTaskRunner() override {}
- void ScheduleTasks(TaskGraph* graph) override {
- for (const auto& node : graph->nodes) {
- TileTask* task = static_cast<TileTask*>(node.task);
- // Triggers a call to AcquireBufferForRaster.
- task->ScheduleOnOriginThread(this);
- // Calls TileManager as though task was cancelled.
- task->CompleteOnOriginThread(this);
- }
- }
-
- // TileTaskClient methods.
+ // RasterBufferProvider methods.
scoped_ptr<RasterBuffer> AcquireBufferForRaster(
const Resource* resource,
uint64_t resource_content_id,
@@ -1950,6 +1939,16 @@ class VerifyResourceContentIdTileTaskRunner : public FakeTileTaskRunner {
return nullptr;
}
+ void ScheduleTasks(TaskGraph* graph) override {
+ for (const auto& node : graph->nodes) {
+ Task* task = node.task;
+ // Triggers a call to AcquireBufferForRaster.
+ task->ScheduleOnOriginThread();
+ // Calls TileManager as though task was cancelled.
+ task->CompleteOnOriginThread();
+ }
+ }
+
private:
uint64_t expected_resource_id_;
};

Powered by Google App Engine
This is Rietveld 408576698