[WK] Add missing ENABLE(NETWORK_CACHE) build guards
authorzandobersek@gmail.com <zandobersek@gmail.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 22 Aug 2017 06:31:49 +0000 (06:31 +0000)
committerzandobersek@gmail.com <zandobersek@gmail.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 22 Aug 2017 06:31:49 +0000 (06:31 +0000)
https://bugs.webkit.org/show_bug.cgi?id=175769

Reviewed by Carlos Alberto Lopez Perez.

Given that the build guard exists, it should be possible to
compile the WebKit layer with the feature disabled. Missing
guards are added in order to achieve that.

* NetworkProcess/NetworkConnectionToWebProcess.cpp:
* NetworkProcess/NetworkConnectionToWebProcess.h:
* NetworkProcess/NetworkConnectionToWebProcess.messages.in:
* NetworkProcess/NetworkProcess.h:
* NetworkProcess/NetworkResourceLoader.cpp:
(WebKit::NetworkResourceLoader::NetworkResourceLoader):
* NetworkProcess/soup/NetworkProcessSoup.cpp:
(WebKit::NetworkProcess::platformInitializeNetworkProcess):
(WebKit::NetworkProcess::clearDiskCache):
* UIProcess/soup/WebProcessPoolSoup.cpp:
(WebKit::WebProcessPool::platformInitializeNetworkProcess):
* WebProcess/Network/WebLoaderStrategy.cpp:
(WebKit::WebLoaderStrategy::storeDerivedDataToCache):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@221005 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebKit/ChangeLog
Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.cpp
Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.h
Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.messages.in
Source/WebKit/NetworkProcess/NetworkProcess.h
Source/WebKit/NetworkProcess/NetworkResourceLoader.cpp
Source/WebKit/NetworkProcess/soup/NetworkProcessSoup.cpp
Source/WebKit/UIProcess/soup/WebProcessPoolSoup.cpp
Source/WebKit/WebProcess/Network/WebLoaderStrategy.cpp

index 48c37956bf4443863744640f2809db6f91e357b1..5f450b46debe07f5745110988238bd4176a06db0 100644 (file)
@@ -1,3 +1,28 @@
+2017-08-21  Zan Dobersek  <zdobersek@igalia.com>
+
+        [WK] Add missing ENABLE(NETWORK_CACHE) build guards
+        https://bugs.webkit.org/show_bug.cgi?id=175769
+
+        Reviewed by Carlos Alberto Lopez Perez.
+
+        Given that the build guard exists, it should be possible to
+        compile the WebKit layer with the feature disabled. Missing
+        guards are added in order to achieve that.
+
+        * NetworkProcess/NetworkConnectionToWebProcess.cpp:
+        * NetworkProcess/NetworkConnectionToWebProcess.h:
+        * NetworkProcess/NetworkConnectionToWebProcess.messages.in:
+        * NetworkProcess/NetworkProcess.h:
+        * NetworkProcess/NetworkResourceLoader.cpp:
+        (WebKit::NetworkResourceLoader::NetworkResourceLoader):
+        * NetworkProcess/soup/NetworkProcessSoup.cpp:
+        (WebKit::NetworkProcess::platformInitializeNetworkProcess):
+        (WebKit::NetworkProcess::clearDiskCache):
+        * UIProcess/soup/WebProcessPoolSoup.cpp:
+        (WebKit::WebProcessPool::platformInitializeNetworkProcess):
+        * WebProcess/Network/WebLoaderStrategy.cpp:
+        (WebKit::WebLoaderStrategy::storeDerivedDataToCache):
+
 2017-08-21  Chris Dumez  <cdumez@apple.com>
 
         [Beacon] Content extensions should be able to intercept Beacon / Ping redirects
index ce465ba2711707e7d2a2eb35b1dc90d4aa48725d..0e77f7a42301f79078e5a9d3b1afa9f23a03ae6c 100644 (file)
@@ -431,11 +431,13 @@ void NetworkConnectionToWebProcess::writeBlobsToTemporaryFiles(const Vector<Stri
     });
 }
 
+#if ENABLE(NETWORK_CACHE)
 void NetworkConnectionToWebProcess::storeDerivedDataToCache(const WebKit::NetworkCache::DataKey& dataKey, const IPC::DataReference& data)
 {
     if (auto* cache = NetworkProcess::singleton().cache())
         cache->storeData(dataKey, data.data(), data.size());
 }
