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

Side by Side Diff: Source/modules/serviceworkers/ServiceWorkerGlobalScope.cpp

Issue 929953002: CachedMetadata support for ServiceWorker script. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: incorporated tkent's comment Created 5 years, 10 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) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 #include "core/loader/ThreadableLoader.h" 42 #include "core/loader/ThreadableLoader.h"
43 #include "core/workers/WorkerClients.h" 43 #include "core/workers/WorkerClients.h"
44 #include "core/workers/WorkerThreadStartupData.h" 44 #include "core/workers/WorkerThreadStartupData.h"
45 #include "modules/EventTargetModules.h" 45 #include "modules/EventTargetModules.h"
46 #include "modules/fetch/GlobalFetch.h" 46 #include "modules/fetch/GlobalFetch.h"
47 #include "modules/serviceworkers/CacheStorage.h" 47 #include "modules/serviceworkers/CacheStorage.h"
48 #include "modules/serviceworkers/InspectorServiceWorkerCacheAgent.h" 48 #include "modules/serviceworkers/InspectorServiceWorkerCacheAgent.h"
49 #include "modules/serviceworkers/ServiceWorkerClients.h" 49 #include "modules/serviceworkers/ServiceWorkerClients.h"
50 #include "modules/serviceworkers/ServiceWorkerGlobalScopeClient.h" 50 #include "modules/serviceworkers/ServiceWorkerGlobalScopeClient.h"
51 #include "modules/serviceworkers/ServiceWorkerRegistration.h" 51 #include "modules/serviceworkers/ServiceWorkerRegistration.h"
52 #include "modules/serviceworkers/ServiceWorkerScriptCachedMetadataHandler.h"
52 #include "modules/serviceworkers/ServiceWorkerThread.h" 53 #include "modules/serviceworkers/ServiceWorkerThread.h"
53 #include "modules/serviceworkers/WaitUntilObserver.h" 54 #include "modules/serviceworkers/WaitUntilObserver.h"
54 #include "platform/network/ResourceRequest.h" 55 #include "platform/network/ResourceRequest.h"
55 #include "platform/weborigin/KURL.h" 56 #include "platform/weborigin/KURL.h"
56 #include "public/platform/WebServiceWorkerSkipWaitingCallbacks.h" 57 #include "public/platform/WebServiceWorkerSkipWaitingCallbacks.h"
57 #include "public/platform/WebURL.h" 58 #include "public/platform/WebURL.h"
58 #include "wtf/CurrentTime.h" 59 #include "wtf/CurrentTime.h"
59 60
60 namespace blink { 61 namespace blink {
61 62
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
204 void ServiceWorkerGlobalScope::importScripts(const Vector<String>& urls, Excepti onState& exceptionState) 205 void ServiceWorkerGlobalScope::importScripts(const Vector<String>& urls, Excepti onState& exceptionState)
205 { 206 {
206 // Bust the MemoryCache to ensure script requests reach the browser-side 207 // Bust the MemoryCache to ensure script requests reach the browser-side
207 // and get added to and retrieved from the ServiceWorker's script cache. 208 // and get added to and retrieved from the ServiceWorker's script cache.
208 // FIXME: Revisit in light of the solution to crbug/388375. 209 // FIXME: Revisit in light of the solution to crbug/388375.
209 for (Vector<String>::const_iterator it = urls.begin(); it != urls.end(); ++i t) 210 for (Vector<String>::const_iterator it = urls.begin(); it != urls.end(); ++i t)
210 MemoryCache::removeURLFromCache(this->executionContext(), completeURL(*i t)); 211 MemoryCache::removeURLFromCache(this->executionContext(), completeURL(*i t));
211 WorkerGlobalScope::importScripts(urls, exceptionState); 212 WorkerGlobalScope::importScripts(urls, exceptionState);
212 } 213 }
213 214
215 PassOwnPtr<CachedMetadataHandler> ServiceWorkerGlobalScope::createWorkerScriptCa chedMetadataHandler(const KURL& scriptURL, const Vector<char>* metaData)
216 {
217 return ServiceWorkerScriptCachedMetadataHandler::create(this, scriptURL, met aData);
218 }
219
214 void ServiceWorkerGlobalScope::logExceptionToConsole(const String& errorMessage, int scriptId, const String& sourceURL, int lineNumber, int columnNumber, PassRe fPtrWillBeRawPtr<ScriptCallStack> callStack) 220 void ServiceWorkerGlobalScope::logExceptionToConsole(const String& errorMessage, int scriptId, const String& sourceURL, int lineNumber, int columnNumber, PassRe fPtrWillBeRawPtr<ScriptCallStack> callStack)
215 { 221 {
216 WorkerGlobalScope::logExceptionToConsole(errorMessage, scriptId, sourceURL, lineNumber, columnNumber, callStack); 222 WorkerGlobalScope::logExceptionToConsole(errorMessage, scriptId, sourceURL, lineNumber, columnNumber, callStack);
217 RefPtrWillBeRawPtr<ConsoleMessage> consoleMessage = ConsoleMessage::create(J SMessageSource, ErrorMessageLevel, errorMessage, sourceURL, lineNumber); 223 RefPtrWillBeRawPtr<ConsoleMessage> consoleMessage = ConsoleMessage::create(J SMessageSource, ErrorMessageLevel, errorMessage, sourceURL, lineNumber);
218 consoleMessage->setScriptId(scriptId); 224 consoleMessage->setScriptId(scriptId);
219 consoleMessage->setCallStack(callStack); 225 consoleMessage->setCallStack(callStack);
220 addMessageToWorkerConsole(consoleMessage.release()); 226 addMessageToWorkerConsole(consoleMessage.release());
221 } 227 }
222 228
223 } // namespace blink 229 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698