Changeset 211841 in webkit


Ignore:
Timestamp:
Feb 7, 2017 4:07:02 PM (7 years ago)
Author:
Brent Fulgham
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.

  1. 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:
Location:
trunk/Source/WebKit2
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit2/ChangeLog

    r211838 r211841  
     12017-02-07  Brent Fulgham  <bfulgham@apple.com>
     2
     3        Correct initialization of Resource Load Statistics for use in WebKitTestRunner
     4        https://bugs.webkit.org/show_bug.cgi?id=167960
     5
     6        Reviewed by Andy Estes.
     7
     8        WebKit2 starts up with different process configuration settings depending on the type of
     9        WebView and client application. This led to two problems:
     10        1. Registering the shared resource load observer did not start at UIProcess launch. Instead, it
     11           was lazily initialized as messages from the various WebProcess started getting received. This
     12           is too slow for WebKitTestRunner, which needs this object to be initialized right at launch
     13           time.
     14           
     15           A new 'registerSharedResourceLoadObserver' method was needed, so that the WebProcess can ask
     16           the WebsiteDataStore to register a resource load observer during platform initialization.
     17
     18        2. Some WebView uses do not enable WebsiteDataStore, and should not activate a resource load
     19           statistics observer.
     20
     21        * UIProcess/API/APIWebsiteDataStore.cpp:
     22        (API::WebsiteDataStore::registerSharedResourceLoadObserver): Added.
     23        * UIProcess/API/APIWebsiteDataStore.h:
     24        * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
     25        (WebKit::WebProcessPool::platformInitialize): If the web process is using a WebsiteDataStore,
     26        register a resource load observer.
     27        * UIProcess/WebResourceLoadStatisticsStore.cpp:
     28        (WebKit::WebResourceLoadStatisticsStore::registerSharedResourceLoadObserver): Added.
     29        * UIProcess/WebResourceLoadStatisticsStore.h:
     30        * UIProcess/WebsiteData/WebsiteDataStore.cpp:
     31        (WebKit::WebsiteDataStore::registerSharedResourceLoadObserver): Added.
     32        * UIProcess/WebsiteData/WebsiteDataStore.h:
     33
    1342017-02-07  Anders Carlsson  <andersca@apple.com>
    235
  • trunk/Source/WebKit2/UIProcess/API/APIWebsiteDataStore.cpp

    r199326 r211841  
    11/*
    2  * Copyright (C) 2014, 2016 Apple Inc. All rights reserved.
     2 * Copyright (C) 2014-2017 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    7979    m_websiteDataStore->setResourceLoadStatisticsEnabled(enabled);
    8080}
     81
     82void WebsiteDataStore::registerSharedResourceLoadObserver()
     83{
     84    m_websiteDataStore->registerSharedResourceLoadObserver();
     85}
    8186   
    8287#if !PLATFORM(COCOA) && !PLATFORM(EFL) && !PLATFORM(GTK)
  • trunk/Source/WebKit2/UIProcess/API/APIWebsiteDataStore.h

    r199326 r211841  
    11/*
    2  * Copyright (C) 2014-2016 Apple Inc. All rights reserved.
     2 * Copyright (C) 2014-2017 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    4545    bool resourceLoadStatisticsEnabled() const;
    4646    void setResourceLoadStatisticsEnabled(bool);
     47    void registerSharedResourceLoadObserver();
    4748
    4849    WebKit::WebsiteDataStore& websiteDataStore() { return *m_websiteDataStore; }
  • trunk/Source/WebKit2/UIProcess/Cocoa/WebProcessPoolCocoa.mm

    r210315 r211841  
    11/*
    2  * Copyright (C) 2010 Apple Inc. All rights reserved.
     2 * Copyright (C) 2010-2017 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    146146    WebKit::WebMemoryPressureHandler::singleton();
    147147#endif
     148
     149    if (m_websiteDataStore)
     150        m_websiteDataStore->registerSharedResourceLoadObserver();
    148151}
    149152
  • trunk/Source/WebKit2/UIProcess/WebResourceLoadStatisticsStore.cpp

    r208874 r211841  
    11/*
    2  * Copyright (C) 2016 Apple Inc. All rights reserved.
     2 * Copyright (C) 2016-2017 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    3434#include "WebsiteDataType.h"
    3535#include <WebCore/KeyedCoding.h>
     36#include <WebCore/ResourceLoadObserver.h>
    3637#include <WebCore/ResourceLoadStatistics.h>
    3738#include <wtf/CurrentTime.h>
     
    192193}
    193194
     195void WebResourceLoadStatisticsStore::registerSharedResourceLoadObserver()
     196{
     197    ResourceLoadObserver::sharedObserver().setStatisticsStore(m_resourceStatisticsStore.copyRef());
     198}
     199
    194200void WebResourceLoadStatisticsStore::readDataFromDiskIfNeeded()
    195201{
  • trunk/Source/WebKit2/UIProcess/WebResourceLoadStatisticsStore.h

    r208874 r211841  
    11/*
    2  * Copyright (C) 2016 Apple Inc. All rights reserved.
     2 * Copyright (C) 2016-2017 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    5656    void setResourceLoadStatisticsEnabled(bool);
    5757    bool resourceLoadStatisticsEnabled() const;
     58    void registerSharedResourceLoadObserver();
    5859   
    5960    void resourceLoadStatisticsUpdated(const Vector<WebCore::ResourceLoadStatistics>& origins);
  • trunk/Source/WebKit2/UIProcess/WebsiteData/WebsiteDataStore.cpp

    r208727 r211841  
    11/*
    2  * Copyright (C) 2014-2016 Apple Inc. All rights reserved.
     2 * Copyright (C) 2014-2017 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    11591159}
    11601160
    1161 }
     1161void WebsiteDataStore::registerSharedResourceLoadObserver()
     1162{
     1163    if (!m_resourceLoadStatistics)
     1164        return;
     1165
     1166    m_resourceLoadStatistics->registerSharedResourceLoadObserver();
     1167}
     1168
     1169}
  • trunk/Source/WebKit2/UIProcess/WebsiteData/WebsiteDataStore.h

    r208633 r211841  
    11/*
    2  * Copyright (C) 2014-2016 Apple Inc. All rights reserved.
     2 * Copyright (C) 2014-2017 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    8080    bool resourceLoadStatisticsEnabled() const;
    8181    void setResourceLoadStatisticsEnabled(bool);
     82    void registerSharedResourceLoadObserver();
    8283
    8384    static void cloneSessionData(WebPageProxy& sourcePage, WebPageProxy& newPage);
Note: See TracChangeset for help on using the changeset viewer.