Changeset 241005 in webkit
- Timestamp:
- Feb 5, 2019 5:02:44 PM (5 years ago)
- Location:
- trunk/Source
- Files:
-
- 27 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r240994 r241005 1 2019-02-05 Truitt Savell <tsavell@apple.com> 2 3 Unreviewed, rolling out r240984. 4 5 Revision casued two API timeouts 6 7 Reverted changeset: 8 9 "Stop using blobRegistry in NetworkProcess" 10 https://bugs.webkit.org/show_bug.cgi?id=194027 11 https://trac.webkit.org/changeset/240984 12 1 13 2019-02-05 Keith Rollin <krollin@apple.com> 2 14 -
trunk/Source/WebCore/platform/network/BlobRegistryImpl.h
r240984 r241005 57 57 void writeBlobToFilePath(const URL& blobURL, const String& path, Function<void(bool success)>&& completionHandler); 58 58 59 private: 59 60 void appendStorageItems(BlobData*, const BlobDataItemList&, long long offset, long long length); 60 61 … … 78 79 bool populateBlobsForFileWriting(const Vector<String>& blobURLs, Vector<BlobForFileWriting>&); 79 80 80 private:81 81 HashMap<String, RefPtr<BlobData>> m_blobs; 82 82 }; -
trunk/Source/WebCore/platform/network/FormData.cpp
r240984 r241005 312 312 } 313 313 314 static void appendBlobResolved( BlobRegistry& blobRegistry, FormData&formData, const URL& url)315 { 316 if (!blobRegistry .isBlobRegistryImpl()) {314 static void appendBlobResolved(FormData* formData, const URL& url) 315 { 316 if (!blobRegistry().isBlobRegistryImpl()) { 317 317 LOG_ERROR("Tried to resolve a blob without a usable registry"); 318 318 return; 319 319 } 320 320 321 auto* blobData = static_cast<BlobRegistryImpl&>(blobRegistry).getBlobDataFromURL(url);321 BlobData* blobData = static_cast<BlobRegistryImpl&>(blobRegistry()).getBlobDataFromURL(url); 322 322 if (!blobData) { 323 323 LOG_ERROR("Could not get blob data from a registry"); … … 328 328 if (blobItem.type() == BlobDataItem::Type::Data) { 329 329 ASSERT(blobItem.data().data()); 330 formData .appendData(blobItem.data().data()->data() + static_cast<int>(blobItem.offset()), static_cast<int>(blobItem.length()));330 formData->appendData(blobItem.data().data()->data() + static_cast<int>(blobItem.offset()), static_cast<int>(blobItem.length())); 331 331 } else if (blobItem.type() == BlobDataItem::Type::File) 332 formData .appendFileRange(blobItem.file()->path(), blobItem.offset(), blobItem.length(), blobItem.file()->expectedModificationTime());332 formData->appendFileRange(blobItem.file()->path(), blobItem.offset(), blobItem.length(), blobItem.file()->expectedModificationTime()); 333 333 else 334 334 ASSERT_NOT_REACHED(); … … 336 336 } 337 337 338 Ref<FormData> FormData::resolveBlobReferences( BlobRegistry& blobRegistry)338 Ref<FormData> FormData::resolveBlobReferences() 339 339 { 340 340 // First check if any blobs needs to be resolved, or we can take the fast path. … … 362 362 newFormData->appendFileRange(fileData.filename, fileData.fileStart, fileData.fileLength, fileData.expectedFileModificationTime, fileData.shouldGenerateFile); 363 363 }, [&] (const FormDataElement::EncodedBlobData& blobData) { 364 appendBlobResolved( blobRegistry, newFormData.get(), blobData.url);364 appendBlobResolved(newFormData.ptr(), blobData.url); 365 365 } 366 366 ); -
trunk/Source/WebCore/platform/network/FormData.h
r240984 r241005 30 30 namespace WebCore { 31 31 32 class BlobRegistry;33 32 class DOMFormData; 34 33 class Document; … … 228 227 // Resolve all blob references so we only have file and data. 229 228 // If the FormData has no blob references to resolve, this is returned. 230 WEBCORE_EXPORT Ref<FormData> resolveBlobReferences(BlobRegistry&);229 Ref<FormData> resolveBlobReferences(); 231 230 232 231 bool isEmpty() const { return m_elements.isEmpty(); } -
trunk/Source/WebCore/platform/network/cf/FormDataStreamCFNet.cpp
r240984 r241005 31 31 32 32 #include "BlobData.h" 33 #include "BlobRegistry.h"34 33 #include "FormData.h" 35 34 #include <sys/stat.h> … … 374 373 RetainPtr<CFReadStreamRef> createHTTPBodyCFReadStream(FormData& formData) 375 374 { 376 auto resolvedFormData = formData.resolveBlobReferences( blobRegistry());375 auto resolvedFormData = formData.resolveBlobReferences(); 377 376 378 377 // Precompute the content length so CFNetwork doesn't use chunked mode. -
trunk/Source/WebCore/platform/network/curl/CurlFormDataStream.cpp
r240984 r241005 35 35 #if USE(CURL) 36 36 37 #include "BlobRegistry.h"38 37 #include "CurlContext.h" 39 38 #include "Logging.h" … … 52 51 53 52 // Resolve the blob elements so the formData can correctly report it's size. 54 m_formData = m_formData->resolveBlobReferences( blobRegistry());53 m_formData = m_formData->resolveBlobReferences(); 55 54 } 56 55 -
trunk/Source/WebKit/ChangeLog
r241002 r241005 1 2019-02-05 Truitt Savell <tsavell@apple.com> 2 3 Unreviewed, rolling out r240984. 4 5 Revision casued two API timeouts 6 7 Reverted changeset: 8 9 "Stop using blobRegistry in NetworkProcess" 10 https://bugs.webkit.org/show_bug.cgi?id=194027 11 https://trac.webkit.org/changeset/240984 12 1 13 2019-02-05 Youenn Fablet <youenn@apple.com> 2 14 -
trunk/Source/WebKit/NetworkProcess/Downloads/DownloadManager.cpp
r240990 r241005 28 28 29 29 #include "Download.h" 30 #include "Network ConnectionToWebProcess.h"30 #include "NetworkBlobRegistry.h" 31 31 #include "NetworkLoad.h" 32 32 #include "NetworkSession.h" … … 55 55 parameters.clientCredentialPolicy = ClientCredentialPolicy::MayAskClientForCredentials; 56 56 if (request.url().protocolIsBlob() && connection) 57 parameters.blobFileReferences = connection->filesInBlob(request.url());57 parameters.blobFileReferences = NetworkBlobRegistry::singleton().filesInBlob(*connection, request.url()); 58 58 parameters.storedCredentialsPolicy = sessionID.isEphemeral() ? StoredCredentialsPolicy::DoNotUse : StoredCredentialsPolicy::Use; 59 59 60 m_pendingDownloads.add(downloadID, std::make_unique<PendingDownload>(m_client.parentProcessConnectionForDownloads(), WTFMove(parameters), downloadID, *networkSession, connection ? &connection->blobRegistry() : nullptr,suggestedName));60 m_pendingDownloads.add(downloadID, std::make_unique<PendingDownload>(m_client.parentProcessConnectionForDownloads(), WTFMove(parameters), downloadID, *networkSession, suggestedName)); 61 61 } 62 62 -
trunk/Source/WebKit/NetworkProcess/Downloads/PendingDownload.cpp
r240984 r241005 37 37 using namespace WebCore; 38 38 39 PendingDownload::PendingDownload(IPC::Connection* parentProcessConnection, NetworkLoadParameters&& parameters, DownloadID downloadID, NetworkSession& networkSession, WebCore::BlobRegistryImpl* blobRegistry,const String& suggestedName)40 : m_networkLoad(std::make_unique<NetworkLoad>(*this, blobRegistry,WTFMove(parameters), networkSession))39 PendingDownload::PendingDownload(IPC::Connection* parentProcessConnection, NetworkLoadParameters&& parameters, DownloadID downloadID, NetworkSession& networkSession, const String& suggestedName) 40 : m_networkLoad(std::make_unique<NetworkLoad>(*this, WTFMove(parameters), networkSession)) 41 41 , m_parentProcessConnection(parentProcessConnection) 42 42 { -
trunk/Source/WebKit/NetworkProcess/Downloads/PendingDownload.h
r240984 r241005 35 35 36 36 namespace WebCore { 37 class BlobRegistryImpl;38 37 class ResourceResponse; 39 38 } … … 50 49 WTF_MAKE_FAST_ALLOCATED; 51 50 public: 52 PendingDownload(IPC::Connection*, NetworkLoadParameters&&, DownloadID, NetworkSession&, WebCore::BlobRegistryImpl*,const String& suggestedName);51 PendingDownload(IPC::Connection*, NetworkLoadParameters&&, DownloadID, NetworkSession&, const String& suggestedName); 53 52 PendingDownload(IPC::Connection*, std::unique_ptr<NetworkLoad>&&, ResponseCompletionHandler&&, DownloadID, const WebCore::ResourceRequest&, const WebCore::ResourceResponse&); 54 53 -
trunk/Source/WebKit/NetworkProcess/FileAPI/NetworkBlobRegistry.cpp
r240984 r241005 38 38 using namespace WebCore; 39 39 40 NetworkBlobRegistry::NetworkBlobRegistry() = default; 41 NetworkBlobRegistry::~NetworkBlobRegistry() = default; 40 NetworkBlobRegistry& NetworkBlobRegistry::singleton() 41 { 42 ASSERT(RunLoop::isMain()); 43 static NeverDestroyed<NetworkBlobRegistry> registry; 44 return registry; 45 } 46 47 NetworkBlobRegistry::NetworkBlobRegistry() 48 { 49 } 42 50 43 51 void NetworkBlobRegistry::registerFileBlobURL(NetworkConnectionToWebProcess& connection, const URL& url, const String& path, RefPtr<SandboxExtension>&& sandboxExtension, const String& contentType) 44 52 { 45 m_blobRegistry.registerFileBlobURL(url, BlobDataFileReferenceWithSandboxExtension::create(path, WTFMove(sandboxExtension)), contentType);53 blobRegistry().registerFileBlobURL(url, BlobDataFileReferenceWithSandboxExtension::create(path, WTFMove(sandboxExtension)), contentType); 46 54 47 55 ASSERT(!m_blobsForConnection.get(&connection).contains(url)); … … 54 62 void NetworkBlobRegistry::registerBlobURL(NetworkConnectionToWebProcess& connection, const URL& url, Vector<WebCore::BlobPart>&& blobParts, const String& contentType) 55 63 { 56 m_blobRegistry.registerBlobURL(url, WTFMove(blobParts), contentType);64 blobRegistry().registerBlobURL(url, WTFMove(blobParts), contentType); 57 65 58 66 ASSERT(!m_blobsForConnection.get(&connection).contains(url)); … … 73 81 } 74 82 75 m_blobRegistry.registerBlobURL(url, srcURL);83 blobRegistry().registerBlobURL(url, srcURL); 76 84 77 85 ASSERT(shouldBypassConnectionCheck || mapIterator->value.contains(srcURL)); … … 81 89 void NetworkBlobRegistry::registerBlobURLOptionallyFileBacked(NetworkConnectionToWebProcess& connection, const URL& url, const URL& srcURL, const String& fileBackedPath, const String& contentType) 82 90 { 83 m_blobRegistry.registerBlobURLOptionallyFileBacked(url, srcURL, BlobDataFileReferenceWithSandboxExtension::create(fileBackedPath, nullptr), contentType);91 blobRegistry().registerBlobURLOptionallyFileBacked(url, srcURL, BlobDataFileReferenceWithSandboxExtension::create(fileBackedPath, nullptr), contentType); 84 92 85 93 ASSERT(!m_blobsForConnection.get(&connection).contains(url)); … … 97 105 return; 98 106 99 m_blobRegistry.registerBlobURLForSlice(url, srcURL, start, end);107 blobRegistry().registerBlobURLForSlice(url, srcURL, start, end); 100 108 101 109 ASSERT(mapIterator->value.contains(srcURL)); … … 110 118 return; 111 119 112 m_blobRegistry.unregisterBlobURL(url);120 blobRegistry().unregisterBlobURL(url); 113 121 114 122 mapIterator->value.remove(url); … … 120 128 return 0; 121 129 122 return m_blobRegistry.blobSize(url);130 return blobRegistry().blobSize(url); 123 131 } 124 132 125 133 void NetworkBlobRegistry::writeBlobsToTemporaryFiles(const Vector<String>& blobURLs, CompletionHandler<void(Vector<String>&&)>&& completionHandler) 126 134 { 127 m_blobRegistry.writeBlobsToTemporaryFiles(blobURLs, WTFMove(completionHandler));135 blobRegistry().writeBlobsToTemporaryFiles(blobURLs, WTFMove(completionHandler)); 128 136 } 129 137 130 138 void NetworkBlobRegistry::writeBlobToFilePath(const URL& blobURL, const String& path, CompletionHandler<void(bool success)>&& completionHandler) 131 139 { 132 if (! m_blobRegistry.isBlobRegistryImpl()) {140 if (!blobRegistry().isBlobRegistryImpl()) { 133 141 completionHandler(false); 134 142 ASSERT_NOT_REACHED(); … … 140 148 file->prepareForFileAccess(); 141 149 142 m_blobRegistry.writeBlobToFilePath(blobURL, path, [blobFiles = WTFMove(blobFiles), completionHandler = WTFMove(completionHandler)] (bool success) mutable {150 static_cast<BlobRegistryImpl&>(blobRegistry()).writeBlobToFilePath(blobURL, path, [blobFiles = WTFMove(blobFiles), completionHandler = WTFMove(completionHandler)] (bool success) mutable { 143 151 for (auto& file : blobFiles) 144 152 file->revokeFileAccess(); … … 154 162 HashSet<URL>& blobsForConnection = m_blobsForConnection.find(&connection)->value; 155 163 for (HashSet<URL>::iterator iter = blobsForConnection.begin(), end = blobsForConnection.end(); iter != end; ++iter) 156 m_blobRegistry.unregisterBlobURL(*iter);164 blobRegistry().unregisterBlobURL(*iter); 157 165 158 166 m_blobsForConnection.remove(&connection); … … 169 177 Vector<RefPtr<BlobDataFileReference>> NetworkBlobRegistry::filesInBlob(const URL& url) 170 178 { 171 ASSERT( m_blobRegistry.isBlobRegistryImpl());172 BlobData* blobData = m_blobRegistry.getBlobDataFromURL(url);179 ASSERT(blobRegistry().isBlobRegistryImpl()); 180 BlobData* blobData = static_cast<BlobRegistryImpl&>(blobRegistry()).getBlobDataFromURL(url); 173 181 if (!blobData) 174 182 return { }; -
trunk/Source/WebKit/NetworkProcess/FileAPI/NetworkBlobRegistry.h
r240984 r241005 26 26 #pragma once 27 27 28 #include <WebCore/BlobRegistryImpl.h>29 28 #include <wtf/Function.h> 30 29 #include <wtf/HashMap.h> … … 46 45 public: 47 46 NetworkBlobRegistry(); 48 ~NetworkBlobRegistry();47 static NetworkBlobRegistry& singleton(); 49 48 50 49 void registerFileBlobURL(NetworkConnectionToWebProcess&, const URL&, const String& path, RefPtr<SandboxExtension>&&, const String& contentType); … … 62 61 Vector<RefPtr<WebCore::BlobDataFileReference>> filesInBlob(NetworkConnectionToWebProcess&, const URL&); 63 62 Vector<RefPtr<WebCore::BlobDataFileReference>> filesInBlob(const URL&); 64 65 WebCore::BlobRegistryImpl& blobRegistry() { return m_blobRegistry; }66 63 67 64 private: 65 ~NetworkBlobRegistry(); 66 68 67 typedef HashMap<NetworkConnectionToWebProcess*, HashSet<URL>> BlobForConnectionMap; 69 68 BlobForConnectionMap m_blobsForConnection; 70 WebCore::BlobRegistryImpl m_blobRegistry;71 69 }; 72 70 -
trunk/Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.cpp
r240984 r241005 27 27 #include "NetworkConnectionToWebProcess.h" 28 28 29 #include "BlobDataFileReferenceWithSandboxExtension.h"30 29 #include "CacheStorageEngineConnectionMessages.h" 31 30 #include "DataReference.h" 31 #include "NetworkBlobRegistry.h" 32 32 #include "NetworkCache.h" 33 33 #include "NetworkMDNSRegisterMessages.h" … … 250 250 stopAllNetworkActivityTracking(); 251 251 252 m_networkProcess->networkBlobRegistry().connectionToWebProcessDidClose(*this);252 NetworkBlobRegistry::singleton().connectionToWebProcessDidClose(*this); 253 253 m_networkProcess->removeNetworkConnectionToWebProcess(*this); 254 254 … … 312 312 } 313 313 314 Vector<RefPtr<WebCore::BlobDataFileReference>> NetworkConnectionToWebProcess::resolveBlobReferences(const NetworkResourceLoadParameters& parameters)315 {316 Vector<RefPtr<WebCore::BlobDataFileReference>> files;317 if (auto* body = parameters.request.httpBody()) {318 for (auto& element : body->elements()) {319 if (auto* blobData = WTF::get_if<FormDataElement::EncodedBlobData>(element.data))320 files.appendVector(m_networkProcess->networkBlobRegistry().filesInBlob(*this, blobData->url));321 }322 const_cast<WebCore::ResourceRequest&>(parameters.request).setHTTPBody(body->resolveBlobReferences(m_networkProcess->networkBlobRegistry().blobRegistry()));323 }324 325 return files;326 }327 328 314 void NetworkConnectionToWebProcess::scheduleResourceLoad(NetworkResourceLoadParameters&& loadParameters) 329 315 { … … 357 343 358 344 // PingLoad manages its own lifetime, deleting itself when its purpose has been fulfilled. 359 new PingLoad( *this,networkProcess(), WTFMove(loadParameters), WTFMove(completionHandler));345 new PingLoad(networkProcess(), WTFMove(loadParameters), WTFMove(completionHandler)); 360 346 } 361 347 … … 406 392 void NetworkConnectionToWebProcess::preconnectTo(uint64_t preconnectionIdentifier, NetworkResourceLoadParameters&& parameters) 407 393 { 408 ASSERT(!parameters.request.httpBody());409 410 394 #if ENABLE(SERVER_PRECONNECT) 411 395 new PreconnectTask(networkProcess(), WTFMove(parameters), [this, protectedThis = makeRef(*this), identifier = preconnectionIdentifier] (const ResourceError& error) { … … 510 494 void NetworkConnectionToWebProcess::registerFileBlobURL(const URL& url, const String& path, SandboxExtension::Handle&& extensionHandle, const String& contentType) 511 495 { 512 m_networkProcess->networkBlobRegistry().registerFileBlobURL(*this, url, path, SandboxExtension::create(WTFMove(extensionHandle)), contentType); 496 RefPtr<SandboxExtension> extension = SandboxExtension::create(WTFMove(extensionHandle)); 497 498 NetworkBlobRegistry::singleton().registerFileBlobURL(*this, url, path, WTFMove(extension), contentType); 513 499 } 514 500 515 501 void NetworkConnectionToWebProcess::registerBlobURL(const URL& url, Vector<BlobPart>&& blobParts, const String& contentType) 516 502 { 517 m_networkProcess->networkBlobRegistry().registerBlobURL(*this, url, WTFMove(blobParts), contentType);503 NetworkBlobRegistry::singleton().registerBlobURL(*this, url, WTFMove(blobParts), contentType); 518 504 } 519 505 520 506 void NetworkConnectionToWebProcess::registerBlobURLFromURL(const URL& url, const URL& srcURL, bool shouldBypassConnectionCheck) 521 507 { 522 m_networkProcess->networkBlobRegistry().registerBlobURL(*this, url, srcURL, shouldBypassConnectionCheck);508 NetworkBlobRegistry::singleton().registerBlobURL(*this, url, srcURL, shouldBypassConnectionCheck); 523 509 } 524 510 525 511 void NetworkConnectionToWebProcess::registerBlobURLOptionallyFileBacked(const URL& url, const URL& srcURL, const String& fileBackedPath, const String& contentType) 526 512 { 527 m_networkProcess->networkBlobRegistry().registerBlobURLOptionallyFileBacked(*this, url, srcURL, fileBackedPath, contentType);513 NetworkBlobRegistry::singleton().registerBlobURLOptionallyFileBacked(*this, url, srcURL, fileBackedPath, contentType); 528 514 } 529 515 530 516 void NetworkConnectionToWebProcess::registerBlobURLForSlice(const URL& url, const URL& srcURL, int64_t start, int64_t end) 531 517 { 532 m_networkProcess->networkBlobRegistry().registerBlobURLForSlice(*this, url, srcURL, start, end);518 NetworkBlobRegistry::singleton().registerBlobURLForSlice(*this, url, srcURL, start, end); 533 519 } 534 520 535 521 void NetworkConnectionToWebProcess::unregisterBlobURL(const URL& url) 536 522 { 537 m_networkProcess->networkBlobRegistry().unregisterBlobURL(*this, url);523 NetworkBlobRegistry::singleton().unregisterBlobURL(*this, url); 538 524 } 539 525 540 526 void NetworkConnectionToWebProcess::blobSize(const URL& url, uint64_t& resultSize) 541 527 { 542 resultSize = m_networkProcess->networkBlobRegistry().blobSize(*this, url);528 resultSize = NetworkBlobRegistry::singleton().blobSize(*this, url); 543 529 } 544 530 … … 547 533 Vector<RefPtr<BlobDataFileReference>> fileReferences; 548 534 for (auto& url : blobURLs) 549 fileReferences.appendVector( m_networkProcess->networkBlobRegistry().filesInBlob(*this, { { }, url }));535 fileReferences.appendVector(NetworkBlobRegistry::singleton().filesInBlob(*this, { { }, url })); 550 536 551 537 for (auto& file : fileReferences) 552 538 file->prepareForFileAccess(); 553 539 554 m_networkProcess->networkBlobRegistry().writeBlobsToTemporaryFiles(blobURLs, [fileReferences = WTFMove(fileReferences), completionHandler = WTFMove(completionHandler)](auto&& fileNames) mutable {540 NetworkBlobRegistry::singleton().writeBlobsToTemporaryFiles(blobURLs, [fileReferences = WTFMove(fileReferences), completionHandler = WTFMove(completionHandler)](auto&& fileNames) mutable { 555 541 for (auto& file : fileReferences) 556 542 file->revokeFileAccess(); 557 543 completionHandler(WTFMove(fileNames)); 558 544 }); 559 }560 561 Vector<RefPtr<WebCore::BlobDataFileReference>> NetworkConnectionToWebProcess::filesInBlob(const URL& url)562 {563 return m_networkProcess->networkBlobRegistry().filesInBlob(*this, url);564 }565 566 WebCore::BlobRegistryImpl& NetworkConnectionToWebProcess::blobRegistry()567 {568 return m_networkProcess->networkBlobRegistry().blobRegistry();569 545 } 570 546 -
trunk/Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.h
r240984 r241005 42 42 namespace WebCore { 43 43 class BlobDataFileReference; 44 class BlobRegistryImpl;45 44 class ResourceError; 46 45 class ResourceRequest; … … 122 121 Optional<NetworkActivityTracker> startTrackingResourceLoad(uint64_t pageID, ResourceLoadIdentifier resourceID, bool isMainResource, const PAL::SessionID&); 123 122 void stopTrackingResourceLoad(ResourceLoadIdentifier resourceID, NetworkActivityTracker::CompletionCode); 124 125 WebCore::BlobRegistryImpl& blobRegistry();126 Vector<RefPtr<WebCore::BlobDataFileReference>> filesInBlob(const URL&);127 Vector<RefPtr<WebCore::BlobDataFileReference>> resolveBlobReferences(const NetworkResourceLoadParameters&);128 123 129 124 private: -
trunk/Source/WebKit/NetworkProcess/NetworkDataTask.cpp
r240984 r241005 48 48 Ref<NetworkDataTask> NetworkDataTask::create(NetworkSession& session, NetworkDataTaskClient& client, const NetworkLoadParameters& parameters) 49 49 { 50 ASSERT(!parameters.request.url().protocolIsBlob()); 50 if (parameters.request.url().protocolIsBlob()) 51 return NetworkDataTaskBlob::create(session, client, parameters.request, parameters.contentSniffingPolicy, parameters.blobFileReferences); 52 51 53 #if PLATFORM(COCOA) 52 54 return NetworkDataTaskCocoa::create(session, client, parameters.request, parameters.webFrameID, parameters.webPageID, parameters.storedCredentialsPolicy, parameters.contentSniffingPolicy, parameters.contentEncodingSniffingPolicy, parameters.shouldClearReferrerOnHTTPSToHTTPRedirect, parameters.shouldPreconnectOnly, parameters.isMainFrameNavigation, parameters.networkActivityTracker); -
trunk/Source/WebKit/NetworkProcess/NetworkDataTaskBlob.cpp
r240984 r241005 66 66 static const char* const webKitBlobResourceDomain = "WebKitBlobResource"; 67 67 68 NetworkDataTaskBlob::NetworkDataTaskBlob(NetworkSession& session, BlobRegistryImpl& blobRegistry,NetworkDataTaskClient& client, const ResourceRequest& request, ContentSniffingPolicy shouldContentSniff, const Vector<RefPtr<WebCore::BlobDataFileReference>>& fileReferences)68 NetworkDataTaskBlob::NetworkDataTaskBlob(NetworkSession& session, NetworkDataTaskClient& client, const ResourceRequest& request, ContentSniffingPolicy shouldContentSniff, const Vector<RefPtr<WebCore::BlobDataFileReference>>& fileReferences) 69 69 : NetworkDataTask(session, client, request, StoredCredentialsPolicy::DoNotUse, false, false) 70 70 , m_stream(std::make_unique<AsyncFileStream>(*this)) … … 75 75 fileReference->prepareForFileAccess(); 76 76 77 m_blobData = blobRegistry.getBlobDataFromURL(request.url());77 m_blobData = static_cast<BlobRegistryImpl&>(blobRegistry()).getBlobDataFromURL(request.url()); 78 78 79 79 m_session->registerNetworkDataTask(*this); -
trunk/Source/WebKit/NetworkProcess/NetworkDataTaskBlob.h
r240984 r241005 41 41 class BlobData; 42 42 class BlobDataItem; 43 class BlobRegistryImpl;44 43 } 45 44 … … 50 49 class NetworkDataTaskBlob final : public NetworkDataTask, public WebCore::FileStreamClient { 51 50 public: 52 static Ref<NetworkDataTask> create(NetworkSession& session, WebCore::BlobRegistryImpl& blobRegistry,NetworkDataTaskClient& client, const WebCore::ResourceRequest& request, WebCore::ContentSniffingPolicy shouldContentSniff, const Vector<RefPtr<WebCore::BlobDataFileReference>>& fileReferences)51 static Ref<NetworkDataTask> create(NetworkSession& session, NetworkDataTaskClient& client, const WebCore::ResourceRequest& request, WebCore::ContentSniffingPolicy shouldContentSniff, const Vector<RefPtr<WebCore::BlobDataFileReference>>& fileReferences) 53 52 { 54 return adoptRef(*new NetworkDataTaskBlob(session, blobRegistry,client, request, shouldContentSniff, fileReferences));53 return adoptRef(*new NetworkDataTaskBlob(session, client, request, shouldContentSniff, fileReferences)); 55 54 } 56 55 … … 58 57 59 58 private: 60 NetworkDataTaskBlob(NetworkSession&, WebCore::BlobRegistryImpl&,NetworkDataTaskClient&, const WebCore::ResourceRequest&, WebCore::ContentSniffingPolicy, const Vector<RefPtr<WebCore::BlobDataFileReference>>&);59 NetworkDataTaskBlob(NetworkSession&, NetworkDataTaskClient&, const WebCore::ResourceRequest&, WebCore::ContentSniffingPolicy, const Vector<RefPtr<WebCore::BlobDataFileReference>>&); 61 60 62 61 void suspend() override; -
trunk/Source/WebKit/NetworkProcess/NetworkLoad.cpp
r240984 r241005 51 51 }; 52 52 53 NetworkLoad::NetworkLoad(NetworkLoadClient& client, BlobRegistryImpl* blobRegistry,NetworkLoadParameters&& parameters, NetworkSession& networkSession)53 NetworkLoad::NetworkLoad(NetworkLoadClient& client, NetworkLoadParameters&& parameters, NetworkSession& networkSession) 54 54 : m_client(client) 55 55 , m_networkProcess(networkSession.networkProcess()) … … 58 58 , m_currentRequest(m_parameters.request) 59 59 { 60 initialize(networkSession, blobRegistry); 61 } 62 63 void NetworkLoad::initialize(NetworkSession& networkSession, WebCore::BlobRegistryImpl* blobRegistry) 64 { 65 if (blobRegistry && m_parameters.request.url().protocolIsBlob()) 66 m_task = NetworkDataTaskBlob::create(networkSession, *blobRegistry, *this, m_parameters.request, m_parameters.contentSniffingPolicy, m_parameters.blobFileReferences); 67 else 68 m_task = NetworkDataTask::create(networkSession, *this, m_parameters); 69 60 initialize(networkSession); 61 } 62 63 void NetworkLoad::initialize(NetworkSession& networkSession) 64 { 65 m_task = NetworkDataTask::create(networkSession, *this, m_parameters); 70 66 if (!m_parameters.defersLoading) 71 67 m_task->resume(); -
trunk/Source/WebKit/NetworkProcess/NetworkLoad.h
r240984 r241005 34 34 #include <wtf/text/WTFString.h> 35 35 36 namespace WebCore {37 class BlobRegistryImpl;38 }39 40 36 namespace WebKit { 41 37 … … 45 41 WTF_MAKE_FAST_ALLOCATED; 46 42 public: 47 NetworkLoad(NetworkLoadClient&, WebCore::BlobRegistryImpl*,NetworkLoadParameters&&, NetworkSession&);43 NetworkLoad(NetworkLoadClient&, NetworkLoadParameters&&, NetworkSession&); 48 44 ~NetworkLoad(); 49 45 … … 70 66 71 67 private: 72 void initialize(NetworkSession& , WebCore::BlobRegistryImpl*);68 void initialize(NetworkSession&); 73 69 74 70 // NetworkDataTaskClient -
trunk/Source/WebKit/NetworkProcess/NetworkProcess.cpp
r240984 r241005 38 38 #endif 39 39 #include "Logging.h" 40 #include "NetworkBlobRegistry.h" 40 41 #include "NetworkConnectionToWebProcess.h" 41 42 #include "NetworkContentRuleListManagerMessages.h" … … 150 151 #endif 151 152 152 NetworkStateNotifier::singleton().addListener([weakThis = makeWeakPtr(*this)](bool isOnLine) { 153 if (!weakThis) 154 return; 155 for (auto& webProcessConnection : weakThis->m_webProcessConnections) 153 NetworkStateNotifier::singleton().addListener([this](bool isOnLine) { 154 auto webProcessConnections = m_webProcessConnections; 155 for (auto& webProcessConnection : webProcessConnections) 156 156 webProcessConnection->setOnLineState(isOnLine); 157 157 }); … … 187 187 void NetworkProcess::removeNetworkConnectionToWebProcess(NetworkConnectionToWebProcess& connection) 188 188 { 189 auto count = m_webProcessConnections.removeAllMatching([&] (const auto& c) {190 return c.ptr() == &connection;191 }); 192 ASSERT_UNUSED(count, count == 1);189 size_t vectorIndex = m_webProcessConnections.find(&connection); 190 ASSERT(vectorIndex != notFound); 191 192 m_webProcessConnections.remove(vectorIndex); 193 193 } 194 194 -
trunk/Source/WebKit/NetworkProcess/NetworkProcess.h
r240984 r241005 29 29 #include "CacheModel.h" 30 30 #include "DownloadManager.h" 31 #include "NetworkBlobRegistry.h"32 31 #include "NetworkContentRuleListManager.h" 33 32 #include "NetworkHTTPSUpgradeChecker.h" … … 293 292 void requestCacheStorageSpace(PAL::SessionID, const WebCore::ClientOrigin&, uint64_t quota, uint64_t currentSize, uint64_t spaceRequired, CompletionHandler<void(Optional<uint64_t>)>&&); 294 293 295 NetworkBlobRegistry& networkBlobRegistry() { return m_networkBlobRegistry; }296 297 294 private: 298 295 void platformInitializeNetworkProcess(const NetworkProcessCreationParameters&); … … 426 423 427 424 // Connections to WebProcesses. 428 Vector<Ref <NetworkConnectionToWebProcess>> m_webProcessConnections;425 Vector<RefPtr<NetworkConnectionToWebProcess>> m_webProcessConnections; 429 426 430 427 String m_diskCacheDirectory; … … 449 446 HashMap<PAL::SessionID, std::unique_ptr<WebCore::NetworkStorageSession>> m_networkStorageSessions; 450 447 mutable std::unique_ptr<WebCore::NetworkStorageSession> m_defaultNetworkStorageSession; 451 NetworkBlobRegistry m_networkBlobRegistry;452 448 453 449 #if PLATFORM(COCOA) -
trunk/Source/WebKit/NetworkProcess/NetworkProcessPlatformStrategies.cpp
r240984 r241005 27 27 #include "NetworkProcessPlatformStrategies.h" 28 28 29 #include <WebCore/BlobRegistry .h>29 #include <WebCore/BlobRegistryImpl.h> 30 30 #include <wtf/NeverDestroyed.h> 31 31 … … 51 51 BlobRegistry* NetworkProcessPlatformStrategies::createBlobRegistry() 52 52 { 53 using namespace WebCore; 54 class EmptyBlobRegistry : public WebCore::BlobRegistry { 55 void registerFileBlobURL(const URL&, Ref<BlobDataFileReference>&&, const String& contentType) final { ASSERT_NOT_REACHED(); } 56 void registerBlobURL(const URL&, Vector<BlobPart>&&, const String& contentType) final { ASSERT_NOT_REACHED(); } 57 void registerBlobURL(const URL&, const URL& srcURL) final { ASSERT_NOT_REACHED(); } 58 void registerBlobURLOptionallyFileBacked(const URL&, const URL& srcURL, RefPtr<BlobDataFileReference>&&, const String& contentType) final { ASSERT_NOT_REACHED(); } 59 void registerBlobURLForSlice(const URL&, const URL& srcURL, long long start, long long end) final { ASSERT_NOT_REACHED(); } 60 void unregisterBlobURL(const URL&) final { ASSERT_NOT_REACHED(); } 61 unsigned long long blobSize(const URL&) final { ASSERT_NOT_REACHED(); return 0; } 62 void writeBlobsToTemporaryFiles(const Vector<String>& blobURLs, CompletionHandler<void(Vector<String>&& filePaths)>&&) final { ASSERT_NOT_REACHED(); } 63 bool isBlobRegistryImpl() const { return false; } 64 }; 65 static NeverDestroyed<EmptyBlobRegistry> blobRegistry; 66 return &blobRegistry.get(); 53 return new BlobRegistryImpl; 67 54 } 68 55 -
trunk/Source/WebKit/NetworkProcess/NetworkResourceLoader.cpp
r240984 r241005 30 30 #include "FormDataReference.h" 31 31 #include "Logging.h" 32 #include "NetworkBlobRegistry.h" 32 33 #include "NetworkCache.h" 33 34 #include "NetworkConnectionToWebProcess.h" … … 92 93 : m_parameters { WTFMove(parameters) } 93 94 , m_connection { connection } 94 , m_fileReferences(connection.resolveBlobReferences(m_parameters))95 95 , m_defersLoading { parameters.defersLoading } 96 96 , m_isAllowedToAskUserForCredentials { m_parameters.clientCredentialPolicy == ClientCredentialPolicy::MayAskClientForCredentials } … … 103 103 // Once bug 116233 is resolved, this ASSERT can just be "m_webPageID && m_webFrameID" 104 104 ASSERT((m_parameters.webPageID && m_parameters.webFrameID) || m_parameters.clientCredentialPolicy == ClientCredentialPolicy::CannotAskClientForCredentials); 105 106 if (originalRequest().httpBody()) { 107 for (const auto& element : originalRequest().httpBody()->elements()) { 108 if (auto* blobData = WTF::get_if<FormDataElement::EncodedBlobData>(element.data)) 109 m_fileReferences.appendVector(NetworkBlobRegistry::singleton().filesInBlob(connection, blobData->url)); 110 } 111 } 105 112 106 113 if (synchronousReply || parameters.shouldRestrictHTTPResponseAccess) { … … 122 129 ASSERT(!m_networkLoad); 123 130 ASSERT(!isSynchronous() || !m_synchronousLoadData->delayedReply); 124 ASSERT(m_fileReferences.isEmpty());125 131 if (m_responseCompletionHandler) 126 132 m_responseCompletionHandler(PolicyAction::Ignore); … … 277 283 278 284 if (request.url().protocolIsBlob()) 279 parameters.blobFileReferences = m_connection->filesInBlob(originalRequest().url());285 parameters.blobFileReferences = NetworkBlobRegistry::singleton().filesInBlob(m_connection, originalRequest().url()); 280 286 281 287 auto* networkSession = m_connection->networkProcess().networkSession(parameters.sessionID); … … 293 299 294 300 parameters.request = WTFMove(request); 295 m_networkLoad = std::make_unique<NetworkLoad>(*this, &m_connection->blobRegistry(),WTFMove(parameters), *networkSession);301 m_networkLoad = std::make_unique<NetworkLoad>(*this, WTFMove(parameters), *networkSession); 296 302 297 303 RELEASE_LOG_IF_ALLOWED("startNetworkLoad: (pageID = %" PRIu64 ", frameID = %" PRIu64 ", resourceID = %" PRIu64 ", description = %{public}s)", m_parameters.webPageID, m_parameters.webFrameID, m_parameters.identifier, m_networkLoad->description().utf8().data()); -
trunk/Source/WebKit/NetworkProcess/PingLoad.cpp
r240984 r241005 30 30 #include "AuthenticationManager.h" 31 31 #include "Logging.h" 32 #include "NetworkConnectionToWebProcess.h"33 32 #include "NetworkLoadChecker.h" 34 33 #include "NetworkProcess.h" … … 41 40 using namespace WebCore; 42 41 43 PingLoad::PingLoad(Network ConnectionToWebProcess& connection, NetworkProcess& networkProcess, NetworkResourceLoadParameters&& parameters, CompletionHandler<void(const ResourceError&, const ResourceResponse&)>&& completionHandler)42 PingLoad::PingLoad(NetworkProcess& networkProcess, NetworkResourceLoadParameters&& parameters, CompletionHandler<void(const ResourceError&, const ResourceResponse&)>&& completionHandler) 44 43 : m_parameters(WTFMove(parameters)) 45 44 , m_completionHandler(WTFMove(completionHandler)) 46 45 , m_timeoutTimer(*this, &PingLoad::timeoutTimerFired) 47 46 , m_networkLoadChecker(makeUniqueRef<NetworkLoadChecker>(networkProcess, FetchOptions { m_parameters.options}, m_parameters.sessionID, m_parameters.webPageID, m_parameters.webFrameID, WTFMove(m_parameters.originalRequestHeaders), URL { m_parameters.request.url() }, m_parameters.sourceOrigin.copyRef(), m_parameters.preflightPolicy, m_parameters.request.httpReferrer())) 48 , m_blobFiles(connection.resolveBlobReferences(m_parameters))49 47 { 50 for (auto& file : m_blobFiles) {51 if (file)52 file->prepareForFileAccess();53 }54 55 48 m_networkLoadChecker->enableContentExtensionsCheck(); 56 49 if (m_parameters.cspResponseHeaders) … … 86 79 m_task->clearClient(); 87 80 m_task->cancel(); 88 }89 for (auto& file : m_blobFiles) {90 if (file)91 file->revokeFileAccess();92 81 } 93 82 } -
trunk/Source/WebKit/NetworkProcess/PingLoad.h
r240984 r241005 41 41 class PingLoad final : public CanMakeWeakPtr<PingLoad>, private NetworkDataTaskClient { 42 42 public: 43 PingLoad(Network ConnectionToWebProcess&, NetworkProcess&, NetworkResourceLoadParameters&&, CompletionHandler<void(const WebCore::ResourceError&, const WebCore::ResourceResponse&)>&&);43 PingLoad(NetworkProcess&, NetworkResourceLoadParameters&&, CompletionHandler<void(const WebCore::ResourceError&, const WebCore::ResourceResponse&)>&&); 44 44 45 45 private: … … 67 67 WebCore::Timer m_timeoutTimer; 68 68 UniqueRef<NetworkLoadChecker> m_networkLoadChecker; 69 Vector<RefPtr<WebCore::BlobDataFileReference>> m_blobFiles;70 69 }; 71 70 -
trunk/Source/WebKit/NetworkProcess/PreconnectTask.cpp
r240984 r241005 54 54 55 55 ASSERT(parameters.shouldPreconnectOnly == PreconnectOnly::Yes); 56 m_networkLoad = std::make_unique<NetworkLoad>(*this, nullptr,WTFMove(parameters), *networkSession);56 m_networkLoad = std::make_unique<NetworkLoad>(*this, WTFMove(parameters), *networkSession); 57 57 58 58 m_timeoutTimer.startOneShot(60000_s); -
trunk/Source/WebKit/NetworkProcess/cache/NetworkCacheSpeculativeLoad.cpp
r240984 r241005 61 61 parameters.contentEncodingSniffingPolicy = ContentEncodingSniffingPolicy::Sniff; 62 62 parameters.request = m_originalRequest; 63 m_networkLoad = std::make_unique<NetworkLoad>(*this, nullptr,WTFMove(parameters), *cache.networkProcess().networkSession(PAL::SessionID::defaultSessionID()));63 m_networkLoad = std::make_unique<NetworkLoad>(*this, WTFMove(parameters), *cache.networkProcess().networkSession(PAL::SessionID::defaultSessionID())); 64 64 } 65 65
Note: See TracChangeset
for help on using the changeset viewer.