Index: third_party/WebKit/Source/modules/indexeddb/IndexedDBClient.cpp |
diff --git a/third_party/WebKit/Source/modules/indexeddb/IndexedDBClient.cpp b/third_party/WebKit/Source/modules/indexeddb/IndexedDBClient.cpp |
index 78f0ecaf2a365ef53694a2210685a709c977d6f0..54f9f5eba241df40b4cf95ba9bff6c4cf9c0d317 100644 |
--- a/third_party/WebKit/Source/modules/indexeddb/IndexedDBClient.cpp |
+++ b/third_party/WebKit/Source/modules/indexeddb/IndexedDBClient.cpp |
@@ -3,14 +3,19 @@ |
// found in the LICENSE file. |
#include "modules/indexeddb/IndexedDBClient.h" |
+#include "wtf/Atomics.h" |
namespace blink { |
-static CreateIndexedDBClient* idbClientCreateFunction = nullptr; |
+static void* idbClientCreateFunction = nullptr; |
void setIndexedDBClientCreateFunction(CreateIndexedDBClient createFunction) |
{ |
- idbClientCreateFunction = createFunction; |
+#if ENABLE(ASSERT) |
+ CreateIndexedDBClient* currentFunction = reinterpret_cast<CreateIndexedDBClient*>(acquireLoad(&idbClientCreateFunction)); |
+ ASSERT(!currentFunction || currentFunction == createFunction); |
+#endif |
+ releaseStore(&idbClientCreateFunction, reinterpret_cast<void*>(createFunction)); |
} |
IndexedDBClient* IndexedDBClient::create() |
@@ -18,7 +23,7 @@ IndexedDBClient* IndexedDBClient::create() |
ASSERT(idbClientCreateFunction); |
// There's no reason why we need to allocate a new proxy each time, but |
// there's also no strong reason not to. |
- return idbClientCreateFunction(); |
+ return reinterpret_cast<CreateIndexedDBClient*>(idbClientCreateFunction)(); |
} |
} // namespace blink |