Title: [277991] trunk/Source/WebKit
- Revision
- 277991
- Author
- cdu...@apple.com
- Date
- 2021-05-24 20:13:40 -0700 (Mon, 24 May 2021)
Log Message
[GLIB] Stop using UncheckedLock in IconDatabase
https://bugs.webkit.org/show_bug.cgi?id=226190
Reviewed by Sam Weinig.
Stop using UncheckedLock in IconDatabase to benefit from Clang thread-safety analysis.
* UIProcess/API/glib/IconDatabase.h:
Modified Paths
Diff
Modified: trunk/Source/WebKit/ChangeLog (277990 => 277991)
--- trunk/Source/WebKit/ChangeLog 2021-05-25 03:04:24 UTC (rev 277990)
+++ trunk/Source/WebKit/ChangeLog 2021-05-25 03:13:40 UTC (rev 277991)
@@ -1,3 +1,14 @@
+2021-05-24 Chris Dumez <cdu...@apple.com>
+
+ [GLIB] Stop using UncheckedLock in IconDatabase
+ https://bugs.webkit.org/show_bug.cgi?id=226190
+
+ Reviewed by Sam Weinig.
+
+ Stop using UncheckedLock in IconDatabase to benefit from Clang thread-safety analysis.
+
+ * UIProcess/API/glib/IconDatabase.h:
+
2021-05-24 Wenson Hsieh <wenson_hs...@apple.com>
[iOS] Adjust meaningful click heuristic to detect focus changes and editable content
Modified: trunk/Source/WebKit/UIProcess/API/glib/IconDatabase.cpp (277990 => 277991)
--- trunk/Source/WebKit/UIProcess/API/glib/IconDatabase.cpp 2021-05-25 03:04:24 UTC (rev 277990)
+++ trunk/Source/WebKit/UIProcess/API/glib/IconDatabase.cpp 2021-05-25 03:13:40 UTC (rev 277991)
@@ -566,37 +566,33 @@
return;
}
- Locker locker { m_loadedIconsLock };
- auto it = m_loadedIcons.find(iconURL);
- if (it != m_loadedIcons.end() && it->value.first) {
- auto icon = it->value.first;
- it->value.second = MonotonicTime::now();
- startClearLoadedIconsTimer();
- locker.unlockEarly();
- completionHandler(WTFMove(icon));
- return;
- }
-
- auto addResult = m_loadedIcons.set(iconURL, std::make_pair<PlatformImagePtr, MonotonicTime>(nullptr, MonotonicTime::now()));
- if (!iconData.isEmpty()) {
- auto image = BitmapImage::create();
- if (image->setData(SharedBuffer::create(WTFMove(iconData)), true) < EncodedDataStatus::SizeAvailable) {
- completionHandler(nullptr);
- return;
+ auto icon = [&]() -> WebCore::PlatformImagePtr {
+ Locker locker { m_loadedIconsLock };
+ auto it = m_loadedIcons.find(iconURL);
+ if (it != m_loadedIcons.end() && it->value.first) {
+ auto icon = it->value.first;
+ it->value.second = MonotonicTime::now();
+ startClearLoadedIconsTimer();
+ return icon;
}
- auto nativeImage = image->nativeImageForCurrentFrame();
- if (!nativeImage) {
- completionHandler(nullptr);
- return;
+ auto addResult = m_loadedIcons.set(iconURL, std::make_pair<PlatformImagePtr, MonotonicTime>(nullptr, MonotonicTime::now()));
+ if (!iconData.isEmpty()) {
+ auto image = BitmapImage::create();
+ if (image->setData(SharedBuffer::create(WTFMove(iconData)), true) < EncodedDataStatus::SizeAvailable)
+ return nullptr;
+
+ auto nativeImage = image->nativeImageForCurrentFrame();
+ if (!nativeImage)
+ return nullptr;
+
+ addResult.iterator->value.first = nativeImage->platformImage();
}
- addResult.iterator->value.first = nativeImage->platformImage();
- }
-
- auto icon = addResult.iterator->value.first;
- startClearLoadedIconsTimer();
- locker.unlockEarly();
+ auto icon = addResult.iterator->value.first;
+ startClearLoadedIconsTimer();
+ return icon;
+ }();
completionHandler(WTFMove(icon));
});
});
Modified: trunk/Source/WebKit/UIProcess/API/glib/IconDatabase.h (277990 => 277991)
--- trunk/Source/WebKit/UIProcess/API/glib/IconDatabase.h 2021-05-25 03:04:24 UTC (rev 277990)
+++ trunk/Source/WebKit/UIProcess/API/glib/IconDatabase.h 2021-05-25 03:13:40 UTC (rev 277991)
@@ -71,8 +71,8 @@
WebCore::SQLiteDatabase m_db;
HashMap<String, String> m_pageURLToIconURLMap;
Lock m_pageURLToIconURLMapLock;
- HashMap<String, std::pair<WebCore::PlatformImagePtr, MonotonicTime>> m_loadedIcons;
- UncheckedLock m_loadedIconsLock;
+ HashMap<String, std::pair<WebCore::PlatformImagePtr, MonotonicTime>> m_loadedIcons WTF_GUARDED_BY_LOCK(m_loadedIconsLock);
+ Lock m_loadedIconsLock;
std::unique_ptr<WebCore::SQLiteStatement> m_iconIDForIconURLStatement;
std::unique_ptr<WebCore::SQLiteStatement> m_setIconIDForPageURLStatement;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes