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

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

Issue 424643002: Introducing the WebServiceWorkerCacheStorage (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: combine with prior CL Created 6 years, 4 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 23 matching lines...) Expand all
34 #include "bindings/core/v8/ScriptState.h" 34 #include "bindings/core/v8/ScriptState.h"
35 #include "bindings/core/v8/V8ThrowException.h" 35 #include "bindings/core/v8/V8ThrowException.h"
36 #include "core/fetch/ResourceLoaderOptions.h" 36 #include "core/fetch/ResourceLoaderOptions.h"
37 #include "core/inspector/ScriptCallStack.h" 37 #include "core/inspector/ScriptCallStack.h"
38 #include "core/loader/ThreadableLoader.h" 38 #include "core/loader/ThreadableLoader.h"
39 #include "core/workers/WorkerClients.h" 39 #include "core/workers/WorkerClients.h"
40 #include "core/workers/WorkerThreadStartupData.h" 40 #include "core/workers/WorkerThreadStartupData.h"
41 #include "modules/CachePolyfill.h" 41 #include "modules/CachePolyfill.h"
42 #include "modules/CacheStoragePolyfill.h" 42 #include "modules/CacheStoragePolyfill.h"
43 #include "modules/EventTargetModules.h" 43 #include "modules/EventTargetModules.h"
44 #include "modules/serviceworkers/CacheStorage.h"
45 #include "modules/serviceworkers/FetchManager.h" 44 #include "modules/serviceworkers/FetchManager.h"
45 #include "modules/serviceworkers/FetchStores.h"
46 #include "modules/serviceworkers/Request.h" 46 #include "modules/serviceworkers/Request.h"
47 #include "modules/serviceworkers/ServiceWorkerClients.h" 47 #include "modules/serviceworkers/ServiceWorkerClients.h"
48 #include "modules/serviceworkers/ServiceWorkerGlobalScopeClient.h" 48 #include "modules/serviceworkers/ServiceWorkerGlobalScopeClient.h"
49 #include "modules/serviceworkers/ServiceWorkerThread.h" 49 #include "modules/serviceworkers/ServiceWorkerThread.h"
50 #include "platform/network/ResourceRequest.h" 50 #include "platform/network/ResourceRequest.h"
51 #include "platform/weborigin/KURL.h" 51 #include "platform/weborigin/KURL.h"
52 #include "public/platform/WebURL.h" 52 #include "public/platform/WebURL.h"
53 #include "wtf/CurrentTime.h" 53 #include "wtf/CurrentTime.h"
54 54
55 namespace blink { 55 namespace blink {
(...skipping 24 matching lines...) Expand all
80 void ServiceWorkerGlobalScope::stopFetch() 80 void ServiceWorkerGlobalScope::stopFetch()
81 { 81 {
82 m_fetchManager.clear(); 82 m_fetchManager.clear();
83 } 83 }
84 84
85 String ServiceWorkerGlobalScope::scope(ExecutionContext* context) 85 String ServiceWorkerGlobalScope::scope(ExecutionContext* context)
86 { 86 {
87 return ServiceWorkerGlobalScopeClient::from(context)->scope().string(); 87 return ServiceWorkerGlobalScopeClient::from(context)->scope().string();
88 } 88 }
89 89
90 PassRefPtrWillBeRawPtr<CacheStorage> ServiceWorkerGlobalScope::caches(ExecutionC ontext* context) 90 PassRefPtrWillBeRawPtr<FetchStores> ServiceWorkerGlobalScope::fetchStores(Execut ionContext* context)
91 { 91 {
92 if (!m_cacheStorage) 92 if (!m_fetchStores)
93 m_cacheStorage = CacheStorage::create(); 93 m_fetchStores = FetchStores::create(ServiceWorkerGlobalScopeClient::from (context)->fetchStores());
94 return m_cacheStorage; 94 return m_fetchStores;
95 } 95 }
96 96
97 ScriptPromise ServiceWorkerGlobalScope::fetch(ScriptState* scriptState, Request* request) 97 ScriptPromise ServiceWorkerGlobalScope::fetch(ScriptState* scriptState, Request* request)
98 { 98 {
99 if (!m_fetchManager) 99 if (!m_fetchManager)
100 return ScriptPromise::reject(scriptState, V8ThrowException::createTypeEr ror("ServiceWorkerGlobalScope is shutting down.", scriptState->isolate())); 100 return ScriptPromise::reject(scriptState, V8ThrowException::createTypeEr ror("ServiceWorkerGlobalScope is shutting down.", scriptState->isolate()));
101 // "Let |r| be the associated request of the result of invoking the initial 101 // "Let |r| be the associated request of the result of invoking the initial
102 // value of Request as constructor with |input| and |init| as arguments. If 102 // value of Request as constructor with |input| and |init| as arguments. If
103 // this throws an exception, reject |p| with it." 103 // this throws an exception, reject |p| with it."
104 TrackExceptionState exceptionState; 104 TrackExceptionState exceptionState;
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
166 } 166 }
167 167
168 const AtomicString& ServiceWorkerGlobalScope::interfaceName() const 168 const AtomicString& ServiceWorkerGlobalScope::interfaceName() const
169 { 169 {
170 return EventTargetNames::ServiceWorkerGlobalScope; 170 return EventTargetNames::ServiceWorkerGlobalScope;
171 } 171 }
172 172
173 void ServiceWorkerGlobalScope::trace(Visitor* visitor) 173 void ServiceWorkerGlobalScope::trace(Visitor* visitor)
174 { 174 {
175 visitor->trace(m_clients); 175 visitor->trace(m_clients);
176 visitor->trace(m_cacheStorage); 176 visitor->trace(m_fetchStores);
177 WorkerGlobalScope::trace(visitor); 177 WorkerGlobalScope::trace(visitor);
178 } 178 }
179 179
180 void ServiceWorkerGlobalScope::logExceptionToConsole(const String& errorMessage, const String& sourceURL, int lineNumber, int columnNumber, PassRefPtrWillBeRawP tr<ScriptCallStack> callStack) 180 void ServiceWorkerGlobalScope::logExceptionToConsole(const String& errorMessage, const String& sourceURL, int lineNumber, int columnNumber, PassRefPtrWillBeRawP tr<ScriptCallStack> callStack)
181 { 181 {
182 WorkerGlobalScope::logExceptionToConsole(errorMessage, sourceURL, lineNumber , columnNumber, callStack); 182 WorkerGlobalScope::logExceptionToConsole(errorMessage, sourceURL, lineNumber , columnNumber, callStack);
183 addMessageToWorkerConsole(JSMessageSource, ErrorMessageLevel, errorMessage, sourceURL, lineNumber, callStack, 0); 183 addMessageToWorkerConsole(JSMessageSource, ErrorMessageLevel, errorMessage, sourceURL, lineNumber, callStack, 0);
184 } 184 }
185 185
186 } // namespace blink 186 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698