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

Side by Side Diff: Source/modules/serviceworkers/CacheStorage.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 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "config.h" 5 #include "config.h"
6 #include "modules/serviceworkers/CacheStorage.h" 6 #include "modules/serviceworkers/CacheStorage.h"
7 7
8 #include "bindings/core/v8/ScriptPromiseResolver.h" 8 #include "bindings/core/v8/ScriptPromiseResolver.h"
9 #include "bindings/core/v8/ScriptState.h" 9 #include "bindings/core/v8/ScriptState.h"
10 #include "core/dom/DOMException.h" 10 #include "core/dom/DOMException.h"
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 m_resolver->reject(Cache::domExceptionForCacheError(*reason)); 167 m_resolver->reject(Cache::domExceptionForCacheError(*reason));
168 m_resolver.clear(); 168 m_resolver.clear();
169 } 169 }
170 170
171 private: 171 private:
172 RefPtrWillBePersistent<ScriptPromiseResolver> m_resolver; 172 RefPtrWillBePersistent<ScriptPromiseResolver> m_resolver;
173 }; 173 };
174 174
175 CacheStorage* CacheStorage::create(WebServiceWorkerCacheStorage* webCacheStorage ) 175 CacheStorage* CacheStorage::create(WebServiceWorkerCacheStorage* webCacheStorage )
176 { 176 {
177 return new CacheStorage(webCacheStorage); 177 return new CacheStorage(adoptPtr(webCacheStorage));
178 } 178 }
179 179
180 ScriptPromise CacheStorage::open(ScriptState* scriptState, const String& cacheNa me) 180 ScriptPromise CacheStorage::open(ScriptState* scriptState, const String& cacheNa me)
181 { 181 {
182 RefPtrWillBeRawPtr<ScriptPromiseResolver> resolver = ScriptPromiseResolver:: create(scriptState); 182 RefPtrWillBeRawPtr<ScriptPromiseResolver> resolver = ScriptPromiseResolver:: create(scriptState);
183 const ScriptPromise promise = resolver->promise(); 183 const ScriptPromise promise = resolver->promise();
184 184
185 if (m_nameToCacheMap.contains(cacheName)) { 185 if (m_nameToCacheMap.contains(cacheName)) {
186 Cache* cache = m_nameToCacheMap.find(cacheName)->value; 186 Cache* cache = m_nameToCacheMap.find(cacheName)->value;
187 resolver->resolve(cache); 187 resolver->resolve(cache);
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
266 resolver->reject(createNoImplementationException()); 266 resolver->reject(createNoImplementationException());
267 267
268 return promise; 268 return promise;
269 } 269 }
270 270
271 DEFINE_TRACE(CacheStorage) 271 DEFINE_TRACE(CacheStorage)
272 { 272 {
273 visitor->trace(m_nameToCacheMap); 273 visitor->trace(m_nameToCacheMap);
274 } 274 }
275 275
276 CacheStorage::CacheStorage(WebServiceWorkerCacheStorage* webCacheStorage) 276 CacheStorage::CacheStorage(PassOwnPtr<WebServiceWorkerCacheStorage> webCacheStor age)
277 : m_webCacheStorage(webCacheStorage) 277 : m_webCacheStorage(webCacheStorage)
278 { 278 {
279 } 279 }
280 280
281 } // namespace blink 281 } // namespace blink
OLDNEW
« no previous file with comments | « Source/modules/serviceworkers/CacheStorage.h ('k') | Source/modules/serviceworkers/InspectorServiceWorkerCacheAgent.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698