Change NetworkConnectionToWebProcess* to NetworkConnectionToWebProcess& where possible
authorachristensen@apple.com <achristensen@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 30 Jan 2019 01:42:43 +0000 (01:42 +0000)
committerachristensen@apple.com <achristensen@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 30 Jan 2019 01:42:43 +0000 (01:42 +0000)
https://bugs.webkit.org/show_bug.cgi?id=193974

Reviewed by Tim Horton.

* NetworkProcess/FileAPI/NetworkBlobRegistry.cpp:
(WebKit::NetworkBlobRegistry::registerFileBlobURL):
(WebKit::NetworkBlobRegistry::registerBlobURL):
(WebKit::NetworkBlobRegistry::registerBlobURLOptionallyFileBacked):
(WebKit::NetworkBlobRegistry::registerBlobURLForSlice):
(WebKit::NetworkBlobRegistry::unregisterBlobURL):
(WebKit::NetworkBlobRegistry::blobSize):
(WebKit::NetworkBlobRegistry::connectionToWebProcessDidClose):
* NetworkProcess/FileAPI/NetworkBlobRegistry.h:
* NetworkProcess/NetworkConnectionToWebProcess.cpp:
(WebKit::NetworkConnectionToWebProcess::didClose):
(WebKit::NetworkConnectionToWebProcess::registerFileBlobURL):
(WebKit::NetworkConnectionToWebProcess::registerBlobURL):
(WebKit::NetworkConnectionToWebProcess::registerBlobURLFromURL):
(WebKit::NetworkConnectionToWebProcess::registerBlobURLOptionallyFileBacked):
(WebKit::NetworkConnectionToWebProcess::registerBlobURLForSlice):
(WebKit::NetworkConnectionToWebProcess::unregisterBlobURL):
(WebKit::NetworkConnectionToWebProcess::blobSize):
* NetworkProcess/NetworkProcess.cpp:
(WebKit::NetworkProcess::removeNetworkConnectionToWebProcess):
* NetworkProcess/NetworkProcess.h:

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

Source/WebKit/ChangeLog
Source/WebKit/NetworkProcess/FileAPI/NetworkBlobRegistry.cpp
Source/WebKit/NetworkProcess/FileAPI/NetworkBlobRegistry.h
Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.cpp
Source/WebKit/NetworkProcess/NetworkProcess.cpp
Source/WebKit/NetworkProcess/NetworkProcess.h

index 878066d..65e5383 100644 (file)
@@ -1,3 +1,32 @@
+2019-01-29  Alex Christensen  <achristensen@webkit.org>
+
+        Change NetworkConnectionToWebProcess* to NetworkConnectionToWebProcess& where possible
+        https://bugs.webkit.org/show_bug.cgi?id=193974
+
+        Reviewed by Tim Horton.
+
+        * NetworkProcess/FileAPI/NetworkBlobRegistry.cpp:
+        (WebKit::NetworkBlobRegistry::registerFileBlobURL):
+        (WebKit::NetworkBlobRegistry::registerBlobURL):
+        (WebKit::NetworkBlobRegistry::registerBlobURLOptionallyFileBacked):
+        (WebKit::NetworkBlobRegistry::registerBlobURLForSlice):
+        (WebKit::NetworkBlobRegistry::unregisterBlobURL):
+        (WebKit::NetworkBlobRegistry::blobSize):
+        (WebKit::NetworkBlobRegistry::connectionToWebProcessDidClose):
+        * NetworkProcess/FileAPI/NetworkBlobRegistry.h:
+        * NetworkProcess/NetworkConnectionToWebProcess.cpp:
+        (WebKit::NetworkConnectionToWebProcess::didClose):
+        (WebKit::NetworkConnectionToWebProcess::registerFileBlobURL):
+        (WebKit::NetworkConnectionToWebProcess::registerBlobURL):
+        (WebKit::NetworkConnectionToWebProcess::registerBlobURLFromURL):
+        (WebKit::NetworkConnectionToWebProcess::registerBlobURLOptionallyFileBacked):
+        (WebKit::NetworkConnectionToWebProcess::registerBlobURLForSlice):
+        (WebKit::NetworkConnectionToWebProcess::unregisterBlobURL):
+        (WebKit::NetworkConnectionToWebProcess::blobSize):
+        * NetworkProcess/NetworkProcess.cpp:
+        (WebKit::NetworkProcess::removeNetworkConnectionToWebProcess):
+        * NetworkProcess/NetworkProcess.h:
+
 2019-01-29  Youenn Fablet  <youenn@apple.com>
 
         Adopt new SPI to evaluate server certificate trust
