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); |
} |