[GTK] IconDatabase is not thread-safe
authorcarlosgc@webkit.org <carlosgc@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 30 Sep 2019 12:38:44 +0000 (12:38 +0000)
committercarlosgc@webkit.org <carlosgc@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 30 Sep 2019 12:38:44 +0000 (12:38 +0000)
commit23e68f38e658d370f8a11ab12cf2f05ad9f17657
tree3461d3916793e917c0ec5e3e03bdde92991fd37f
parent1ffa6d51d707ea203c82dcdeaac3b9350b5e5d58
[GTK] IconDatabase is not thread-safe
https://bugs.webkit.org/show_bug.cgi?id=201303

Reviewed by Žan Doberšek.

Source/WebKit:

Rewrite the IconDatabase implementation. Now that we are the only users of this code, we can simply it a lot and
design it specifically for our API, which implementation has been simplified a lot too. There's no change in
the database schema nor in behavior from the API point of view.

* UIProcess/API/glib/IconDatabase.cpp:
(WebKit::IconDatabase::IconDatabase):
(WebKit::IconDatabase::~IconDatabase):
(WebKit::IconDatabase::createTablesIfNeeded):
(WebKit::IconDatabase::populatePageURLToIconURLMap):
(WebKit::IconDatabase::clearStatements):
(WebKit::IconDatabase::pruneTimerFired):
(WebKit::IconDatabase::startPruneTimer):
(WebKit::IconDatabase::clearLoadedIconsTimerFired):
(WebKit::IconDatabase::startClearLoadedIconsTimer):
(WebKit::IconDatabase::iconIDForIconURL):
(WebKit::IconDatabase::setIconIDForPageURL):
(WebKit::IconDatabase::iconData):
(WebKit::IconDatabase::addIcon):
(WebKit::IconDatabase::updateIconTimestamp):
(WebKit::IconDatabase::deleteIcon):
(WebKit::IconDatabase::checkIconURLAndSetPageURLIfNeeded):
(WebKit::IconDatabase::loadIconForPageURL):
(WebKit::IconDatabase::iconURLForPageURL):
(WebKit::IconDatabase::setIconForPageURL):
(WebKit::IconDatabase::clear):
* UIProcess/API/glib/IconDatabase.h:
(WebKit::IconDatabase::create):
* UIProcess/API/glib/WebKitFaviconDatabase.cpp:
(webkitFaviconDatabaseCreate):
(webkitFaviconDatabaseIsOpen):
(webkitFaviconDatabaseOpen):
(webkitFaviconDatabaseClose):
(webkitFaviconDatabaseGetLoadDecisionForIcon):
(webkitFaviconDatabaseSetIconForPageURL):
(webkitFaviconDatabaseGetFaviconInternal):
(webkit_favicon_database_get_favicon):
(webkit_favicon_database_get_favicon_finish):
(webkit_favicon_database_get_favicon_uri):
(webkit_favicon_database_clear):
* UIProcess/API/glib/WebKitFaviconDatabasePrivate.h:
* UIProcess/API/glib/WebKitWebContext.cpp:
(webkitWebContextDispose):
(webkit_web_context_set_favicon_database_directory):
(webkitWebContextCreatePageForWebView):
(webkitWebContextWebViewDestroyed):
* UIProcess/API/glib/WebKitWebView.cpp:
(webkitWebViewRequestFavicon):
(webkitWebViewGetLoadDecisionForIcon):
(webkitWebViewSetIcon):

Tools:

Rewrite the WebKitFaviconDatabase tests, splitting tests cases again and making them independent to each other.

* TestWebKitAPI/Tests/WebKitGLib/TestWebKitFaviconDatabase.cpp:
(testFaviconDatabaseInitialization):
(testFaviconDatabaseGetFavicon):
(ephemeralViewFaviconChanged):
(testFaviconDatabaseEphemeral):
(testFaviconDatabaseClear):
(beforeAll):
(afterAll):
* TestWebKitAPI/glib/TestExpectations.json: TestWebKitFaviconDatabase shouls always pass now.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@250518 268f45cc-cd09-0410-ab3c-d52691b4dbfc
12 files changed:
Source/WebKit/ChangeLog
Source/WebKit/UIProcess/API/glib/IconDatabase.cpp
Source/WebKit/UIProcess/API/glib/IconDatabase.h
Source/WebKit/UIProcess/API/glib/WebKitFaviconDatabase.cpp
Source/WebKit/UIProcess/API/glib/WebKitFaviconDatabasePrivate.h
Source/WebKit/UIProcess/API/glib/WebKitWebContext.cpp
Source/WebKit/UIProcess/API/glib/WebKitWebView.cpp
Tools/ChangeLog
Tools/TestWebKitAPI/Tests/WebKitGLib/TestWebKitFaviconDatabase.cpp
Tools/TestWebKitAPI/glib/CMakeLists.txt
Tools/TestWebKitAPI/glib/PlatformGTK.cmake
Tools/TestWebKitAPI/glib/TestExpectations.json