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

Unified Diff: Source/core/fetch/ResourceFetcher.cpp

Issue 650033007: ServiceWorker: Make a way to retrieve a service worker version id (Blink) (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: change assert Created 6 years, 2 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/fetch/ResourceFetcher.h ('k') | Source/core/loader/EmptyClients.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/fetch/ResourceFetcher.cpp
diff --git a/Source/core/fetch/ResourceFetcher.cpp b/Source/core/fetch/ResourceFetcher.cpp
index e6d13535757fe6171ad088c3e2218dda1bcc5d07..48b5339b7244dfdf166941a297e475da5c5059d4 100644
--- a/Source/core/fetch/ResourceFetcher.cpp
+++ b/Source/core/fetch/ResourceFetcher.cpp
@@ -624,6 +624,20 @@ bool ResourceFetcher::isControlledByServiceWorker() const
return localFrame->loader().client()->isControlledByServiceWorker(*m_documentLoader);
}
+int64_t ResourceFetcher::serviceWorkerID() const
+{
+ LocalFrame* localFrame = frame();
+ if (!localFrame)
+ return -1;
+ ASSERT(m_documentLoader || localFrame->loader().documentLoader());
+ if (m_documentLoader)
+ return localFrame->loader().client()->serviceWorkerID(*m_documentLoader);
+ // m_documentLoader is null while loading resources from the imported HTML.
+ // In such cases a service worker ID could be retrieved from the document
+ // loader of the frame.
+ return localFrame->loader().client()->serviceWorkerID(*localFrame->loader().documentLoader());
+}
+
bool ResourceFetcher::shouldLoadNewResource(Resource::Type type) const
{
if (!frame())
« no previous file with comments | « Source/core/fetch/ResourceFetcher.h ('k') | Source/core/loader/EmptyClients.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698