+#endif
 
 void NetworkConnectionToWebProcess::setCaptureExtraNetworkLoadMetricsEnabled(bool enabled)
 {
index 2dd1f81d53159548abbe5d07c0b34daac4a56d18..07e3cc34099a66ebed79dfa6181b7a576d513079 100644 (file)
@@ -112,7 +112,9 @@ private:
     void unregisterBlobURL(const WebCore::URL&);
     void writeBlobsToTemporaryFiles(const Vector<String>& blobURLs, uint64_t requestIdentifier);
 
+#if ENABLE(NETWORK_CACHE)
     void storeDerivedDataToCache(const WebKit::NetworkCache::DataKey&, const IPC::DataReference&);
+#endif
 
     void setCaptureExtraNetworkLoadMetricsEnabled(bool);
 
index fb9607554fc71ff8c648a0cf7721f01992a3b7c8..2185ca41d9cfbd67a276358fc2bca62bd2a490df 100644 (file)
@@ -49,7 +49,9 @@ messages -> NetworkConnectionToWebProcess LegacyReceiver {
     BlobSize(WebCore::URL url) -> (uint64_t resultSize)
     WriteBlobsToTemporaryFiles(Vector<String> blobURLs, uint64_t requestIdentifier)
 
+#if ENABLE(NETWORK_CACHE)
     StoreDerivedDataToCache(WebKit::NetworkCache::DataKey key, IPC::DataReference data)
+#endif
 
     SetCaptureExtraNetworkLoadMetricsEnabled(bool enabled)
 
index a0ecc10adbbdbc800c43963932a7fc5d7ae4807d..49b866bb9b00dd70e9a9a8934fccaf9dc3c6a6af 100644 (file)
@@ -94,7 +94,9 @@ public:
     AuthenticationManager& authenticationManager();
     DownloadManager& downloadManager();
 
+#if ENABLE(NETWORK_CACHE)
     NetworkCache::Cache* cache() { return m_cache.get(); }
+#endif
 
     bool canHandleHTTPSServerTrustEvaluation() const { return m_canHandleHTTPSServerTrustEvaluation; }
 
@@ -230,7 +232,9 @@ private:
     bool m_canHandleHTTPSServerTrustEvaluation;
     Seconds m_loadThrottleLatency;
 
+#if ENABLE(NETWORK_CACHE)
     RefPtr<NetworkCache::Cache> m_cache;
+#endif
 
     typedef HashMap<const char*, std::unique_ptr<NetworkProcessSupplement>, PtrHash<const char*>> NetworkProcessSupplementMap;
     NetworkProcessSupplementMap m_supplements;
index f68747b28441a462a1045d32124ee7e8f3cd9446..187426032d2bebd40b254ff1c909d614f808df48 100644 (file)
@@ -86,7 +86,9 @@ NetworkResourceLoader::NetworkResourceLoader(const NetworkResourceLoadParameters
     , m_connection(connection)
     , m_defersLoading(parameters.defersLoading)
     , m_bufferingTimer(*this, &NetworkResourceLoader::bufferingTimerFired)
+#if ENABLE(NETWORK_CACHE)
     , m_cache(sessionID().isEphemeral() ? nullptr : NetworkProcess::singleton().cache())
+#endif
 {
     ASSERT(RunLoop::isMain());
     // FIXME: This is necessary because of the existence of EmptyFrameLoaderClient in WebCore.
index bd4f629193fd2a5a4f1945fb3bc95b85ec5417a8..7857fc7bc1cd96d720685da26dea1f5558a148d6 100644 (file)
@@ -112,6 +112,7 @@ void NetworkProcess::platformInitializeNetworkProcess(const NetworkProcessCreati
 
     SoupNetworkSession::clearOldSoupCache(WebCore::directoryName(m_diskCacheDirectory));
 
+#if ENABLE(NETWORK_CACHE)
     OptionSet<NetworkCache::Cache::Option> cacheOptions { NetworkCache::Cache::Option::RegisterNotify };
     if (parameters.shouldEnableNetworkCacheEfficacyLogging)
         cacheOptions |= NetworkCache::Cache::Option::EfficacyLogging;
@@ -121,6 +122,7 @@ void NetworkProcess::platformInitializeNetworkProcess(const NetworkProcessCreati
 #endif
 
     m_cache = NetworkCache::Cache::open(m_diskCacheDirectory, cacheOptions);
+#endif
 
     if (!parameters.cookiePersistentStoragePath.isEmpty()) {
         supplement<WebCookieManager>()->setCookiePersistentStorage(parameters.cookiePersistentStoragePath,
@@ -158,9 +160,14 @@ void NetworkProcess::clearCacheForAllOrigins(uint32_t cachesToClear)
 
 void NetworkProcess::clearDiskCache(std::chrono::system_clock::time_point modifiedSince, Function<void ()>&& completionHandler)
 {
+#if ENABLE(NETWORK_CACHE)
     if (!m_cache)
         return;
     m_cache->clear(modifiedSince, WTFMove(completionHandler));
+#else
+    UNUSED_PARAM(modifiedSince);
+    UNUSED_PARAM(completionHandler);
+#endif
 }
 
 void NetworkProcess::platformTerminate()
index 1c1bb369710477eed3bf63282b434da7ca05f76e..48fdb0813c57ecc87c72e44c3d71d11b7362e37b 100644 (file)
@@ -42,7 +42,9 @@ void WebProcessPool::platformInitializeNetworkProcess(NetworkProcessCreationPara
     parameters.cookieAcceptPolicy = m_initialHTTPCookieAcceptPolicy;
     parameters.ignoreTLSErrors = m_ignoreTLSErrors;
     parameters.languages = WebCore::userPreferredLanguages();
+#if ENABLE(NETWORK_CACHE)
     parameters.shouldEnableNetworkCacheEfficacyLogging = false;
+#endif
     parameters.proxySettings = m_networkProxySettings;
 }
 
index 05b8014a7975c11375507d4ec86c0faf09e2368a..1f0a213c2c00c27c900eaac28fcc89df07d3dd81 100644 (file)
@@ -461,9 +461,16 @@ void WebLoaderStrategy::didFinishPingLoad(uint64_t pingLoadIdentifier, ResourceE
 
 void WebLoaderStrategy::storeDerivedDataToCache(const SHA1::Digest& bodyHash, const String& type, const String& partition, WebCore::SharedBuffer& data)
 {
+#if ENABLE(NETWORK_CACHE)
     NetworkCache::DataKey key { partition, type, bodyHash };
     IPC::SharedBufferDataReference dataReference { &data };
     WebProcess::singleton().networkConnection().connection().send(Messages::NetworkConnectionToWebProcess::StoreDerivedDataToCache(key, dataReference), 0);
+#else
+    UNUSED_PARAM(bodyHash);
+    UNUSED_PARAM(type);
+    UNUSED_PARAM(partition);
+    UNUSED_PARAM(data);
+#endif
 }
 
 void WebLoaderStrategy::setCaptureExtraNetworkLoadMetricsEnabled(bool enabled)