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

Unified Diff: cc/resources/raster_worker_pool.cc

Issue 498553005: cc: Fix UAF in g_raster_required_for_activation_delay (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: review Created 6 years, 4 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/resources/raster_worker_pool.cc
diff --git a/cc/resources/raster_worker_pool.cc b/cc/resources/raster_worker_pool.cc
index 255d5af5f71e16c5614a4dc6e85fda3e92e29610..d175141f3f6308c688637857702b0ab9d9e10275 100644
--- a/cc/resources/raster_worker_pool.cc
+++ b/cc/resources/raster_worker_pool.cc
@@ -15,21 +15,12 @@
namespace cc {
namespace {
-// Synthetic delay for raster tasks that are required for activation. Global to
-// avoid static initializer on critical path.
-struct RasterRequiredForActivationSyntheticDelayInitializer {
- RasterRequiredForActivationSyntheticDelayInitializer()
- : delay(base::debug::TraceEventSyntheticDelay::Lookup(
- "cc.RasterRequiredForActivation")) {}
- base::debug::TraceEventSyntheticDelay* delay;
-};
-static base::LazyInstance<RasterRequiredForActivationSyntheticDelayInitializer>
- g_raster_required_for_activation_delay = LAZY_INSTANCE_INITIALIZER;
-
class RasterTaskGraphRunner : public TaskGraphRunner,
public base::DelegateSimpleThread::Delegate {
public:
- RasterTaskGraphRunner() {
+ RasterTaskGraphRunner()
+ : synthetic_delay_(base::debug::TraceEventSyntheticDelay::Lookup(
+ "cc.RasterRequiredForActivation")) {
size_t num_threads = RasterWorkerPool::GetNumRasterThreads();
while (workers_.size() < num_threads) {
scoped_ptr<base::DelegateSimpleThread> worker =
@@ -48,6 +39,10 @@ class RasterTaskGraphRunner : public TaskGraphRunner,
virtual ~RasterTaskGraphRunner() { NOTREACHED(); }
+ base::debug::TraceEventSyntheticDelay* synthetic_delay() {
boliu 2014/08/27 01:14:49 Removed const here. Learned today that returning a
+ return synthetic_delay_;
+ }
+
private:
// Overridden from base::DelegateSimpleThread::Delegate:
virtual void Run() OVERRIDE {
@@ -55,6 +50,7 @@ class RasterTaskGraphRunner : public TaskGraphRunner,
}
ScopedPtrDeque<base::DelegateSimpleThread> workers_;
+ base::debug::TraceEventSyntheticDelay* synthetic_delay_;
};
base::LazyInstance<RasterTaskGraphRunner>::Leaky g_task_graph_runner =
@@ -108,7 +104,7 @@ class RasterRequiredForActivationFinishedTaskImpl
tasks_required_for_activation_count_(
tasks_required_for_activation_count) {
if (tasks_required_for_activation_count_) {
- g_raster_required_for_activation_delay.Get().delay->BeginParallel(
+ g_task_graph_runner.Get().synthetic_delay()->BeginParallel(
&activation_delay_end_time_);
}
}
@@ -119,7 +115,7 @@ class RasterRequiredForActivationFinishedTaskImpl
"cc", "RasterRequiredForActivationFinishedTaskImpl::RunOnWorkerThread");
if (tasks_required_for_activation_count_) {
- g_raster_required_for_activation_delay.Get().delay->EndParallel(
+ g_task_graph_runner.Get().synthetic_delay()->EndParallel(
activation_delay_end_time_);
}
RasterFinished();
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698