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

Unified Diff: content/child/shared_memory_data_consumer_handle.cc

Issue 1234213002: Fix data races on |SharedMemoryDataConsumerHandle::Context::notification_task_runner_| (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 5 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: content/child/shared_memory_data_consumer_handle.cc
diff --git a/content/child/shared_memory_data_consumer_handle.cc b/content/child/shared_memory_data_consumer_handle.cc
index f11435ada87c22572379c59ce9b80f2e50c85b44..7206ca6ee7b0103520008c129a5e4da1a0fc378b 100644
--- a/content/child/shared_memory_data_consumer_handle.cc
+++ b/content/child/shared_memory_data_consumer_handle.cc
@@ -104,7 +104,11 @@ class SharedMemoryDataConsumerHandle::Context final
client_ = nullptr;
}
void PostNotify() {
- auto runner = notification_task_runner_;
+ scoped_refptr<base::SingleThreadTaskRunner> runner;
+ {
+ base::AutoLock lock(lock_);
+ runner = notification_task_runner_;
+ }
if (!runner)
return;
// We don't re-post the task when the runner changes while waiting for
@@ -160,7 +164,11 @@ class SharedMemoryDataConsumerHandle::Context final
void NotifyInternal(bool repost) {
// Note that this function is not protected by |lock_|.
- auto runner = notification_task_runner_;
+ scoped_refptr<base::SingleThreadTaskRunner> runner;
+ {
+ base::AutoLock lock(lock_);
+ runner = notification_task_runner_;
+ }
if (!runner)
return;
« 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