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

Unified Diff: cc/raster/raster_buffer_provider_perftest.cc

Issue 2018353005: cc: Fix data race in cc::TaskState::IsFinished. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: feedback 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/tile_task.h » ('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 d79034d0e8d6111b5b73a4237357ec290c30bf1f..43e35dacac06b12fb1fbe69b313c082a61d1a69d 100644
--- a/cc/raster/raster_buffer_provider_perftest.cc
+++ b/cc/raster/raster_buffer_provider_perftest.cc
@@ -121,9 +121,31 @@ static const int kTimeLimitMillis = 2000;
static const int kWarmupRuns = 5;
static const int kTimeCheckInterval = 10;
-class PerfImageDecodeTaskImpl : public TileTask {
+class PerfTileTask : public TileTask {
public:
- PerfImageDecodeTaskImpl() : TileTask(true) {}
+ PerfTileTask() : TileTask(true) {}
+ explicit PerfTileTask(TileTask::Vector* dependencies)
+ : TileTask(true, dependencies) {}
+
+ void Reset() {
+ did_complete_ = false;
+ state().Reset();
+ }
+
+ void Cancel() {
+ if (!state().IsCanceled())
+ state().DidCancel();
+
+ did_complete_ = true;
+ }
+
+ protected:
+ ~PerfTileTask() override {}
+};
+
+class PerfImageDecodeTaskImpl : public PerfTileTask {
+ public:
+ PerfImageDecodeTaskImpl() {}
// Overridden from Task:
void RunOnWorkerThread() override {}
@@ -147,13 +169,13 @@ class PerfRasterBufferProviderHelper {
virtual void ReleaseBufferForRaster(std::unique_ptr<RasterBuffer> buffer) = 0;
};
-class PerfRasterTaskImpl : public TileTask {
+class PerfRasterTaskImpl : public PerfTileTask {
public:
PerfRasterTaskImpl(PerfRasterBufferProviderHelper* helper,
std::unique_ptr<ScopedResource> resource,
std::unique_ptr<RasterBuffer> raster_buffer,
TileTask::Vector* dependencies)
- : TileTask(true, dependencies),
+ : PerfTileTask(dependencies),
helper_(helper),
resource_(std::move(resource)),
raster_buffer_(std::move(raster_buffer)) {}
@@ -226,21 +248,18 @@ 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();
+ static_cast<PerfTileTask*>(decode_task.get())->Reset();
- raster_task->state().Reset();
+ static_cast<PerfTileTask*>(raster_task.get())->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();
- }
+ for (auto& decode_task : raster_task->dependencies())
+ static_cast<PerfTileTask*>(decode_task.get())->Cancel();
- if (!raster_task->state().IsCanceled())
- raster_task->state().DidCancel();
+ static_cast<PerfTileTask*>(raster_task.get())->Cancel();
}
}
« no previous file with comments | « no previous file | cc/raster/tile_task.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698