- a/Source/WebCore/ChangeLog +16 lines
Lines 1-3 a/Source/WebCore/ChangeLog_sec1
1
2014-05-31  Anders Carlsson  <andersca@apple.com>
2
3
        Don't use std::mutex::try_lock to check if we own a mutex
4
        https://bugs.webkit.org/show_bug.cgi?id=133421
5
6
        Reviewed by NOBODY (OOPS!).
7
8
        According the C++ standard, calling try_lock on a mutex that's already owned by the current thread
9
        is undefined behavior, so don't do that.
10
11
        * Modules/webdatabase/DatabaseBackendBase.cpp:
12
        (WebCore::guidToVersionMap):
13
        (WebCore::updateGuidVersionMap):
14
        (WebCore::guidToDatabaseMap):
15
        (WebCore::guidForOriginAndName):
16
1
2014-05-30  Enrica Casucci  <enrica@apple.com>
17
2014-05-30  Enrica Casucci  <enrica@apple.com>
2
18
3
        REGRESSION (WebKit2): space space to insert period doesn't work in web forms.
19
        REGRESSION (WebKit2): space space to insert period doesn't work in web forms.
- a/Source/WebCore/Modules/webdatabase/DatabaseBackendBase.cpp -12 lines
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;

Return to Bug 133421