Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(78)

Side by Side Diff: third_party/WebKit/Source/core/loader/DocumentLoader.cpp

Issue 2733283004: Expose WebServiceWorkerNetworkProvider on DataSource (Closed)
Patch Set: crash fix Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved. 2 * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved.
3 * Copyright (C) 2011 Google Inc. All rights reserved. 3 * Copyright (C) 2011 Google Inc. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 8 *
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 #include "platform/loader/fetch/MemoryCache.h" 66 #include "platform/loader/fetch/MemoryCache.h"
67 #include "platform/loader/fetch/ResourceFetcher.h" 67 #include "platform/loader/fetch/ResourceFetcher.h"
68 #include "platform/mhtml/ArchiveResource.h" 68 #include "platform/mhtml/ArchiveResource.h"
69 #include "platform/network/ContentSecurityPolicyResponseHeaders.h" 69 #include "platform/network/ContentSecurityPolicyResponseHeaders.h"
70 #include "platform/network/HTTPParsers.h" 70 #include "platform/network/HTTPParsers.h"
71 #include "platform/network/mime/MIMETypeRegistry.h" 71 #include "platform/network/mime/MIMETypeRegistry.h"
72 #include "platform/plugins/PluginData.h" 72 #include "platform/plugins/PluginData.h"
73 #include "platform/weborigin/SchemeRegistry.h" 73 #include "platform/weborigin/SchemeRegistry.h"
74 #include "platform/weborigin/SecurityPolicy.h" 74 #include "platform/weborigin/SecurityPolicy.h"
75 #include "public/platform/Platform.h" 75 #include "public/platform/Platform.h"
76 #include "public/platform/modules/serviceworker/WebServiceWorkerNetworkProvider. h"
76 #include "wtf/Assertions.h" 77 #include "wtf/Assertions.h"
77 #include "wtf/AutoReset.h" 78 #include "wtf/AutoReset.h"
78 #include "wtf/text/WTFString.h" 79 #include "wtf/text/WTFString.h"
79 80
80 namespace blink { 81 namespace blink {
81 82
82 static bool isArchiveMIMEType(const String& mimeType) { 83 static bool isArchiveMIMEType(const String& mimeType) {
83 return equalIgnoringCase("multipart/related", mimeType); 84 return equalIgnoringCase("multipart/related", mimeType);
84 } 85 }
85 86
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
222 } 223 }
223 224
224 // CSP layout tests verify that preloads are subject to access checks by 225 // CSP layout tests verify that preloads are subject to access checks by
225 // seeing if they are in the `preload started` list. Therefore do not add 226 // seeing if they are in the `preload started` list. Therefore do not add
226 // them to the list if the load is immediately denied. 227 // them to the list if the load is immediately denied.
227 if (resource && !resource->resourceError().isAccessCheck()) 228 if (resource && !resource->resourceError().isAccessCheck())
228 fetcher()->preloadStarted(resource); 229 fetcher()->preloadStarted(resource);
229 return resource; 230 return resource;
230 } 231 }
231 232
233 void DocumentLoader::setServiceWorkerNetworkProvider(
234 std::unique_ptr<WebServiceWorkerNetworkProvider> provider) {
235 m_serviceWorkerNetworkProvider = std::move(provider);
236 }
237
232 void DocumentLoader::dispatchLinkHeaderPreloads( 238 void DocumentLoader::dispatchLinkHeaderPreloads(
233 ViewportDescriptionWrapper* viewport, 239 ViewportDescriptionWrapper* viewport,
234 LinkLoader::MediaPreloadPolicy mediaPolicy) { 240 LinkLoader::MediaPreloadPolicy mediaPolicy) {
235 LinkLoader::loadLinksFromHeader( 241 LinkLoader::loadLinksFromHeader(
236 response().httpHeaderField(HTTPNames::Link), response().url(), 242 response().httpHeaderField(HTTPNames::Link), response().url(),
237 m_frame->document(), NetworkHintsInterfaceImpl(), 243 m_frame->document(), NetworkHintsInterfaceImpl(),
238 LinkLoader::OnlyLoadResources, mediaPolicy, viewport); 244 LinkLoader::OnlyLoadResources, mediaPolicy, viewport);
239 } 245 }
240 246
241 void DocumentLoader::didChangePerformanceTiming() { 247 void DocumentLoader::didChangePerformanceTiming() {
(...skipping 403 matching lines...) Expand 10 before | Expand all | Expand 10 after
645 frameLoader().loadFailed(this, ResourceError::cancelledError(url())); 651 frameLoader().loadFailed(this, ResourceError::cancelledError(url()));
646 652
647 // If that load cancellation triggered another detach, leave. 653 // If that load cancellation triggered another detach, leave.
648 // (fast/frames/detach-frame-nested-no-crash.html is an example of this.) 654 // (fast/frames/detach-frame-nested-no-crash.html is an example of this.)
649 if (!m_frame) 655 if (!m_frame)
650 return; 656 return;
651 657
652 m_fetcher->clearContext(); 658 m_fetcher->clearContext();
653 m_applicationCacheHost->detachFromDocumentLoader(); 659 m_applicationCacheHost->detachFromDocumentLoader();
654 m_applicationCacheHost.clear(); 660 m_applicationCacheHost.clear();
661 m_serviceWorkerNetworkProvider = nullptr;
655 WeakIdentifierMap<DocumentLoader>::notifyObjectDestroyed(this); 662 WeakIdentifierMap<DocumentLoader>::notifyObjectDestroyed(this);
656 clearMainResourceHandle(); 663 clearMainResourceHandle();
657 m_frame = nullptr; 664 m_frame = nullptr;
658 } 665 }
659 666
660 void DocumentLoader::clearMainResourceHandle() { 667 void DocumentLoader::clearMainResourceHandle() {
661 if (!m_mainResource) 668 if (!m_mainResource)
662 return; 669 return;
663 m_mainResource->removeClient(this); 670 m_mainResource->removeClient(this);
664 m_mainResource = nullptr; 671 m_mainResource = nullptr;
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
811 m_writer ? m_writer->encoding() : emptyAtom, true, 818 m_writer ? m_writer->encoding() : emptyAtom, true,
812 ForceSynchronousParsing); 819 ForceSynchronousParsing);
813 if (!source.isNull()) 820 if (!source.isNull())
814 m_writer->appendReplacingData(source); 821 m_writer->appendReplacingData(source);
815 endWriting(); 822 endWriting();
816 } 823 }
817 824
818 DEFINE_WEAK_IDENTIFIER_MAP(DocumentLoader); 825 DEFINE_WEAK_IDENTIFIER_MAP(DocumentLoader);
819 826
820 } // namespace blink 827 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698