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

Unified Diff: ipc/attachment_broker.h

Issue 1405253010: ipc: Add a lock to guard modifications of state of the AttachmentBroker. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 2 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 | ipc/attachment_broker.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ipc/attachment_broker.h
diff --git a/ipc/attachment_broker.h b/ipc/attachment_broker.h
index 36489d4ee9dc8133e7184aceec9cb31e19152a9f..994068dcd18983c7e061953569e5e787efef6777 100644
--- a/ipc/attachment_broker.h
+++ b/ipc/attachment_broker.h
@@ -8,6 +8,7 @@
#include "base/gtest_prod_util.h"
#include "base/macros.h"
#include "base/process/process_handle.h"
+#include "base/synchronization/lock.h"
#include "ipc/brokerable_attachment.h"
#include "ipc/ipc_export.h"
#include "ipc/ipc_listener.h"
@@ -99,6 +100,8 @@ class IPC_EXPORT AttachmentBroker : public Listener {
// This method is exposed for testing only.
AttachmentVector* get_attachments() { return &attachments_; }
+ base::Lock* get_lock() { return &lock_; }
+
private:
#if defined(OS_WIN)
FRIEND_TEST_ALL_PREFIXES(AttachmentBrokerUnprivilegedWinTest,
@@ -115,6 +118,10 @@ class IPC_EXPORT AttachmentBroker : public Listener {
AttachmentVector attachments_;
std::vector<Observer*> observers_;
+
+ // The AttachmentBroker can be accessed from any thread, so modifications to
+ // internal state must be guarded by a lock.
+ base::Lock lock_;
DISALLOW_COPY_AND_ASSIGN(AttachmentBroker);
};
« no previous file with comments | « no previous file | ipc/attachment_broker.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698