index f2cb467..31f2dc4 100644 (file)
@@ -48,36 +48,36 @@ NetworkBlobRegistry::NetworkBlobRegistry()
 {
 }
 
-void NetworkBlobRegistry::registerFileBlobURL(NetworkConnectionToWebProcess* connection, const URL& url, const String& path, RefPtr<SandboxExtension>&& sandboxExtension, const String& contentType)
+void NetworkBlobRegistry::registerFileBlobURL(NetworkConnectionToWebProcess& connection, const URL& url, const String& path, RefPtr<SandboxExtension>&& sandboxExtension, const String& contentType)
 {
     blobRegistry().registerFileBlobURL(url, BlobDataFileReferenceWithSandboxExtension::create(path, WTFMove(sandboxExtension)), contentType);
 
-    ASSERT(!m_blobsForConnection.get(connection).contains(url));
-    BlobForConnectionMap::iterator mapIterator = m_blobsForConnection.find(connection);
+    ASSERT(!m_blobsForConnection.get(&connection).contains(url));
+    BlobForConnectionMap::iterator mapIterator = m_blobsForConnection.find(&connection);
     if (mapIterator == m_blobsForConnection.end())
-        mapIterator = m_blobsForConnection.add(connection, HashSet<URL>()).iterator;
+        mapIterator = m_blobsForConnection.add(&connection, HashSet<URL>()).iterator;
     mapIterator->value.add(url);
 }
 
-void NetworkBlobRegistry::registerBlobURL(NetworkConnectionToWebProcess* connection, const URL& url, Vector<WebCore::BlobPart>&& blobParts, const String& contentType)
+void NetworkBlobRegistry::registerBlobURL(NetworkConnectionToWebProcess& connection, const URL& url, Vector<WebCore::BlobPart>&& blobParts, const String& contentType)
 {
     blobRegistry().registerBlobURL(url, WTFMove(blobParts), contentType);
 
-    ASSERT(!m_blobsForConnection.get(connection).contains(url));
-    BlobForConnectionMap::iterator mapIterator = m_blobsForConnection.find(connection);
+    ASSERT(!m_blobsForConnection.get(&connection).contains(url));
+    BlobForConnectionMap::iterator mapIterator = m_blobsForConnection.find(&connection);
     if (mapIterator == m_blobsForConnection.end())
-        mapIterator = m_blobsForConnection.add(connection, HashSet<URL>()).iterator;
+        mapIterator = m_blobsForConnection.add(&connection, HashSet<URL>()).iterator;
     mapIterator->value.add(url);
 }
 
