Title: [147456] tags/Safari-537.35.6

Diff

Modified: tags/Safari-537.35.6/Source/WebCore/ChangeLog (147455 => 147456)


--- tags/Safari-537.35.6/Source/WebCore/ChangeLog	2013-04-02 17:53:26 UTC (rev 147455)
+++ tags/Safari-537.35.6/Source/WebCore/ChangeLog	2013-04-02 17:58:16 UTC (rev 147456)
@@ -1,5 +1,38 @@
 2013-04-01  Lucas Forschler  <[email protected]>
 
+        Merge r147260
+
+    2013-03-29  Alexey Proskuryakov  <[email protected]>
+
+            Expose FeatureObserver data to WebKit clients
+            https://bugs.webkit.org/show_bug.cgi?id=113613
+
+            Reviewed by Sam Weinig.
+
+            FeatureObserver used to depend on chromium-only HistogramSupport, which is not
+            really usable on Mac at least.
+
+            Instead of adding parallel feature reporting machinery, I'm adding a way to
+            generically relay the data from FeatureObserver to port code.
+
+            * loader/FrameLoader.cpp:
+            (WebCore::FrameLoader::loadWithDocumentLoader):
+            (WebCore::FrameLoader::commitProvisionalLoad):
+            (WebCore::FrameLoader::reportMemoryUsage):
+            * loader/FrameLoader.h:
+            (WebCore::FrameLoader::previousURL):
+            Exposed m_previousURL, renaming it to follow WebKit style.
+
+            * page/FeatureObserver.cpp:
+            (WebCore::FeatureObserver::~FeatureObserver):
+            (WebCore::FeatureObserver::updateMeasurements):
+            * page/FeatureObserver.h:
+            (WebCore::FeatureObserver::accumulatedFeatureBits):
+            Exposed the data to clients, and made reporting through HistogramSupport
+            chromium only for clarity.
+
+2013-04-01  Lucas Forschler  <[email protected]>
+
         Merge r147240
 
     2013-03-29  Dean Jackson  <[email protected]>

Modified: tags/Safari-537.35.6/Source/WebCore/loader/FrameLoader.cpp (147455 => 147456)


--- tags/Safari-537.35.6/Source/WebCore/loader/FrameLoader.cpp	2013-04-02 17:53:26 UTC (rev 147455)
+++ tags/Safari-537.35.6/Source/WebCore/loader/FrameLoader.cpp	2013-04-02 17:58:16 UTC (rev 147456)
@@ -1363,7 +1363,7 @@
         return;
 
     if (m_frame->document())
-        m_previousUrl = m_frame->document()->url();
+        m_previousURL = m_frame->document()->url();
 
     policyChecker()->setLoadType(type);
     RefPtr<FormState> formState = prpFormState;
@@ -1726,7 +1726,7 @@
     if (pdl && m_documentLoader) {
         // Check if the destination page is allowed to access the previous page's timing information.
         RefPtr<SecurityOrigin> securityOrigin = SecurityOrigin::create(pdl->request().url());
-        m_documentLoader->timing()->setHasSameOriginAsPreviousDocument(securityOrigin->canRequest(m_previousUrl));
+        m_documentLoader->timing()->setHasSameOriginAsPreviousDocument(securityOrigin->canRequest(m_previousURL));
     }
 
     // Call clientRedirectCancelledOrFinished() here so that the frame load delegate is notified that the redirect's
@@ -3350,7 +3350,7 @@
     info.addMember(m_openedFrames, "openedFrames");
     info.addMember(m_outgoingReferrer, "outgoingReferrer");
     info.addMember(m_networkingContext, "networkingContext");
-    info.addMember(m_previousUrl, "previousUrl");
+    info.addMember(m_previousURL, "previousURL");
     info.addMember(m_requestedHistoryItem, "requestedHistoryItem");
 }
 

Modified: tags/Safari-537.35.6/Source/WebCore/loader/FrameLoader.h (147455 => 147456)


--- tags/Safari-537.35.6/Source/WebCore/loader/FrameLoader.h	2013-04-02 17:53:26 UTC (rev 147455)
+++ tags/Safari-537.35.6/Source/WebCore/loader/FrameLoader.h	2013-04-02 17:58:16 UTC (rev 147456)
@@ -286,6 +286,8 @@
 
     NetworkingContext* networkingContext() const;
 
+    const KURL& previousURL() const { return m_previousURL; }
+
     void reportMemoryUsage(MemoryObjectInfo*) const;
 
 private:
@@ -447,7 +449,7 @@
 
     RefPtr<FrameNetworkingContext> m_networkingContext;
 
-    KURL m_previousUrl;
+    KURL m_previousURL;
     RefPtr<HistoryItem> m_requestedHistoryItem;
 };
 

