- Revision
- 211841
- Author
- bfulg...@apple.com
- Date
- 2017-02-07 16:07:02 -0800 (Tue, 07 Feb 2017)
Log Message
Correct initialization of Resource Load Statistics for use in WebKitTestRunner
https://bugs.webkit.org/show_bug.cgi?id=167960
Reviewed by Andy Estes.
WebKit2 starts up with different process configuration settings depending on the type of
WebView and client application. This led to two problems:
1. Registering the shared resource load observer did not start at UIProcess launch. Instead, it
was lazily initialized as messages from the various WebProcess started getting received. This
is too slow for WebKitTestRunner, which needs this object to be initialized right at launch
time.
A new 'registerSharedResourceLoadObserver' method was needed, so that the WebProcess can ask
the WebsiteDataStore to register a resource load observer during platform initialization.
2. Some WebView uses do not enable WebsiteDataStore, and should not activate a resource load
statistics observer.
* UIProcess/API/APIWebsiteDataStore.cpp:
(API::WebsiteDataStore::registerSharedResourceLoadObserver): Added.
* UIProcess/API/APIWebsiteDataStore.h:
* UIProcess/Cocoa/WebProcessPoolCocoa.mm:
(WebKit::WebProcessPool::platformInitialize): If the web process is using a WebsiteDataStore,
register a resource load observer.
* UIProcess/WebResourceLoadStatisticsStore.cpp:
(WebKit::WebResourceLoadStatisticsStore::registerSharedResourceLoadObserver): Added.
* UIProcess/WebResourceLoadStatisticsStore.h:
* UIProcess/WebsiteData/WebsiteDataStore.cpp:
(WebKit::WebsiteDataStore::registerSharedResourceLoadObserver): Added.
* UIProcess/WebsiteData/WebsiteDataStore.h:
Modified Paths
Diff
Modified: trunk/Source/WebKit2/ChangeLog (211840 => 211841)
--- trunk/Source/WebKit2/ChangeLog 2017-02-07 22:31:48 UTC (rev 211840)
+++ trunk/Source/WebKit2/ChangeLog 2017-02-08 00:07:02 UTC (rev 211841)
@@ -1,3 +1,36 @@
+2017-02-07 Brent Fulgham <bfulg...@apple.com>
+
+ Correct initialization of Resource Load Statistics for use in WebKitTestRunner
+ https://bugs.webkit.org/show_bug.cgi?id=167960
+
+ Reviewed by Andy Estes.
+
+ WebKit2 starts up with different process configuration settings depending on the type of
+ WebView and client application. This led to two problems:
+ 1. Registering the shared resource load observer did not start at UIProcess launch. Instead, it
+ was lazily initialized as messages from the various WebProcess started getting received. This
+ is too slow for WebKitTestRunner, which needs this object to be initialized right at launch
+ time.
+
+ A new 'registerSharedResourceLoadObserver' method was needed, so that the WebProcess can ask
+ the WebsiteDataStore to register a resource load observer during platform initialization.
+
+ 2. Some WebView uses do not enable WebsiteDataStore, and should not activate a resource load
+ statistics observer.
+
+ * UIProcess/API/APIWebsiteDataStore.cpp:
+ (API::WebsiteDataStore::registerSharedResourceLoadObserver): Added.
+ * UIProcess/API/APIWebsiteDataStore.h:
+ * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
+ (WebKit::WebProcessPool::platformInitialize): If the web process is using a WebsiteDataStore,
+ register a resource load observer.
+ * UIProcess/WebResourceLoadStatisticsStore.cpp:
+ (WebKit::WebResourceLoadStatisticsStore::registerSharedResourceLoadObserver): Added.
+ * UIProcess/WebResourceLoadStatisticsStore.h:
+ * UIProcess/WebsiteData/WebsiteDataStore.cpp:
+ (WebKit::WebsiteDataStore::registerSharedResourceLoadObserver): Added.
+ * UIProcess/WebsiteData/WebsiteDataStore.h:
+
2017-02-07 Anders Carlsson <ander...@apple.com>
REGRESSION (r211819): [ios-simulator] API tests Coding.WKWebView and Coding.WKWebView_SameConfiguration crashing
Modified: trunk/Source/WebKit2/UIProcess/API/APIWebsiteDataStore.cpp (211840 => 211841)
--- trunk/Source/WebKit2/UIProcess/API/APIWebsiteDataStore.cpp 2017-02-07 22:31:48 UTC (rev 211840)
+++ trunk/Source/WebKit2/UIProcess/API/APIWebsiteDataStore.cpp 2017-02-08 00:07:02 UTC (rev 211841)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2014, 2016 Apple Inc. All rights reserved.
+ * Copyright (C) 2014-2017 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -78,6 +78,11 @@
{
m_websiteDataStore->setResourceLoadStatisticsEnabled(enabled);
}
+
+void WebsiteDataStore::registerSharedResourceLoadObserver()
+{
+ m_websiteDataStore->registerSharedResourceLoadObserver();
+}
#if !PLATFORM(COCOA) && !PLATFORM(EFL) && !PLATFORM(GTK)
WebKit::WebsiteDataStore::Configuration WebsiteDataStore::defaultDataStoreConfiguration()
Modified: trunk/Source/WebKit2/UIProcess/API/APIWebsiteDataStore.h (211840 => 211841)
--- trunk/Source/WebKit2/UIProcess/API/APIWebsiteDataStore.h 2017-02-07 22:31:48 UTC (rev 211840)
+++ trunk/Source/WebKit2/UIProcess/API/APIWebsiteDataStore.h 2017-02-08 00:07:02 UTC (rev 211841)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2014-2016 Apple Inc. All rights reserved.
+ * Copyright (C) 2014-2017 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -44,6 +44,7 @@
bool resourceLoadStatisticsEnabled() const;
void setResourceLoadStatisticsEnabled(bool);
+ void registerSharedResourceLoadObserver();
WebKit::WebsiteDataStore& websiteDataStore() { return *m_websiteDataStore; }
Modified: trunk/Source/WebKit2/UIProcess/Cocoa/WebProcessPoolCocoa.mm (211840 => 211841)
--- trunk/Source/WebKit2/UIProcess/Cocoa/WebProcessPoolCocoa.mm 2017-02-07 22:31:48 UTC (rev 211840)
+++ trunk/Source/WebKit2/UIProcess/Cocoa/WebProcessPoolCocoa.mm 2017-02-08 00:07:02 UTC (rev 211841)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2010 Apple Inc. All rights reserved.
+ * Copyright (C) 2010-2017 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -145,6 +145,9 @@
IPC::setAllowsDecodingSecKeyRef(true);
WebKit::WebMemoryPressureHandler::singleton();
#endif
+
+ if (m_websiteDataStore)
+ m_websiteDataStore->registerSharedResourceLoadObserver();
}
#if PLATFORM(IOS)
Modified: trunk/Source/WebKit2/UIProcess/WebResourceLoadStatisticsStore.cpp (211840 => 211841)
--- trunk/Source/WebKit2/UIProcess/WebResourceLoadStatisticsStore.cpp 2017-02-07 22:31:48 UTC (rev 211840)
+++ trunk/Source/WebKit2/UIProcess/WebResourceLoadStatisticsStore.cpp 2017-02-08 00:07:02 UTC (rev 211841)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2016 Apple Inc. All rights reserved.
+ * Copyright (C) 2016-2017 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -33,6 +33,7 @@
#include "WebsiteDataFetchOption.h"
#include "WebsiteDataType.h"
#include <WebCore/KeyedCoding.h>
+#include <WebCore/ResourceLoadObserver.h>
#include <WebCore/ResourceLoadStatistics.h>
#include <wtf/CurrentTime.h>
#include <wtf/MainThread.h>
@@ -191,6 +192,11 @@
return m_resourceLoadStatisticsEnabled;
}
+void WebResourceLoadStatisticsStore::registerSharedResourceLoadObserver()
+{
+ ResourceLoadObserver::sharedObserver().setStatisticsStore(m_resourceStatisticsStore.copyRef());
+}
+
void WebResourceLoadStatisticsStore::readDataFromDiskIfNeeded()
{
if (!m_resourceLoadStatisticsEnabled)
Modified: trunk/Source/WebKit2/UIProcess/WebResourceLoadStatisticsStore.h (211840 => 211841)
--- trunk/Source/WebKit2/UIProcess/WebResourceLoadStatisticsStore.h 2017-02-07 22:31:48 UTC (rev 211840)
+++ trunk/Source/WebKit2/UIProcess/WebResourceLoadStatisticsStore.h 2017-02-08 00:07:02 UTC (rev 211841)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2016 Apple Inc. All rights reserved.
+ * Copyright (C) 2016-2017 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -55,6 +55,7 @@
void setResourceLoadStatisticsEnabled(bool);
bool resourceLoadStatisticsEnabled() const;
+ void registerSharedResourceLoadObserver();
void resourceLoadStatisticsUpdated(const Vector<WebCore::ResourceLoadStatistics>& origins);
Modified: trunk/Source/WebKit2/UIProcess/WebsiteData/WebsiteDataStore.cpp (211840 => 211841)
--- trunk/Source/WebKit2/UIProcess/WebsiteData/WebsiteDataStore.cpp 2017-02-07 22:31:48 UTC (rev 211840)
+++ trunk/Source/WebKit2/UIProcess/WebsiteData/WebsiteDataStore.cpp 2017-02-08 00:07:02 UTC (rev 211841)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2014-2016 Apple Inc. All rights reserved.
+ * Copyright (C) 2014-2017 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -1158,4 +1158,12 @@
}
}
+void WebsiteDataStore::registerSharedResourceLoadObserver()
+{
+ if (!m_resourceLoadStatistics)
+ return;
+
+ m_resourceLoadStatistics->registerSharedResourceLoadObserver();
}
+
+}
Modified: trunk/Source/WebKit2/UIProcess/WebsiteData/WebsiteDataStore.h (211840 => 211841)
--- trunk/Source/WebKit2/UIProcess/WebsiteData/WebsiteDataStore.h 2017-02-07 22:31:48 UTC (rev 211840)
+++ trunk/Source/WebKit2/UIProcess/WebsiteData/WebsiteDataStore.h 2017-02-08 00:07:02 UTC (rev 211841)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2014-2016 Apple Inc. All rights reserved.
+ * Copyright (C) 2014-2017 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -79,6 +79,7 @@
bool resourceLoadStatisticsEnabled() const;
void setResourceLoadStatisticsEnabled(bool);
+ void registerSharedResourceLoadObserver();
static void cloneSessionData(WebPageProxy& sourcePage, WebPageProxy& newPage);