-void NetworkBlobRegistry::registerBlobURL(NetworkConnectionToWebProcess* connection, const URL& url, const URL& srcURL, bool shouldBypassConnectionCheck)
+void NetworkBlobRegistry::registerBlobURL(NetworkConnectionToWebProcess& connection, const URL& url, const URL& srcURL, bool shouldBypassConnectionCheck)
 {
     // The connection may not be registered if NetworkProcess prevously crashed for any reason.
-    BlobForConnectionMap::iterator mapIterator = m_blobsForConnection.find(connection);
+    BlobForConnectionMap::iterator mapIterator = m_blobsForConnection.find(&connection);
     if (mapIterator == m_blobsForConnection.end()) {
         if (!shouldBypassConnectionCheck)
             return;
-        mapIterator = m_blobsForConnection.add(connection, HashSet<URL>()).iterator;
+        mapIterator = m_blobsForConnection.add(&connection, HashSet<URL>()).iterator;
     }
 
     blobRegistry().registerBlobURL(url, srcURL);
@@ -86,21 +86,21 @@ void NetworkBlobRegistry::registerBlobURL(NetworkConnectionToWebProcess* connect
     mapIterator->value.add(url);
 }
 
-void NetworkBlobRegistry::registerBlobURLOptionallyFileBacked(NetworkConnectionToWebProcess* connection, const URL& url, const URL& srcURL, const String& fileBackedPath, const String& contentType)
+void NetworkBlobRegistry::registerBlobURLOptionallyFileBacked(NetworkConnectionToWebProcess& connection, const URL& url, const URL& srcURL, const String& fileBackedPath, const String& contentType)
 {
     blobRegistry().registerBlobURLOptionallyFileBacked(url, srcURL, BlobDataFileReferenceWithSandboxExtension::create(fileBackedPath, nullptr), contentType);
 
-    ASSERT(!m_blobsForConnection.get(connection).contains(url));
-    BlobForConnectionMap::iterator mapIterator = m_blobsForConnection.find(connection);
+    ASSERT(!m_blobsForConnection.get(&connection).contains(url));
+    BlobForConnectionMap::iterator mapIterator = m_blobsForConnection.find(&connection);
     if (mapIterator == m_blobsForConnection.end())
-        mapIterator = m_blobsForConnection.add(connection, HashSet<URL>()).iterator;
+        mapIterator = m_blobsForConnection.add(&connection, HashSet<URL>()).iterator;
     mapIterator->value.add(url);
 }
 
-void NetworkBlobRegistry::registerBlobURLForSlice(NetworkConnectionToWebProcess* connection, const URL& url, const URL& srcURL, int64_t start, int64_t end)
+void NetworkBlobRegistry::registerBlobURLForSlice(NetworkConnectionToWebProcess& connection, const URL& url, const URL& srcURL, int64_t start, int64_t end)
 {
     // The connection may not be registered if NetworkProcess prevously crashed for any reason.
-    BlobForConnectionMap::iterator mapIterator = m_blobsForConnection.find(connection);
+    BlobForConnectionMap::iterator mapIterator = m_blobsForConnection.find(&connection);
     if (mapIterator == m_blobsForConnection.end())
         return;
 
@@ -110,10 +110,10 @@ void NetworkBlobRegistry::registerBlobURLForSlice(NetworkConnectionToWebProcess*
     mapIterator->value.add(url);
 }
 
-void NetworkBlobRegistry::unregisterBlobURL(NetworkConnectionToWebProcess* connection, const URL& url)
+void NetworkBlobRegistry::unregisterBlobURL(NetworkConnectionToWebProcess& connection, const URL& url)
 {
     // The connection may not be registered if NetworkProcess prevously crashed for any reason.
-    BlobForConnectionMap::iterator mapIterator = m_blobsForConnection.find(connection);
+    BlobForConnectionMap::iterator mapIterator = m_blobsForConnection.find(&connection);
     if (mapIterator == m_blobsForConnection.end())
         return;
 
@@ -122,9 +122,9 @@ void NetworkBlobRegistry::unregisterBlobURL(NetworkConnectionToWebProcess* conne
     mapIterator->value.remove(url);
 }
 
-uint64_t NetworkBlobRegistry::blobSize(NetworkConnectionToWebProcess* connection, const URL& url)
+uint64_t NetworkBlobRegistry::blobSize(NetworkConnectionToWebProcess& connection, const URL& url)
 {
-    if (!m_blobsForConnection.contains(connection) || !m_blobsForConnection.find(connection)->value.contains(url))
+    if (!m_blobsForConnection.contains(&connection) || !m_blobsForConnection.find(&connection)->value.contains(url))
         return 0;
 
     return blobRegistry().blobSize(url);
@@ -154,16 +154,16 @@ void NetworkBlobRegistry::writeBlobToFilePath(const URL& blobURL, const String&
     });
 }
 
-void NetworkBlobRegistry::connectionToWebProcessDidClose(NetworkConnectionToWebProcess* connection)
+void NetworkBlobRegistry::connectionToWebProcessDidClose(NetworkConnectionToWebProcess& connection)
 {
-    if (!m_blobsForConnection.contains(connection))
+    if (!m_blobsForConnection.contains(&connection))
         return;
 
-    HashSet<URL>& blobsForConnection = m_blobsForConnection.find(connection)->value;
+    HashSet<URL>& blobsForConnection = m_blobsForConnection.find(&connection)->value;
     for (HashSet<URL>::iterator iter = blobsForConnection.begin(), end = blobsForConnection.end(); iter != end; ++iter)
         blobRegistry().unregisterBlobURL(*iter);
 
-    m_blobsForConnection.remove(connection);
+    m_blobsForConnection.remove(&connection);
 }
 
 Vector<RefPtr<BlobDataFileReference>> NetworkBlobRegistry::filesInBlob(NetworkConnectionToWebProcess& connection, const URL& url)
index 60625fa..74d61bb 100644 (file)
@@ -46,17 +46,17 @@ public:
     NetworkBlobRegistry();
     static NetworkBlobRegistry& singleton();
 
-    void registerFileBlobURL(NetworkConnectionToWebProcess*, const URL&, const String& path, RefPtr<SandboxExtension>&&, const String& contentType);
-    void registerBlobURL(NetworkConnectionToWebProcess*, const URL&, Vector<WebCore::BlobPart>&&, const String& contentType);
-    void registerBlobURL(NetworkConnectionToWebProcess*, const URL&, const URL& srcURL, bool shouldBypassConnectionCheck);
-    void registerBlobURLOptionallyFileBacked(NetworkConnectionToWebProcess*, const URL&, const URL& srcURL, const String& fileBackedPath, const String& contentType);
-    void registerBlobURLForSlice(NetworkConnectionToWebProcess*, const URL&, const URL& srcURL, int64_t start, int64_t end);
-    void unregisterBlobURL(NetworkConnectionToWebProcess*, const URL&);
-    uint64_t blobSize(NetworkConnectionToWebProcess*, const URL&);
+    void registerFileBlobURL(NetworkConnectionToWebProcess&, const URL&, const String& path, RefPtr<SandboxExtension>&&, const String& contentType);
+    void registerBlobURL(NetworkConnectionToWebProcess&, const URL&, Vector<WebCore::BlobPart>&&, const String& contentType);
+    void registerBlobURL(NetworkConnectionToWebProcess&, const URL&, const URL& srcURL, bool shouldBypassConnectionCheck);
+    void registerBlobURLOptionallyFileBacked(NetworkConnectionToWebProcess&, const URL&, const URL& srcURL, const String& fileBackedPath, const String& contentType);
+    void registerBlobURLForSlice(NetworkConnectionToWebProcess&, const URL&, const URL& srcURL, int64_t start, int64_t end);
+    void unregisterBlobURL(NetworkConnectionToWebProcess&, const URL&);
+    uint64_t blobSize(NetworkConnectionToWebProcess&, const URL&);
     void writeBlobsToTemporaryFiles(const Vector<String>& blobURLs, CompletionHandler<void(Vector<String>&&)>&&);
     void writeBlobToFilePath(const URL& blobURL, const String& path, CompletionHandler<void(bool success)>&&);
 
-    void connectionToWebProcessDidClose(NetworkConnectionToWebProcess*);
+    void connectionToWebProcessDidClose(NetworkConnectionToWebProcess&);
 
     Vector<RefPtr<WebCore::BlobDataFileReference>> filesInBlob(NetworkConnectionToWebProcess&, const URL&);
     Vector<RefPtr<WebCore::BlobDataFileReference>> filesInBlob(const URL&);
index 2fd7afd..5db4b6d 100644 (file)
@@ -249,8 +249,8 @@ void NetworkConnectionToWebProcess::didClose(IPC::Connection& connection)
     // root activity trackers.
     stopAllNetworkActivityTracking();
 
-    NetworkBlobRegistry::singleton().connectionToWebProcessDidClose(this);
-    m_networkProcess->removeNetworkConnectionToWebProcess(this);
+    NetworkBlobRegistry::singleton().connectionToWebProcessDidClose(*this);
+    m_networkProcess->removeNetworkConnectionToWebProcess(*this);
 
 #if USE(LIBWEBRTC)
     if (m_rtcProvider) {
@@ -495,37 +495,37 @@ void NetworkConnectionToWebProcess::registerFileBlobURL(const URL& url, const St
 {
     RefPtr<SandboxExtension> extension = SandboxExtension::create(WTFMove(extensionHandle));
 
-    NetworkBlobRegistry::singleton().registerFileBlobURL(this, url, path, WTFMove(extension), contentType);
+    NetworkBlobRegistry::singleton().registerFileBlobURL(*this, url, path, WTFMove(extension), contentType);
 }
 
 void NetworkConnectionToWebProcess::registerBlobURL(const URL& url, Vector<BlobPart>&& blobParts, const String& contentType)
 {
-    NetworkBlobRegistry::singleton().registerBlobURL(this, url, WTFMove(blobParts), contentType);
+    NetworkBlobRegistry::singleton().registerBlobURL(*this, url, WTFMove(blobParts), contentType);
 }
 
 void NetworkConnectionToWebProcess::registerBlobURLFromURL(const URL& url, const URL& srcURL, bool shouldBypassConnectionCheck)
 {
-    NetworkBlobRegistry::singleton().registerBlobURL(this, url, srcURL, shouldBypassConnectionCheck);
+    NetworkBlobRegistry::singleton().registerBlobURL(*this, url, srcURL, shouldBypassConnectionCheck);
 }
 
 void NetworkConnectionToWebProcess::registerBlobURLOptionallyFileBacked(const URL& url, const URL& srcURL, const String& fileBackedPath, const String& contentType)
 {
-    NetworkBlobRegistry::singleton().registerBlobURLOptionallyFileBacked(this, url, srcURL, fileBackedPath, contentType);
+    NetworkBlobRegistry::singleton().registerBlobURLOptionallyFileBacked(*this, url, srcURL, fileBackedPath, contentType);
 }
 
 void NetworkConnectionToWebProcess::registerBlobURLForSlice(const URL& url, const URL& srcURL, int64_t start, int64_t end)
 {
-    NetworkBlobRegistry::singleton().registerBlobURLForSlice(this, url, srcURL, start, end);
+    NetworkBlobRegistry::singleton().registerBlobURLForSlice(*this, url, srcURL, start, end);
 }
 
 void NetworkConnectionToWebProcess::unregisterBlobURL(const URL& url)
 {
-    NetworkBlobRegistry::singleton().unregisterBlobURL(this, url);
+    NetworkBlobRegistry::singleton().unregisterBlobURL(*this, url);
 }
 
 void NetworkConnectionToWebProcess::blobSize(const URL& url, uint64_t& resultSize)
 {
-    resultSize = NetworkBlobRegistry::singleton().blobSize(this, url);
+    resultSize = NetworkBlobRegistry::singleton().blobSize(*this, url);
 }
 
 void NetworkConnectionToWebProcess::writeBlobsToTemporaryFiles(const Vector<String>& blobURLs, CompletionHandler<void(Vector<String>&&)>&& completionHandler)
index fceeea9..ca57c4d 100644 (file)
@@ -184,9 +184,9 @@ NetworkProximityManager& NetworkProcess::proximityManager()
 }
 #endif
 
-void NetworkProcess::removeNetworkConnectionToWebProcess(NetworkConnectionToWebProcess* connection)
+void NetworkProcess::removeNetworkConnectionToWebProcess(NetworkConnectionToWebProcess& connection)
 {
-    size_t vectorIndex = m_webProcessConnections.find(connection);
+    size_t vectorIndex = m_webProcessConnections.find(&connection);
     ASSERT(vectorIndex != notFound);
 
     m_webProcessConnections.remove(vectorIndex);
index 9180234..3a129c5 100644 (file)
@@ -124,7 +124,7 @@ public:
         m_supplements.add(T::supplementName(), std::make_unique<T>(*this));
     }
 
-    void removeNetworkConnectionToWebProcess(NetworkConnectionToWebProcess*);
+    void removeNetworkConnectionToWebProcess(NetworkConnectionToWebProcess&);
 
     AuthenticationManager& authenticationManager();
     DownloadManager& downloadManager();