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

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

Issue 434543002: Introducing the ServiceWorker Cache object. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: 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 // 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/FetchStores.h" 6 #include "modules/serviceworkers/FetchStores.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/FetchStore.h"
10 #include "public/platform/WebServiceWorkerFetchStores.h" 11 #include "public/platform/WebServiceWorkerFetchStores.h"
11 #include "public/platform/WebServiceWorkerFetchStoresError.h" 12 #include "public/platform/WebServiceWorkerFetchStoresError.h"
12 13
13 namespace blink { 14 namespace blink {
14 15
15 namespace { 16 namespace {
16 17
17 const char* FetchStoresErrorToString(WebServiceWorkerFetchStoresError reason) 18 const char* FetchStoresErrorToString(WebServiceWorkerFetchStoresError reason)
18 { 19 {
19 // TODO: Construct correct DOM error objects rather than returning strings. 20 // TODO: Construct correct DOM error objects rather than returning strings.
(...skipping 29 matching lines...) Expand all
49 const RefPtr<ScriptPromiseResolver> m_resolver; 50 const RefPtr<ScriptPromiseResolver> m_resolver;
50 }; 51 };
51 52
52 class FetchStoresWithFetchStoreCallbacks : public WebServiceWorkerFetchStores::F etchStoresWithFetchStoreCallbacks { 53 class FetchStoresWithFetchStoreCallbacks : public WebServiceWorkerFetchStores::F etchStoresWithFetchStoreCallbacks {
53 public: 54 public:
54 FetchStoresWithFetchStoreCallbacks(PassRefPtr<ScriptPromiseResolver> resolve r) : m_resolver(resolver) { } 55 FetchStoresWithFetchStoreCallbacks(PassRefPtr<ScriptPromiseResolver> resolve r) : m_resolver(resolver) { }
55 virtual ~FetchStoresWithFetchStoreCallbacks() { } 56 virtual ~FetchStoresWithFetchStoreCallbacks() { }
56 57
57 virtual void onSuccess(int* fetchStoreID) OVERRIDE 58 virtual void onSuccess(int* fetchStoreID) OVERRIDE
58 { 59 {
59 // TODO: There should be a blink side of the Cache object implementation here, rather than 60 m_resolver->resolve(FetchStore::create(*fetchStoreID));
60 // this nonsensical pass through.
61 m_resolver->resolve(*fetchStoreID);
62 } 61 }
63 62
64 virtual void onError(WebServiceWorkerFetchStoresError* reason) OVERRIDE 63 virtual void onError(WebServiceWorkerFetchStoresError* reason) OVERRIDE
65 { 64 {
66 m_resolver->reject(FetchStoresErrorToString(*reason)); 65 m_resolver->reject(FetchStoresErrorToString(*reason));
67 } 66 }
68 67
69 private: 68 private:
70 const RefPtr<ScriptPromiseResolver> m_resolver; 69 const RefPtr<ScriptPromiseResolver> m_resolver;
71 }; 70 };
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 163
165 return promise; 164 return promise;
166 } 165 }
167 166
168 FetchStores::FetchStores(WebServiceWorkerFetchStores* webFetchStores) : m_webFet chStores(webFetchStores) 167 FetchStores::FetchStores(WebServiceWorkerFetchStores* webFetchStores) : m_webFet chStores(webFetchStores)
169 { 168 {
170 ScriptWrappable::init(this); 169 ScriptWrappable::init(this);
171 } 170 }
172 171
173 } // namespace blink 172 } // namespace blink
OLDNEW
« Source/modules/serviceworkers/FetchStore.idl ('K') | « Source/modules/serviceworkers/FetchStore.idl ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698