Modified: tags/Safari-537.35.6/Source/WebCore/page/FeatureObserver.cpp (147455 => 147456)


--- tags/Safari-537.35.6/Source/WebCore/page/FeatureObserver.cpp	2013-04-02 17:53:26 UTC (rev 147455)
+++ tags/Safari-537.35.6/Source/WebCore/page/FeatureObserver.cpp	2013-04-02 17:58:16 UTC (rev 147456)
@@ -39,23 +39,32 @@
 
 FeatureObserver::~FeatureObserver()
 {
+#if PLATFORM(CHROMUM)
     // We always log PageDestruction so that we have a scale for the rest of the features.
     HistogramSupport::histogramEnumeration("WebCore.FeatureObserver", PageDestruction, NumberOfFeatures);
+#endif
 
     updateMeasurements();
 }
 
 void FeatureObserver::updateMeasurements()
 {
+#if PLATFORM(CHROMUM)
     HistogramSupport::histogramEnumeration("WebCore.FeatureObserver", PageVisits, NumberOfFeatures);
+#endif
+
     if (!m_featureBits)
         return;
 
+#if PLATFORM(CHROMUM)
     for (unsigned i = 0; i < NumberOfFeatures; ++i) {
         if (m_featureBits->quickGet(i))
             HistogramSupport::histogramEnumeration("WebCore.FeatureObserver", i, NumberOfFeatures);
     }
+#endif
 
+    // Clearing feature bits is timing sensitive. Ports other than chromium do not use HistogramSupport,
+    // and pull the results on certain navigation events instead.
     m_featureBits->clearAll();
 }
 

Modified: tags/Safari-537.35.6/Source/WebCore/page/FeatureObserver.h (147455 => 147456)


--- tags/Safari-537.35.6/Source/WebCore/page/FeatureObserver.h	2013-04-02 17:53:26 UTC (rev 147455)
+++ tags/Safari-537.35.6/Source/WebCore/page/FeatureObserver.h	2013-04-02 17:58:16 UTC (rev 147456)
@@ -112,6 +112,8 @@
     static void observe(DOMWindow*, Feature);
     void didCommitLoad();
 
+    const BitVector* accumulatedFeatureBits() const { return m_featureBits.get(); }
+
 private:
     void didObserve(Feature feature)
     {

Modified: tags/Safari-537.35.6/Source/WebKit2/ChangeLog (147455 => 147456)


--- tags/Safari-537.35.6/Source/WebKit2/ChangeLog	2013-04-02 17:53:26 UTC (rev 147455)
+++ tags/Safari-537.35.6/Source/WebKit2/ChangeLog	2013-04-02 17:58:16 UTC (rev 147456)
@@ -1,3 +1,29 @@
+2013-04-01  Lucas Forschler  <[email protected]>
+
+        Merge r147260
+
+    2013-03-29  Alexey Proskuryakov  <[email protected]>
+
+            Expose FeatureObserver data to WebKit clients
+            https://bugs.webkit.org/show_bug.cgi?id=113613
+
+            Reviewed by Sam Weinig.
+
+            * Shared/APIClientTraits.cpp:
+            * Shared/APIClientTraits.h:
+            * WebProcess/InjectedBundle/API/c/WKBundlePage.h:
+            * WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.cpp:
+            (WebKit::InjectedBundlePageLoaderClient::featuresUsedInPage):
+            * WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.h:
+            Added a new injected bundle client call, featuresUsedInPage.
+
+            * WebProcess/WebPage/WebPage.cpp:
+            (WebKit::WebPage::close):
+            (WebKit::WebPage::didCommitLoad):
+            (WebKit::WebPage::reportUsedFeatures):
+            * WebProcess/WebPage/WebPage.h:
+            Report features used in a page when navigating away, or when closing.
+
 2013-03-29  Lucas Forschler  <[email protected]>
 
         Merge r147257

Modified: tags/Safari-537.35.6/Source/WebKit2/Shared/APIClientTraits.cpp (147455 => 147456)


--- tags/Safari-537.35.6/Source/WebKit2/Shared/APIClientTraits.cpp	2013-04-02 17:53:26 UTC (rev 147455)
+++ tags/Safari-537.35.6/Source/WebKit2/Shared/APIClientTraits.cpp	2013-04-02 17:58:16 UTC (rev 147456)
@@ -41,6 +41,7 @@
     offsetof(WKBundlePageLoaderClient, didFinishProgress),
     offsetof(WKBundlePageLoaderClient, didReceiveIntentForFrame_unavailable),
     offsetof(WKBundlePageLoaderClient, registerIntentServiceForFrame_unavailable),
+    offsetof(WKBundlePageLoaderClient, didLayout),
     sizeof(WKBundlePageLoaderClient)
 };
 

