Changeset 161272 in webkit


Ignore:
Timestamp:
Jan 3, 2014 11:13:38 AM (10 years ago)
Author:
Carlos Garcia Campos
Message:

Define WebProcess::usesNetworkProcess unconditionally
https://bugs.webkit.org/show_bug.cgi?id=126208

Reviewed by Martin Robinson.

Returning false when network process is not enabled like
WebContext does. This way we reduce the amount of ifdefs used when
checking whether network process is in use.

  • UIProcess/gtk/WebContextGtk.cpp:

(WebKit::WebContext::platformInitializeWebProcess): Remove #ifdef
and only setup network features when not using network process.

  • WebProcess/WebCoreSupport/WebPlatformStrategies.cpp:

(WebKit::WebPlatformStrategies::isAvailable): Remove #ifdef.

  • WebProcess/WebProcess.cpp:

(WebKit::WebProcess::downloadManager):
(WebKit::WebProcess::shouldTerminate):
(WebKit::WebProcess::usesNetworkProcess):

  • WebProcess/WebProcess.h:
  • WebProcess/mac/WebProcessMac.mm:

(WebKit::WebProcess::platformSetCacheModel): Remove #ifdef.
(WebKit::WebProcess::platformInitializeWebProcess): Ditto.

  • WebProcess/soup/WebProcessSoup.cpp:

(WebKit::WebProcess::platformSetCacheModel): Ditto.
(WebKit::WebProcess::platformClearResourceCaches): Ditto.
(WebKit::WebProcess::platformInitializeWebProcess): Ditto.
(WebKit::WebProcess::platformTerminate): Only remove the language
observer when not using network process.
(WebKit::WebProcess::setIgnoreTLSErrors): Assert when this is
called with network process enabled.
(WebKit::WebProcess::allowSpecificHTTPSCertificateForHost): Ditto.

