|
Lines 153-161
static std::mutex& guidMutex()
a/Source/WebCore/Modules/webdatabase/DatabaseBackendBase.cpp_sec1
|
| 153 |
typedef HashMap<DatabaseGuid, String> GuidVersionMap; |
153 |
typedef HashMap<DatabaseGuid, String> GuidVersionMap; |
| 154 |
static GuidVersionMap& guidToVersionMap() |
154 |
static GuidVersionMap& guidToVersionMap() |
| 155 |
{ |
155 |
{ |
| 156 |
// Ensure the the mutex is locked. |
|
|
| 157 |
ASSERT(!guidMutex().try_lock()); |
| 158 |
|
| 159 |
static NeverDestroyed<GuidVersionMap> map; |
156 |
static NeverDestroyed<GuidVersionMap> map; |
| 160 |
return map; |
157 |
return map; |
| 161 |
} |
158 |
} |
|
Lines 163-171
static GuidVersionMap& guidToVersionMap()
a/Source/WebCore/Modules/webdatabase/DatabaseBackendBase.cpp_sec2
|
| 163 |
// NOTE: Caller must lock guidMutex(). |
160 |
// NOTE: Caller must lock guidMutex(). |
| 164 |
static inline void updateGuidVersionMap(DatabaseGuid guid, String newVersion) |
161 |
static inline void updateGuidVersionMap(DatabaseGuid guid, String newVersion) |
| 165 |
{ |
162 |
{ |
| 166 |
// Ensure the the mutex is locked. |
|
|
| 167 |
ASSERT(!guidMutex().try_lock()); |
| 168 |
|
| 169 |
// Note: It is not safe to put an empty string into the guidToVersionMap() map. |
163 |
// Note: It is not safe to put an empty string into the guidToVersionMap() map. |
| 170 |
// That's because the map is cross-thread, but empty strings are per-thread. |
164 |
// That's because the map is cross-thread, but empty strings are per-thread. |
| 171 |
// The copy() function makes a version of the string you can use on the current |
165 |
// The copy() function makes a version of the string you can use on the current |
|
Lines 180-197
typedef HashMap<DatabaseGuid, std::unique_ptr<HashSet<DatabaseBackendBase*>>> Gu
a/Source/WebCore/Modules/webdatabase/DatabaseBackendBase.cpp_sec3
|
| 180 |
|
174 |
|
| 181 |
static GuidDatabaseMap& guidToDatabaseMap() |
175 |
static GuidDatabaseMap& guidToDatabaseMap() |
| 182 |
{ |
176 |
{ |
| 183 |
// Ensure the the mutex is locked. |
|
|
| 184 |
ASSERT(!guidMutex().try_lock()); |
| 185 |
|
| 186 |
static NeverDestroyed<GuidDatabaseMap> map; |
177 |
static NeverDestroyed<GuidDatabaseMap> map; |
| 187 |
return map; |
178 |
return map; |
| 188 |
} |
179 |
} |
| 189 |
|
180 |
|
| 190 |
static DatabaseGuid guidForOriginAndName(const String& origin, const String& name) |
181 |
static DatabaseGuid guidForOriginAndName(const String& origin, const String& name) |
| 191 |
{ |
182 |
{ |
| 192 |
// Ensure the the mutex is locked. |
|
|
| 193 |
ASSERT(!guidMutex().try_lock()); |
| 194 |
|
| 195 |
String stringID = origin + "/" + name; |
183 |
String stringID = origin + "/" + name; |
| 196 |
|
184 |
|
| 197 |
typedef HashMap<String, int> IDGuidMap; |
185 |
typedef HashMap<String, int> IDGuidMap; |