Modified: tags/Safari-537.35.6/Source/WebKit2/Shared/APIClientTraits.h (147455 => 147456)


--- tags/Safari-537.35.6/Source/WebKit2/Shared/APIClientTraits.h	2013-04-02 17:53:26 UTC (rev 147455)
+++ tags/Safari-537.35.6/Source/WebKit2/Shared/APIClientTraits.h	2013-04-02 17:58:16 UTC (rev 147456)
@@ -44,7 +44,7 @@
 };
 
 template<> struct APIClientTraits<WKBundlePageLoaderClient> {
-    static const size_t interfaceSizesByVersion[5];
+    static const size_t interfaceSizesByVersion[6];
 };
 
 template<> struct APIClientTraits<WKBundlePageResourceLoadClient> {

Modified: tags/Safari-537.35.6/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.h (147455 => 147456)


--- tags/Safari-537.35.6/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.h	2013-04-02 17:53:26 UTC (rev 147455)
+++ tags/Safari-537.35.6/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.h	2013-04-02 17:58:16 UTC (rev 147456)
@@ -110,6 +110,7 @@
 typedef void (*WKBundlePageWillDestroyGlobalObjectForDOMWindowExtensionCallback)(WKBundlePageRef page, WKBundleDOMWindowExtensionRef, const void* clientInfo);
 typedef bool (*WKBundlePageShouldForceUniversalAccessFromLocalURLCallback)(WKBundlePageRef, WKStringRef url, const void* clientInfo);
 typedef void (*WKBundlePageDidLayoutCallback)(WKBundlePageRef page, WKLayoutMilestones milestones, WKTypeRef* userData, const void *clientInfo);
+typedef void (*WKBundlePageFeaturesUsedInPageCallback)(WKBundlePageRef page, WKArrayRef featureStrings, const void *clientInfo);
 
 struct WKBundlePageLoaderClient {
     int                                                                     version;
@@ -155,10 +156,13 @@
 
     // Version 4
     WKBundlePageDidLayoutCallback                                           didLayout;
+
+    // Version 5
+    WKBundlePageFeaturesUsedInPageCallback                                  featuresUsedInPage;
 };
 typedef struct WKBundlePageLoaderClient WKBundlePageLoaderClient;
 
-enum { kWKBundlePageLoaderClientCurrentVersion = 4 };
+enum { kWKBundlePageLoaderClientCurrentVersion = 5 };
 
 enum {
     WKBundlePagePolicyActionPassThrough,

Modified: tags/Safari-537.35.6/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.cpp (147455 => 147456)


--- tags/Safari-537.35.6/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.cpp	2013-04-02 17:53:26 UTC (rev 147455)
+++ tags/Safari-537.35.6/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.cpp	2013-04-02 17:58:16 UTC (rev 147456)
@@ -26,6 +26,7 @@
 #include "config.h"
 #include "InjectedBundlePageLoaderClient.h"
 
+#include "ImmutableArray.h"
 #include "InjectedBundleDOMWindowExtension.h"
 #include "InjectedBundleScriptWorld.h"
 #include "WKAPICast.h"
@@ -314,4 +315,20 @@
     return m_client.shouldForceUniversalAccessFromLocalURL(toAPI(page), toAPI(url.impl()), m_client.clientInfo);
 }
 
+void InjectedBundlePageLoaderClient::featuresUsedInPage(WebPage* page, const Vector<String>& features)
+{
+    if (!m_client.featuresUsedInPage)
+        return;
+
+    Vector<RefPtr<APIObject> > featureStringObjectsVector;
+
+    Vector<String>::const_iterator end = features.end();
+    for (Vector<String>::const_iterator it = features.begin(); it != end; ++it)
+        featureStringObjectsVector.append(WebString::create((*it)));
+
+    RefPtr<ImmutableArray> featureStringObjectsArray = ImmutableArray::adopt(featureStringObjectsVector);
+
+    return m_client.featuresUsedInPage(toAPI(page), toAPI(featureStringObjectsArray.get()), m_client.clientInfo);
+}
+
 } // namespace WebKit

Modified: tags/Safari-537.35.6/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.h (147455 => 147456)


--- tags/Safari-537.35.6/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.h	2013-04-02 17:53:26 UTC (rev 147455)
+++ tags/Safari-537.35.6/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.h	2013-04-02 17:58:16 UTC (rev 147456)
@@ -32,6 +32,7 @@
 #include <_javascript_Core/JSBase.h>
 #include <WebCore/LayoutMilestones.h>
 #include <wtf/Forward.h>
+#include <wtf/Vector.h>
 
 namespace WebCore {
 class DOMWindowExtension;
@@ -83,6 +84,8 @@
     void willDestroyGlobalObjectForDOMWindowExtension(WebPage*, WebCore::DOMWindowExtension*);
 
     bool shouldForceUniversalAccessFromLocalURL(WebPage*, const String& url);
+
+    void featuresUsedInPage(WebPage*, const Vector<String>&);
 };
 
 } // namespace WebKit

