- Revision
- 264694
- Author
- [email protected]
- Date
- 2020-07-22 03:47:49 -0700 (Wed, 22 Jul 2020)
Log Message
[GTK][WPE] ITP: use the database store unconditionally
https://bugs.webkit.org/show_bug.cgi?id=214590
Reviewed by Adrian Perez de Castro.
Source/WebKit:
The memory store is now considered legacy.
* NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp:
(WebKit::ResourceLoadStatisticsDatabaseStore::ResourceLoadStatisticsDatabaseStore): Use
FileSystem::pathByAppendingComponent() to create the database path.
(WebKit::ResourceLoadStatisticsDatabaseStore::openITPDatabase): Ensure the directory exists before trying to
open the database.
* UIProcess/soup/WebProcessPoolSoup.cpp:
(WebKit::WebProcessPool::platformInitializeNetworkProcess): Always enable the ITP databae by default.
Tools:
Update the unit test to monitor the database file instead of the old log file.
* TestWebKitAPI/Tests/WebKitGLib/TestWebsiteData.cpp:
(testWebsiteDataITP):
Modified Paths
Diff
Modified: trunk/Source/WebKit/ChangeLog (264693 => 264694)
--- trunk/Source/WebKit/ChangeLog 2020-07-22 05:08:44 UTC (rev 264693)
+++ trunk/Source/WebKit/ChangeLog 2020-07-22 10:47:49 UTC (rev 264694)
@@ -1,3 +1,20 @@
+2020-07-22 Carlos Garcia Campos <[email protected]>
+
+ [GTK][WPE] ITP: use the database store unconditionally
+ https://bugs.webkit.org/show_bug.cgi?id=214590
+
+ Reviewed by Adrian Perez de Castro.
+
+ The memory store is now considered legacy.
+
+ * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp:
+ (WebKit::ResourceLoadStatisticsDatabaseStore::ResourceLoadStatisticsDatabaseStore): Use
+ FileSystem::pathByAppendingComponent() to create the database path.
+ (WebKit::ResourceLoadStatisticsDatabaseStore::openITPDatabase): Ensure the directory exists before trying to
+ open the database.
+ * UIProcess/soup/WebProcessPoolSoup.cpp:
+ (WebKit::WebProcessPool::platformInitializeNetworkProcess): Always enable the ITP databae by default.
+
2020-07-19 Darin Adler <[email protected]>
Remove live ranges from Editor.h and EditorClient.h
Modified: trunk/Source/WebKit/NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp (264693 => 264694)
--- trunk/Source/WebKit/NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp 2020-07-22 05:08:44 UTC (rev 264693)
+++ trunk/Source/WebKit/NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp 2020-07-22 10:47:49 UTC (rev 264694)
@@ -282,7 +282,7 @@
ResourceLoadStatisticsDatabaseStore::ResourceLoadStatisticsDatabaseStore(WebResourceLoadStatisticsStore& store, WorkQueue& workQueue, ShouldIncludeLocalhost shouldIncludeLocalhost, const String& storageDirectoryPath, PAL::SessionID sessionID)
: ResourceLoadStatisticsStore(store, workQueue, shouldIncludeLocalhost)
- , m_storageDirectoryPath(storageDirectoryPath + "/observations.db")
+ , m_storageDirectoryPath(FileSystem::pathByAppendingComponent(storageDirectoryPath, "observations.db"_s))
, m_sessionID(sessionID)
{
ASSERT(!RunLoop::isMain());
@@ -320,9 +320,13 @@
void ResourceLoadStatisticsDatabaseStore::openITPDatabase()
{
- if (!FileSystem::fileExists(m_storageDirectoryPath))
+ if (!FileSystem::fileExists(m_storageDirectoryPath)) {
+ if (!FileSystem::makeAllDirectories(FileSystem::directoryName(m_storageDirectoryPath))) {
+ RELEASE_LOG_ERROR(Network, "%p - ResourceLoadStatisticsDatabaseStore::open failed, error message: Failed to create directory database path: %" PUBLIC_LOG_STRING, this, m_storageDirectoryPath.utf8().data());
+ return;
+ }
m_isNewResourceLoadStatisticsDatabaseFile = true;
- else
+ } else
m_isNewResourceLoadStatisticsDatabaseFile = false;
if (!m_database.open(m_storageDirectoryPath)) {
Modified: trunk/Source/WebKit/UIProcess/soup/WebProcessPoolSoup.cpp (264693 => 264694)
--- trunk/Source/WebKit/UIProcess/soup/WebProcessPoolSoup.cpp 2020-07-22 05:08:44 UTC (rev 264693)
+++ trunk/Source/WebKit/UIProcess/soup/WebProcessPoolSoup.cpp 2020-07-22 10:47:49 UTC (rev 264694)
@@ -46,6 +46,7 @@
parameters.ignoreTLSErrors = m_ignoreTLSErrors;
parameters.languages = userPreferredLanguages();
parameters.proxySettings = m_networkProxySettings;
+ parameters.shouldEnableITPDatabase = true;
}
void WebProcessPool::setIgnoreTLSErrors(bool ignoreTLSErrors)
Modified: trunk/Tools/ChangeLog (264693 => 264694)
--- trunk/Tools/ChangeLog 2020-07-22 05:08:44 UTC (rev 264693)
+++ trunk/Tools/ChangeLog 2020-07-22 10:47:49 UTC (rev 264694)
@@ -1,3 +1,15 @@
+2020-07-22 Carlos Garcia Campos <[email protected]>
+
+ [GTK][WPE] ITP: use the database store unconditionally
+ https://bugs.webkit.org/show_bug.cgi?id=214590
+
+ Reviewed by Adrian Perez de Castro.
+
+ Update the unit test to monitor the database file instead of the old log file.
+
+ * TestWebKitAPI/Tests/WebKitGLib/TestWebsiteData.cpp:
+ (testWebsiteDataITP):
+
2020-07-19 Darin Adler <[email protected]>
Remove live ranges from Editor.h and EditorClient.h
Modified: trunk/Tools/TestWebKitAPI/Tests/WebKitGLib/TestWebsiteData.cpp (264693 => 264694)
--- trunk/Tools/TestWebKitAPI/Tests/WebKitGLib/TestWebsiteData.cpp 2020-07-22 05:08:44 UTC (rev 264693)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKitGLib/TestWebsiteData.cpp 2020-07-22 10:47:49 UTC (rev 264694)
@@ -673,10 +673,10 @@
static void testWebsiteDataITP(WebsiteDataTest* test, gconstpointer)
{
const char* itpDirectory = webkit_website_data_manager_get_itp_directory(test->m_manager);
- GUniquePtr<char> itpLogFile(g_build_filename(itpDirectory, "full_browsing_session_resourceLog.plist", nullptr));
+ GUniquePtr<char> itpDatabaseFile(g_build_filename(itpDirectory, "observations.db", nullptr));
// Delete any previous data.
- g_unlink(itpLogFile.get());
+ g_unlink(itpDatabaseFile.get());
g_rmdir(itpDirectory);
g_assert_false(webkit_website_data_manager_get_itp_enabled(test->m_manager));
@@ -686,15 +686,18 @@
webkit_website_data_manager_set_itp_enabled(test->m_manager, TRUE);
g_assert_true(webkit_website_data_manager_get_itp_enabled(test->m_manager));
g_assert_false(g_file_test(itpDirectory, G_FILE_TEST_IS_DIR));
- g_assert_false(g_file_test(itpLogFile.get(), G_FILE_TEST_IS_REGULAR));
+ g_assert_false(g_file_test(itpDatabaseFile.get(), G_FILE_TEST_IS_REGULAR));
test->loadURI(kServer->getURIForPath("/empty").data());
test->waitUntilLoadFinished();
- test->waitUntilFileChanged(itpLogFile.get(), G_FILE_MONITOR_EVENT_CREATED);
+ test->waitUntilFileChanged(itpDatabaseFile.get(), G_FILE_MONITOR_EVENT_CREATED);
g_assert_true(g_file_test(itpDirectory, G_FILE_TEST_IS_DIR));
- g_assert_true(g_file_test(itpLogFile.get(), G_FILE_TEST_IS_REGULAR));
+ g_assert_true(g_file_test(itpDatabaseFile.get(), G_FILE_TEST_IS_REGULAR));
+ // Give some time for the database to be updated.
+ test->wait(0.5);
+
GList* dataList = test->fetch(WEBKIT_WEBSITE_DATA_ITP);
g_assert_nonnull(dataList);
g_assert_cmpuint(g_list_length(dataList), ==, 1);
@@ -713,7 +716,7 @@
// Clear all.
static const WebKitWebsiteDataTypes cacheAndITP = static_cast<WebKitWebsiteDataTypes>(WEBKIT_WEBSITE_DATA_ITP | WEBKIT_WEBSITE_DATA_MEMORY_CACHE | WEBKIT_WEBSITE_DATA_DISK_CACHE);
test->clear(cacheAndITP, 0);
- test->waitUntilFileChanged(itpLogFile.get(), G_FILE_MONITOR_EVENT_DELETED);
+ test->waitUntilFileChanged(itpDatabaseFile.get(), G_FILE_MONITOR_EVENT_DELETED);
webkit_website_data_manager_set_itp_enabled(test->m_manager, FALSE);
g_assert_false(webkit_website_data_manager_get_itp_enabled(test->m_manager));