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

Unified Diff: cc/raster/raster_buffer_provider_perftest.cc

Issue 2003333002: cc: Task should complete as finished or canceled in tests. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@test_task_runner
Patch Set: Created 4 years, 7 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 | « no previous file | cc/raster/task.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/raster/raster_buffer_provider_perftest.cc
diff --git a/cc/raster/raster_buffer_provider_perftest.cc b/cc/raster/raster_buffer_provider_perftest.cc
index 212b2a90a9af331b5618be982695a9185840e286..add1a7da739147a09667350240ea8d297def04cc 100644
--- a/cc/raster/raster_buffer_provider_perftest.cc
+++ b/cc/raster/raster_buffer_provider_perftest.cc
@@ -129,7 +129,7 @@ class PerfImageDecodeTaskImpl : public TileTask {
void RunOnWorkerThread() override {}
// Overridden from TileTask:
- void OnTaskCompleted() override { state().Reset(); }
+ void OnTaskCompleted() override {}
protected:
~PerfImageDecodeTaskImpl() override {}
@@ -165,8 +165,6 @@ class PerfRasterTaskImpl : public TileTask {
void OnTaskCompleted() override {
if (helper_)
helper_->ReleaseBufferForRaster(std::move(raster_buffer_));
-
- state().Reset();
}
protected:
@@ -224,6 +222,27 @@ class RasterBufferProviderPerfTestBase {
}
}
+ void ResetRasterTasks(const RasterTaskVector& raster_tasks) {
+ for (auto& raster_task : raster_tasks) {
+ for (auto& decode_task : raster_task->dependencies())
+ decode_task->state().Reset();
+
+ raster_task->state().Reset();
+ }
+ }
+
+ void CancelRasterTasks(const RasterTaskVector& raster_tasks) {
+ for (auto& raster_task : raster_tasks) {
+ for (auto& decode_task : raster_task->dependencies()) {
+ if (!decode_task->state().IsCanceled())
+ decode_task->state().DidCancel();
+ }
+
+ if (!raster_task->state().IsCanceled())
+ raster_task->state().DidCancel();
+ }
+ }
+
void BuildTileTaskGraph(TaskGraph* graph,
const RasterTaskVector& raster_tasks) {
uint16_t priority = 0;
@@ -342,6 +361,7 @@ class RasterBufferProviderPerfTest
timer_.Reset();
do {
graph.Reset();
+ ResetRasterTasks(raster_tasks);
BuildTileTaskGraph(&graph, raster_tasks);
tile_task_manager_->ScheduleTasks(&graph);
tile_task_manager_->CheckForCompletedTasks();
@@ -351,6 +371,7 @@ class RasterBufferProviderPerfTest
TaskGraph empty;
tile_task_manager_->ScheduleTasks(&empty);
RunMessageLoopUntilAllTasksHaveCompleted();
+ tile_task_manager_->CheckForCompletedTasks();
perf_test::PrintResult("schedule_tasks", TestModifierString(), test_name,
timer_.LapsPerSecond(), "runs/s", true);
@@ -375,6 +396,8 @@ class RasterBufferProviderPerfTest
timer_.Reset();
do {
graph.Reset();
+ // Reset the tasks as for scheduling new state tasks are needed.
+ ResetRasterTasks(raster_tasks[count % kNumVersions]);
BuildTileTaskGraph(&graph, raster_tasks[count % kNumVersions]);
tile_task_manager_->ScheduleTasks(&graph);
tile_task_manager_->CheckForCompletedTasks();
@@ -385,6 +408,7 @@ class RasterBufferProviderPerfTest
TaskGraph empty;
tile_task_manager_->ScheduleTasks(&empty);
RunMessageLoopUntilAllTasksHaveCompleted();
+ tile_task_manager_->CheckForCompletedTasks();
perf_test::PrintResult("schedule_alternate_tasks", TestModifierString(),
test_name, timer_.LapsPerSecond(), "runs/s", true);
@@ -520,6 +544,8 @@ class RasterBufferProviderCommonPerfTest
timer_.NextLap();
} while (!timer_.HasTimeLimitExpired());
+ CancelRasterTasks(raster_tasks);
+
perf_test::PrintResult("build_raster_task_graph", "", test_name,
timer_.LapsPerSecond(), "runs/s", true);
}
« no previous file with comments | « no previous file | cc/raster/task.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698