Modified: tags/Safari-537.35.6/Source/WebKit2/WebProcess/WebPage/WebPage.cpp (147455 => 147456)


--- tags/Safari-537.35.6/Source/WebKit2/WebProcess/WebPage/WebPage.cpp	2013-04-02 17:53:26 UTC (rev 147455)
+++ tags/Safari-537.35.6/Source/WebKit2/WebProcess/WebPage/WebPage.cpp	2013-04-02 17:58:16 UTC (rev 147456)
@@ -791,6 +791,10 @@
 
     m_isClosed = true;
 
+    // If there is still no URL, then we never loaded anything in this page, so nothing to report.
+    if (!mainWebFrame()->url().isEmpty())
+        reportUsedFeatures();
+
     if (pageGroup()->isVisibleToInjectedBundle() && WebProcess::shared().injectedBundle())
         WebProcess::shared().injectedBundle()->willDestroyPage(this);
 
@@ -3872,6 +3876,11 @@
 
 void WebPage::didCommitLoad(WebFrame* frame)
 {
+    // If previous URL is invalid, then it's not a real page that's being navigated away from.
+    // Most likely, this is actually the first load to be committed in this page.
+    if (frame->isMainFrame() && frame->coreFrame()->loader()->previousURL().isValid())
+        reportUsedFeatures();
+
     // Only restore the scale factor for standard frame loads (of the main frame).
     if (frame->isMainFrame() && frame->coreFrame()->loader()->loadType() == FrameLoadTypeStandard) {
         Page* page = frame->coreFrame()->page();
@@ -4000,4 +4009,15 @@
     return frame->selection()->toNormalizedRange();
 }
 
+void WebPage::reportUsedFeatures()
+{
+    // FIXME: Feature names should not be hardcoded.
+    const BitVector* features = m_page->featureObserver()->accumulatedFeatureBits();
+    Vector<String> namedFeatures;
+    if (features && features->quickGet(FeatureObserver::SharedWorkerStart))
+        namedFeatures.append("SharedWorker");
+
+    m_loaderClient.featuresUsedInPage(this, namedFeatures);
+}
+
 } // namespace WebKit

Modified: tags/Safari-537.35.6/Source/WebKit2/WebProcess/WebPage/WebPage.h (147455 => 147456)


--- tags/Safari-537.35.6/Source/WebKit2/WebProcess/WebPage/WebPage.h	2013-04-02 17:53:26 UTC (rev 147455)
+++ tags/Safari-537.35.6/Source/WebKit2/WebProcess/WebPage/WebPage.h	2013-04-02 17:58:16 UTC (rev 147456)
@@ -832,6 +832,8 @@
     static PluginView* focusedPluginViewForFrame(WebCore::Frame*);
     static PluginView* pluginViewForFrame(WebCore::Frame*);
 
+    void reportUsedFeatures();
+
     OwnPtr<WebCore::Page> m_page;
     RefPtr<WebFrame> m_mainFrame;
     RefPtr<InjectedBundleBackForwardList> m_backForwardList;

Modified: tags/Safari-537.35.6/Tools/ChangeLog (147455 => 147456)


--- tags/Safari-537.35.6/Tools/ChangeLog	2013-04-02 17:53:26 UTC (rev 147455)
+++ tags/Safari-537.35.6/Tools/ChangeLog	2013-04-02 17:58:16 UTC (rev 147456)
@@ -1,3 +1,17 @@
+2013-04-01  Lucas Forschler  <[email protected]>
+
+        Merge r147260
+
+    2013-03-29  Alexey Proskuryakov  <[email protected]>
+
+            Expose FeatureObserver data to WebKit clients
+            https://bugs.webkit.org/show_bug.cgi?id=113613
+
+            Reviewed by Sam Weinig.
+
+            * WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp:
+            (WTR::InjectedBundlePage::InjectedBundlePage): Added an initializer for featuresUsedInPage.
+
 2013-03-19  Tony Chang  <[email protected]>
 
         Move testRunner.setTouchDragDropEnabled to internals.settings

Modified: tags/Safari-537.35.6/Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp (147455 => 147456)


--- tags/Safari-537.35.6/Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp	2013-04-02 17:53:26 UTC (rev 147455)
+++ tags/Safari-537.35.6/Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp	2013-04-02 17:58:16 UTC (rev 147456)
@@ -322,6 +322,7 @@
         0, // didReceiveIntentForFrame
         0, // registerIntentServiceForFrame
         0, // didLayout
+        0, // featuresUsedInPage
     };
     WKBundlePageSetPageLoaderClient(m_page, &loaderClient);
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to