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

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

Issue 434543002: Introducing the ServiceWorker Cache object. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: update to trunk 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
« no previous file with comments | « Source/modules/serviceworkers/Cache.idl ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "modules/serviceworkers/Cache.h"
10 #include "public/platform/WebServiceWorkerCacheError.h" 11 #include "public/platform/WebServiceWorkerCacheError.h"
11 #include "public/platform/WebServiceWorkerCacheStorage.h" 12 #include "public/platform/WebServiceWorkerCacheStorage.h"
12 13
13 namespace blink { 14 namespace blink {
14 15
15 namespace { 16 namespace {
16 17
17 const char* CacheErrorToString(WebServiceWorkerCacheError reason) 18 const char* CacheErrorToString(WebServiceWorkerCacheError reason)
18 { 19 {
19 // FIXME: Construct correct DOM error objects rather than returning strings. 20 // FIXME: Construct correct DOM error objects rather than returning strings.
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 }; 52 };
52 53
53 class CacheStorageWithCacheCallbacks : public WebServiceWorkerCacheStorage::Cach eStorageWithCacheCallbacks { 54 class CacheStorageWithCacheCallbacks : public WebServiceWorkerCacheStorage::Cach eStorageWithCacheCallbacks {
54 WTF_MAKE_NONCOPYABLE(CacheStorageWithCacheCallbacks); 55 WTF_MAKE_NONCOPYABLE(CacheStorageWithCacheCallbacks);
55 public: 56 public:
56 explicit CacheStorageWithCacheCallbacks(PassRefPtr<ScriptPromiseResolver> re solver) : m_resolver(resolver) { } 57 explicit CacheStorageWithCacheCallbacks(PassRefPtr<ScriptPromiseResolver> re solver) : m_resolver(resolver) { }
57 virtual ~CacheStorageWithCacheCallbacks() { } 58 virtual ~CacheStorageWithCacheCallbacks() { }
58 59
59 virtual void onSuccess(WebServiceWorkerCache* cache) OVERRIDE 60 virtual void onSuccess(WebServiceWorkerCache* cache) OVERRIDE
60 { 61 {
61 // FIXME: There should be a blink side of the Cache object implementatio n here, rather than 62 m_resolver->resolve(Cache::fromWebServiceWorkerCache(cache));
62 // this nonsensical return.
63 m_resolver->resolve("succesfully returned a cache");
64 } 63 }
65 64
66 virtual void onError(WebServiceWorkerCacheError* reason) OVERRIDE 65 virtual void onError(WebServiceWorkerCacheError* reason) OVERRIDE
67 { 66 {
68 m_resolver->reject(CacheErrorToString(*reason)); 67 m_resolver->reject(CacheErrorToString(*reason));
69 } 68 }
70 69
71 private: 70 private:
72 const RefPtr<ScriptPromiseResolver> m_resolver; 71 const RefPtr<ScriptPromiseResolver> m_resolver;
73 }; 72 };
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
166 165
167 return promise; 166 return promise;
168 } 167 }
169 168
170 CacheStorage::CacheStorage(WebServiceWorkerCacheStorage* webCacheStorage) : m_we bCacheStorage(webCacheStorage) 169 CacheStorage::CacheStorage(WebServiceWorkerCacheStorage* webCacheStorage) : m_we bCacheStorage(webCacheStorage)
171 { 170 {
172 ScriptWrappable::init(this); 171 ScriptWrappable::init(this);
173 } 172 }
174 173
175 } // namespace blink 174 } // namespace blink
OLDNEW
« no previous file with comments | « Source/modules/serviceworkers/Cache.idl ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698