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); |
}; |