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

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

Issue 1029423004: Cache Storage: Add Platform API to retrieve CacheStorage for origin (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Remove cruft, rename arg Created 5 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 | Annotate | Revision Log
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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
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/ServiceWorkerScriptCachedMetadataHandler.h"
53 #include "modules/serviceworkers/ServiceWorkerThread.h" 53 #include "modules/serviceworkers/ServiceWorkerThread.h"
54 #include "modules/serviceworkers/WaitUntilObserver.h" 54 #include "modules/serviceworkers/WaitUntilObserver.h"
55 #include "platform/network/ResourceRequest.h" 55 #include "platform/network/ResourceRequest.h"
56 #include "platform/weborigin/DatabaseIdentifier.h"
56 #include "platform/weborigin/KURL.h" 57 #include "platform/weborigin/KURL.h"
57 #include "public/platform/WebServiceWorkerSkipWaitingCallbacks.h" 58 #include "public/platform/WebServiceWorkerSkipWaitingCallbacks.h"
58 #include "public/platform/WebURL.h" 59 #include "public/platform/WebURL.h"
59 #include "wtf/CurrentTime.h" 60 #include "wtf/CurrentTime.h"
60 61
61 namespace blink { 62 namespace blink {
62 63
63 class ServiceWorkerGlobalScope::SkipWaitingCallback final : public WebServiceWor kerSkipWaitingCallbacks { 64 class ServiceWorkerGlobalScope::SkipWaitingCallback final : public WebServiceWor kerSkipWaitingCallbacks {
64 WTF_MAKE_NONCOPYABLE(SkipWaitingCallback); 65 WTF_MAKE_NONCOPYABLE(SkipWaitingCallback);
65 public: 66 public:
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 { 100 {
100 } 101 }
101 102
102 void ServiceWorkerGlobalScope::didEvaluateWorkerScript() 103 void ServiceWorkerGlobalScope::didEvaluateWorkerScript()
103 { 104 {
104 m_didEvaluateScript = true; 105 m_didEvaluateScript = true;
105 } 106 }
106 107
107 CacheStorage* ServiceWorkerGlobalScope::caches(ExecutionContext* context) 108 CacheStorage* ServiceWorkerGlobalScope::caches(ExecutionContext* context)
108 { 109 {
109 if (!m_caches) 110 if (!m_caches) {
110 m_caches = CacheStorage::create(ServiceWorkerGlobalScopeClient::from(con text)->cacheStorage()); 111 String identifier = createDatabaseIdentifierFromSecurityOrigin(context-> securityOrigin());
112 ASSERT(!identifier.isEmpty());
113 m_caches = CacheStorage::create(Platform::current()->cacheStorage(identi fier));
114 }
111 return m_caches; 115 return m_caches;
112 } 116 }
113 117
114 ScriptPromise ServiceWorkerGlobalScope::fetch(ScriptState* scriptState, const Re questInfo& input, const Dictionary& init, ExceptionState& exceptionState) 118 ScriptPromise ServiceWorkerGlobalScope::fetch(ScriptState* scriptState, const Re questInfo& input, const Dictionary& init, ExceptionState& exceptionState)
115 { 119 {
116 return GlobalFetch::fetch(scriptState, *this, input, init, exceptionState); 120 return GlobalFetch::fetch(scriptState, *this, input, init, exceptionState);
117 } 121 }
118 122
119 ServiceWorkerClients* ServiceWorkerGlobalScope::clients() 123 ServiceWorkerClients* ServiceWorkerGlobalScope::clients()
120 { 124 {
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
223 void ServiceWorkerGlobalScope::logExceptionToConsole(const String& errorMessage, int scriptId, const String& sourceURL, int lineNumber, int columnNumber, PassRe fPtrWillBeRawPtr<ScriptCallStack> callStack) 227 void ServiceWorkerGlobalScope::logExceptionToConsole(const String& errorMessage, int scriptId, const String& sourceURL, int lineNumber, int columnNumber, PassRe fPtrWillBeRawPtr<ScriptCallStack> callStack)
224 { 228 {
225 WorkerGlobalScope::logExceptionToConsole(errorMessage, scriptId, sourceURL, lineNumber, columnNumber, callStack); 229 WorkerGlobalScope::logExceptionToConsole(errorMessage, scriptId, sourceURL, lineNumber, columnNumber, callStack);
226 RefPtrWillBeRawPtr<ConsoleMessage> consoleMessage = ConsoleMessage::create(J SMessageSource, ErrorMessageLevel, errorMessage, sourceURL, lineNumber); 230 RefPtrWillBeRawPtr<ConsoleMessage> consoleMessage = ConsoleMessage::create(J SMessageSource, ErrorMessageLevel, errorMessage, sourceURL, lineNumber);
227 consoleMessage->setScriptId(scriptId); 231 consoleMessage->setScriptId(scriptId);
228 consoleMessage->setCallStack(callStack); 232 consoleMessage->setCallStack(callStack);
229 addMessageToWorkerConsole(consoleMessage.release()); 233 addMessageToWorkerConsole(consoleMessage.release());
230 } 234 }
231 235
232 } // namespace blink 236 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698