Location:
trunk/Source/WebKit2
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit2/ChangeLog

    r161271 r161272  
     12014-01-03  Carlos Garcia Campos  <cgarcia@igalia.com>
     2
     3        Define WebProcess::usesNetworkProcess unconditionally
     4        https://bugs.webkit.org/show_bug.cgi?id=126208
     5
     6        Reviewed by Martin Robinson.
     7
     8        Returning false when network process is not enabled like
     9        WebContext does. This way we reduce the amount of ifdefs used when
     10        checking whether network process is in use.
     11
     12        * UIProcess/gtk/WebContextGtk.cpp:
     13        (WebKit::WebContext::platformInitializeWebProcess): Remove #ifdef
     14        and only setup network features when not using network process.
     15        * WebProcess/WebCoreSupport/WebPlatformStrategies.cpp:
     16        (WebKit::WebPlatformStrategies::isAvailable): Remove #ifdef.
     17        * WebProcess/WebProcess.cpp:
     18        (WebKit::WebProcess::downloadManager):
     19        (WebKit::WebProcess::shouldTerminate):
     20        (WebKit::WebProcess::usesNetworkProcess):
     21        * WebProcess/WebProcess.h:
     22        * WebProcess/mac/WebProcessMac.mm:
     23        (WebKit::WebProcess::platformSetCacheModel): Remove #ifdef.
     24        (WebKit::WebProcess::platformInitializeWebProcess): Ditto.
     25        * WebProcess/soup/WebProcessSoup.cpp:
     26        (WebKit::WebProcess::platformSetCacheModel): Ditto.
     27        (WebKit::WebProcess::platformClearResourceCaches): Ditto.
     28        (WebKit::WebProcess::platformInitializeWebProcess): Ditto.
     29        (WebKit::WebProcess::platformTerminate): Only remove the language
     30        observer when not using network process.
     31        (WebKit::WebProcess::setIgnoreTLSErrors): Assert when this is
     32        called with network process enabled.
     33        (WebKit::WebProcess::allowSpecificHTTPSCertificateForHost): Ditto.
     34
    1352014-01-03  Jinwoo Song  <jinwoo7.song@samsung.com>
    236
  • trunk/Source/WebKit2/UIProcess/gtk/WebContextGtk.cpp

    r160364 r161272  
    9999    }
    100100
    101     parameters.urlSchemesRegistered = supplement<WebSoupRequestManagerProxy>()->registeredURISchemes();
    102     supplement<WebCookieManagerProxy>()->getCookiePersistentStorage(parameters.cookiePersistentStoragePath, parameters.cookiePersistentStorageType);
    103     parameters.cookieAcceptPolicy = m_initialHTTPCookieAcceptPolicy;
     101    if (!usesNetworkProcess()) {
     102        parameters.urlSchemesRegistered = supplement<WebSoupRequestManagerProxy>()->registeredURISchemes();
     103
     104        supplement<WebCookieManagerProxy>()->getCookiePersistentStorage(parameters.cookiePersistentStoragePath, parameters.cookiePersistentStorageType);
     105        parameters.cookieAcceptPolicy = m_initialHTTPCookieAcceptPolicy;
     106
     107        parameters.ignoreTLSErrors = m_ignoreTLSErrors;
     108    }
     109
    104110    parameters.shouldTrackVisitedLinks = true;
    105 #if !ENABLE(NETWORK_PROCESS)
    106     parameters.ignoreTLSErrors = m_ignoreTLSErrors;
    107 #endif
    108111}
    109112
  • trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebPlatformStrategies.cpp

    r161045 r161272  
    322322{
    323323    // Shared workers do not work across multiple processes, and using network process is tied to multiple secondary process model.
    324 #if ENABLE(NETWORK_PROCESS)
    325     return !WebProcess::shared().usesNetworkProcess();
    326 #else
    327     return true;
    328 #endif
     324    return !WebProcess::shared().usesNetworkProcess();
    329325}
    330326
  • trunk/Source/WebKit2/WebProcess/WebProcess.cpp

    r161158 r161272  
    469469DownloadManager& WebProcess::downloadManager()
    470470{
    471 #if ENABLE(NETWORK_PROCESS)
    472     ASSERT(!m_usesNetworkProcess);
    473 #endif
     471    ASSERT(!usesNetworkProcess());
    474472
    475473    static NeverDestroyed<DownloadManager> downloadManager(this);
     
    598596{
    599597    ASSERT(m_pageMap.isEmpty());
    600 
    601 #if ENABLE(NETWORK_PROCESS)
    602     ASSERT(m_usesNetworkProcess || !downloadManager().isDownloading());
    603 #else
    604     ASSERT(!downloadManager().isDownloading());
    605 #endif
     598    ASSERT(usesNetworkProcess() || !downloadManager().isDownloading());
    606599
    607600    // FIXME: the ShouldTerminate message should also send termination parameters, such as any session cookies that need to be preserved.
     
    994987}
    995988
     989bool WebProcess::usesNetworkProcess() const
     990{
     991#if ENABLE(NETWORK_PROCESS)
     992    return m_usesNetworkProcess;
     993#else
     994    return false;
     995#endif
     996}
     997
    996998#if ENABLE(NETWORK_PROCESS)
    997999NetworkProcessConnection* WebProcess::networkConnection()
  • trunk/Source/WebKit2/WebProcess/WebProcess.h

    r161148 r161272  
    153153    EventDispatcher& eventDispatcher() { return *m_eventDispatcher; }
    154154
     155    bool usesNetworkProcess() const;
     156
    155157#if ENABLE(NETWORK_PROCESS)
    156158    NetworkProcessConnection* networkConnection();
    157159    void networkProcessConnectionClosed(NetworkProcessConnection*);
    158     bool usesNetworkProcess() const { return m_usesNetworkProcess; }
    159160    WebResourceLoadScheduler& webResourceLoadScheduler();
    160161#endif
  • trunk/Source/WebKit2/WebProcess/mac/WebProcessMac.mm

    r161148 r161272  
    113113    NSURLCache *nsurlCache = [NSURLCache sharedURLCache];
    114114
    115 #if ENABLE(NETWORK_PROCESS)
    116115    // FIXME: Once there is no loading being done in the WebProcess, we should remove this,
    117116    // as calling [NSURLCache sharedURLCache] initializes the cache, which we would rather not do.
    118     if (m_usesNetworkProcess) {
     117    if (usesNetworkProcess()) {
    119118        [nsurlCache setMemoryCapacity:0];
    120119        [nsurlCache setDiskCapacity:0];
    121120        return;
    122121    }
    123 #endif
    124122
    125123    [nsurlCache setMemoryCapacity:urlCacheMemoryCapacity];
     
    163161    // When the network process is enabled, each web process wants a stand-alone
    164162    // NSURLCache, which it can disable to save memory.
    165 #if ENABLE(NETWORK_PROCESS)
    166     if (!m_usesNetworkProcess) {
    167 #endif
     163    if (!usesNetworkProcess()) {
    168164        if (!parameters.diskCacheDirectory.isNull()) {
    169165            [NSURLCache setSharedURLCache:adoptNS([[NSURLCache alloc]
     
    172168                diskPath:parameters.diskCacheDirectory]).get()];
    173169        }
    174 #if ENABLE(NETWORK_PROCESS)
    175     }
    176 #endif
     170    }
    177171
    178172    m_shouldForceScreenFontSubstitution = parameters.shouldForceScreenFontSubstitution;
  • trunk/Source/WebKit2/WebProcess/soup/WebProcessSoup.cpp

    r161156 r161272  
    9494    SoupCache* cache = nullptr;
    9595
    96 #if ENABLE(NETWORK_PROCESS)
    97     if (!m_usesNetworkProcess) {
    98 #endif
    99         SoupSession* session = WebCore::ResourceHandle::defaultSession();
    100         cache = SOUP_CACHE(soup_session_get_feature(session, SOUP_TYPE_CACHE));
     96    if (!usesNetworkProcess()) {
     97        cache = SOUP_CACHE(soup_session_get_feature(WebCore::ResourceHandle::defaultSession(), SOUP_TYPE_CACHE));
    10198        diskFreeSize = getCacheDiskFreeSize(cache) / 1024 / 1024;
    102 #if ENABLE(NETWORK_PROCESS)
    103     }
    104 #endif
     99    }
     100
    105101    uint64_t memSize = getMemorySize();
    106102    calculateCacheSizes(cacheModel, memSize, diskFreeSize,
     
    112108    WebCore::pageCache()->setCapacity(pageCacheCapacity);
    113109
    114 #if ENABLE(NETWORK_PROCESS)
    115     if (!m_usesNetworkProcess) {
    116 #endif
     110    if (!usesNetworkProcess()) {
    117111        if (urlCacheDiskCapacity > soup_cache_get_max_size(cache))
    118112            soup_cache_set_max_size(cache, urlCacheDiskCapacity);
    119 #if ENABLE(NETWORK_PROCESS)
    120     }
    121 #endif
    122     if (urlCacheDiskCapacity > soup_cache_get_max_size(cache))
    123         soup_cache_set_max_size(cache, urlCacheDiskCapacity);
     113    }
    124114}
    125115
     
    130120
    131121    // If we're using the network process then it is the only one that needs to clear the disk cache.
    132 #if ENABLE(NETWORK_PROCESS)
    133     if (m_usesNetworkProcess)
     122    if (usesNetworkProcess())
    134123        return;
    135 #endif
    136     SoupSession* session = WebCore::ResourceHandle::defaultSession();
    137     soup_cache_clear(SOUP_CACHE(soup_session_get_feature(session, SOUP_TYPE_CACHE)));
     124
     125    soup_cache_clear(SOUP_CACHE(soup_session_get_feature(WebCore::ResourceHandle::defaultSession(), SOUP_TYPE_CACHE)));
    138126}
    139127
     
    199187#endif
    200188
    201 #if ENABLE(NETWORK_PROCESS)
    202     if (!m_usesNetworkProcess) {
    203 #endif
    204         ASSERT(!parameters.diskCacheDirectory.isEmpty());
    205         GRefPtr<SoupCache> soupCache = adoptGRef(soup_cache_new(parameters.diskCacheDirectory.utf8().data(), SOUP_CACHE_SINGLE_USER));
    206         soup_session_add_feature(WebCore::ResourceHandle::defaultSession(), SOUP_SESSION_FEATURE(soupCache.get()));
    207         soup_cache_load(soupCache.get());
    208 
    209         if (!parameters.cookiePersistentStoragePath.isEmpty()) {
    210             supplement<WebCookieManager>()->setCookiePersistentStorage(parameters.cookiePersistentStoragePath,
    211                 parameters.cookiePersistentStorageType);
    212         }
    213         supplement<WebCookieManager>()->setHTTPCookieAcceptPolicy(parameters.cookieAcceptPolicy);
    214 #if ENABLE(NETWORK_PROCESS)
    215     }
    216 #endif
     189    if (usesNetworkProcess())
     190        return;
     191
     192    ASSERT(!parameters.diskCacheDirectory.isEmpty());
     193    GRefPtr<SoupCache> soupCache = adoptGRef(soup_cache_new(parameters.diskCacheDirectory.utf8().data(), SOUP_CACHE_SINGLE_USER));
     194    soup_session_add_feature(WebCore::ResourceHandle::defaultSession(), SOUP_SESSION_FEATURE(soupCache.get()));
     195    soup_cache_load(soupCache.get());
     196
     197    if (!parameters.cookiePersistentStoragePath.isEmpty()) {
     198        supplement<WebCookieManager>()->setCookiePersistentStorage(parameters.cookiePersistentStoragePath,
     199            parameters.cookiePersistentStorageType);
     200    }
     201    supplement<WebCookieManager>()->setHTTPCookieAcceptPolicy(parameters.cookieAcceptPolicy);
     202
    217203    if (!parameters.languages.isEmpty())
    218204        setSoupSessionAcceptLanguage(parameters.languages);
     
    228214void WebProcess::platformTerminate()
    229215{
    230     WebCore::removeLanguageChangeObserver(this);
     216    if (!usesNetworkProcess())
     217        WebCore::removeLanguageChangeObserver(this);
    231218}
    232219
    233220void WebProcess::setIgnoreTLSErrors(bool ignoreTLSErrors)
    234221{
     222    ASSERT(!usesNetworkProcess());
    235223    WebCore::ResourceHandle::setIgnoreSSLErrors(ignoreTLSErrors);
    236224}
     
    238226void WebProcess::allowSpecificHTTPSCertificateForHost(const WebCore::CertificateInfo& certificateInfo, const String& host)
    239227{
     228    ASSERT(!usesNetworkProcess());
    240229    WebCore::ResourceHandle::setClientCertificate(host, certificateInfo.certificate());
    241230}
Note: See TracChangeset for help on using the changeset viewer.