| Index: base/supports_user_data.h
|
| diff --git a/base/supports_user_data.h b/base/supports_user_data.h
|
| index e663ed2ed5c8793741b871c6110dca986160762b..4c7cdcad26202bb5577f31013a01f1a0587afa36 100644
|
| --- a/base/supports_user_data.h
|
| +++ b/base/supports_user_data.h
|
| @@ -10,6 +10,7 @@
|
| #include "base/base_export.h"
|
| #include "base/memory/linked_ptr.h"
|
| #include "base/memory/ref_counted.h"
|
| +#include "base/threading/thread_checker.h"
|
|
|
| namespace base {
|
|
|
| @@ -35,6 +36,12 @@ class BASE_EXPORT SupportsUserData {
|
| void SetUserData(const void* key, Data* data);
|
| void RemoveUserData(const void* key);
|
|
|
| + // SupportsUserData is not thread-safe, and on debug build will assert it is
|
| + // only used on one thread. Calling this method allows the caller to hand
|
| + // the SupportsUserData instance across threads. Use only if you are taking
|
| + // full control of the synchronization of that hand over.
|
| + void DetachUserDataThread();
|
| +
|
| protected:
|
| virtual ~SupportsUserData();
|
|
|
| @@ -43,6 +50,8 @@ class BASE_EXPORT SupportsUserData {
|
|
|
| // Externally-defined data accessible by key.
|
| DataMap user_data_;
|
| + // Guards usage of |user_data_|
|
| + ThreadChecker thread_checker_;
|
|
|
| DISALLOW_COPY_AND_ASSIGN(SupportsUserData);
|
| };
|
|
|