Changeset 250424 in webkit


Ignore:
Timestamp:
Sep 27, 2019 8:55:01 AM (5 years ago)
Author:
achristensen@apple.com
Message:

Enable and disable ResourceLoadStatistics only by session
https://bugs.webkit.org/show_bug.cgi?id=202298

Reviewed by Chris Dumez.

This is needed to keep per-session things per-session and per-process-pool things per-process-pool.
This was a strange case where we would take the current session's value and apply it globally.
This has no change in behavior because it is globally enabled and disabled by API clients anyways.

  • NetworkProcess/NetworkProcess.cpp:

(WebKit::NetworkProcess::setResourceLoadStatisticsEnabled):

  • NetworkProcess/NetworkProcess.h:
  • NetworkProcess/NetworkProcess.messages.in:
  • UIProcess/API/Cocoa/WKWebView.mm:

(-[WKWebView _initializeWithConfiguration:]):

  • UIProcess/WebProcessPool.cpp:

(WebKit::WebProcessPool::setResourceLoadStatisticsEnabled): Deleted.

  • UIProcess/WebProcessPool.h:
  • UIProcess/WebsiteData/WebsiteDataStore.cpp:

(WebKit::WebsiteDataStore::setResourceLoadStatisticsEnabled):

Location:
trunk/Source/WebKit
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit/ChangeLog

    r250422 r250424  
     12019-09-27  Alex Christensen  <achristensen@webkit.org>
     2
     3        Enable and disable ResourceLoadStatistics only by session
     4        https://bugs.webkit.org/show_bug.cgi?id=202298
     5
     6        Reviewed by Chris Dumez.
     7
     8        This is needed to keep per-session things per-session and per-process-pool things per-process-pool.
     9        This was a strange case where we would take the current session's value and apply it globally.
     10        This has no change in behavior because it is globally enabled and disabled by API clients anyways.
     11
     12        * NetworkProcess/NetworkProcess.cpp:
     13        (WebKit::NetworkProcess::setResourceLoadStatisticsEnabled):
     14        * NetworkProcess/NetworkProcess.h:
     15        * NetworkProcess/NetworkProcess.messages.in:
     16        * UIProcess/API/Cocoa/WKWebView.mm:
     17        (-[WKWebView _initializeWithConfiguration:]):
     18        * UIProcess/WebProcessPool.cpp:
     19        (WebKit::WebProcessPool::setResourceLoadStatisticsEnabled): Deleted.
     20        * UIProcess/WebProcessPool.h:
     21        * UIProcess/WebsiteData/WebsiteDataStore.cpp:
     22        (WebKit::WebsiteDataStore::setResourceLoadStatisticsEnabled):
     23
    1242019-09-27  Alex Christensen  <achristensen@webkit.org>
    225
  • trunk/Source/WebKit/NetworkProcess/NetworkProcess.cpp

    r250422 r250424  
    11511151}
    11521152
    1153 void NetworkProcess::setResourceLoadStatisticsEnabled(bool enabled)
    1154 {
    1155     forEachNetworkSession([enabled](auto& networkSession) {
    1156         networkSession.setResourceLoadStatisticsEnabled(enabled);
    1157     });
     1153void NetworkProcess::setResourceLoadStatisticsEnabled(PAL::SessionID sessionID, bool enabled)
     1154{
     1155    if (auto* networkSession = this->networkSession(sessionID))
     1156        networkSession->setResourceLoadStatisticsEnabled(enabled);
    11581157}
    11591158
  • trunk/Source/WebKit/NetworkProcess/NetworkProcess.h

    r250422 r250424  
    247247    void setIsRunningResourceLoadStatisticsTest(PAL::SessionID, bool value, CompletionHandler<void()>&&);
    248248    void setNotifyPagesWhenTelemetryWasCaptured(PAL::SessionID, bool value, CompletionHandler<void()>&&);
    249     void setResourceLoadStatisticsEnabled(bool);
     249    void setResourceLoadStatisticsEnabled(PAL::SessionID, bool);
    250250    void setResourceLoadStatisticsLogTestingEvent(bool);
    251251    void setResourceLoadStatisticsDebugMode(PAL::SessionID, bool debugMode, CompletionHandler<void()>&&d);
  • trunk/Source/WebKit/NetworkProcess/NetworkProcess.messages.in

    r250422 r250424  
    8787    ClearUserInteraction(PAL::SessionID sessionID, WebCore::RegistrableDomain resourceDomain) -> () Async
    8888    DumpResourceLoadStatistics(PAL::SessionID sessionID) -> (String dumpedStatistics) Async
    89     SetResourceLoadStatisticsEnabled(bool enabled)
     89    SetResourceLoadStatisticsEnabled(PAL::SessionID sessionID, bool enabled)
    9090    SetResourceLoadStatisticsLogTestingEvent(bool enabled)
    9191    UpdatePrevalentDomainsToBlockCookiesFor(PAL::SessionID sessionID, Vector<WebCore::RegistrableDomain> domainsToBlock) -> () Async
  • trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm

    r250405 r250424  
    580580
    581581    WebKit::WebProcessPool& processPool = *[_configuration processPool]->_processPool;
    582     processPool.setResourceLoadStatisticsEnabled(configuration.websiteDataStore._resourceLoadStatisticsEnabled);
    583582
    584583    auto pageConfiguration = [configuration copyPageConfiguration];
  • trunk/Source/WebKit/UIProcess/WebProcessPool.cpp

    r250422 r250424  
    570570    SandboxExtension::createHandleForReadWriteDirectory(parameters.defaultDataStoreParameters.networkSessionParameters.resourceLoadStatisticsDirectory, parameters.defaultDataStoreParameters.networkSessionParameters.resourceLoadStatisticsDirectoryExtensionHandle);
    571571
    572     bool enableResourceLoadStatistics = m_shouldEnableITPForDefaultSessions;
     572    bool enableResourceLoadStatistics = false;
    573573    bool enableResourceLoadStatisticsLogTestingEvent = false;
    574574    bool shouldIncludeLocalhost = true;
     
    616616        }
    617617    } else {
     618        if (WebsiteDataStore::defaultDataStoreExists())
     619            enableResourceLoadStatistics = WebsiteDataStore::defaultDataStore()->resourceLoadStatisticsEnabled();
    618620        auto networkCacheDirectory = WebsiteDataStore::defaultNetworkCacheDirectory();
    619621        parameters.defaultDataStoreParameters.networkSessionParameters.networkCacheDirectory = networkCacheDirectory;
     
    14631465    m_shouldUseFontSmoothing = useFontSmoothing;
    14641466    sendToAllProcesses(Messages::WebProcess::SetShouldUseFontSmoothing(useFontSmoothing));
    1465 }
    1466 
    1467 void WebProcessPool::setResourceLoadStatisticsEnabled(bool enabled)
    1468 {
    1469     m_shouldEnableITPForDefaultSessions = enabled;
    1470     sendToAllProcesses(Messages::WebProcess::SetResourceLoadStatisticsEnabled(enabled));
    1471 #if ENABLE(RESOURCE_LOAD_STATISTICS)
    1472     sendToNetworkingProcess(Messages::NetworkProcess::SetResourceLoadStatisticsEnabled(enabled));
    1473 #endif
    14741467}
    14751468
  • trunk/Source/WebKit/UIProcess/WebProcessPool.h

    r250422 r250424  
    447447    }
    448448
    449     void setResourceLoadStatisticsEnabled(bool);
    450449    void clearResourceLoadStatistics();
    451450
     
    725724    bool m_shouldMakeNextWebProcessLaunchFailForTesting { false };
    726725    bool m_shouldMakeNextNetworkProcessLaunchFailForTesting { false };
    727     bool m_shouldEnableITPForDefaultSessions { false };
    728726
    729727    UserObservablePageCounter m_userObservablePageCounter;
  • trunk/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.cpp

    r250413 r250424  
    18901890        resolveDirectoriesIfNecessary();
    18911891       
    1892         for (auto& processPool : processPools(std::numeric_limits<size_t>::max(), false)) {
    1893             processPool->setResourceLoadStatisticsEnabled(true);
    1894             processPool->sendToNetworkingProcess(Messages::NetworkProcess::SetResourceLoadStatisticsEnabled(true));
    1895         }
    1896         return;
    1897     }
    1898 
    1899     for (auto& processPool : processPools(std::numeric_limits<size_t>::max(), false)) {
    1900         processPool->setResourceLoadStatisticsEnabled(false);
    1901         processPool->sendToNetworkingProcess(Messages::NetworkProcess::SetResourceLoadStatisticsEnabled(false));
    1902     }
     1892        for (auto& processPool : processPools(std::numeric_limits<size_t>::max(), false))
     1893            processPool->sendToNetworkingProcess(Messages::NetworkProcess::SetResourceLoadStatisticsEnabled(m_sessionID, true));
     1894        return;
     1895    }
     1896
     1897    for (auto& processPool : processPools(std::numeric_limits<size_t>::max(), false))
     1898        processPool->sendToNetworkingProcess(Messages::NetworkProcess::SetResourceLoadStatisticsEnabled(m_sessionID, false));
    19031899
    19041900    m_resourceLoadStatisticsEnabled = false;
Note: See TracChangeset for help on using the changeset viewer.