Commit 77f333aa authored by ernstm@chromium.org's avatar ernstm@chromium.org

cc: fix another data race in RenderingStatsInstrumentation.

Access to the stats was not protected by a lock. Fix by returning a copy to
the stats and locking while making the copy.

R=enne@chromium.org
BUG=370244

Review URL: https://codereview.chromium.org/289163004

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@271646 0039d316-1c4b-4281-b951-d872f2087c98
parent f202649a
......@@ -18,6 +18,18 @@ RenderingStatsInstrumentation::RenderingStatsInstrumentation()
RenderingStatsInstrumentation::~RenderingStatsInstrumentation() {}
MainThreadRenderingStats
RenderingStatsInstrumentation::main_thread_rendering_stats() {
base::AutoLock scoped_lock(lock_);
return main_stats_;
}
ImplThreadRenderingStats
RenderingStatsInstrumentation::impl_thread_rendering_stats() {
base::AutoLock scoped_lock(lock_);
return impl_stats_;
}
RenderingStats RenderingStatsInstrumentation::GetRenderingStats() {
base::AutoLock scoped_lock(lock_);
RenderingStats rendering_stats;
......
......@@ -18,20 +18,19 @@ class CC_EXPORT RenderingStatsInstrumentation {
static scoped_ptr<RenderingStatsInstrumentation> Create();
virtual ~RenderingStatsInstrumentation();
// Return current main thread rendering stats.
const MainThreadRenderingStats& main_thread_rendering_stats() {
return main_stats_;
}
// Return current impl thread rendering stats.
const ImplThreadRenderingStats& impl_thread_rendering_stats() {
return impl_stats_;
}
// Return copy of current main thread rendering stats.
MainThreadRenderingStats main_thread_rendering_stats();
// Return copy of current impl thread rendering stats.
ImplThreadRenderingStats impl_thread_rendering_stats();
// Return the accumulated, combined rendering stats.
RenderingStats GetRenderingStats();
// Add current main thread rendering stats to accumulator and
// clear current stats.
void AccumulateAndClearMainThreadStats();
// Add current impl thread rendering stats to accumulator and
// clear current stats.
void AccumulateAndClearImplThreadStats();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment