OLD | NEW |
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 "modules/serviceworkers/Cache.h" |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 private: | 70 private: |
71 const RefPtr<ScriptPromiseResolver> m_resolver; | 71 const RefPtr<ScriptPromiseResolver> m_resolver; |
72 }; | 72 }; |
73 | 73 |
74 class CacheStorageKeysCallbacks : public WebServiceWorkerCacheStorage::CacheStor
ageKeysCallbacks { | 74 class CacheStorageKeysCallbacks : public WebServiceWorkerCacheStorage::CacheStor
ageKeysCallbacks { |
75 WTF_MAKE_NONCOPYABLE(CacheStorageKeysCallbacks); | 75 WTF_MAKE_NONCOPYABLE(CacheStorageKeysCallbacks); |
76 public: | 76 public: |
77 explicit CacheStorageKeysCallbacks(PassRefPtr<ScriptPromiseResolver> resolve
r) : m_resolver(resolver) { } | 77 explicit CacheStorageKeysCallbacks(PassRefPtr<ScriptPromiseResolver> resolve
r) : m_resolver(resolver) { } |
78 virtual ~CacheStorageKeysCallbacks() { } | 78 virtual ~CacheStorageKeysCallbacks() { } |
79 | 79 |
80 virtual void onSuccess(blink::WebVector<blink::WebString>* keys) OVERRIDE | 80 virtual void onSuccess(WebVector<WebString>* keys) OVERRIDE |
81 { | 81 { |
82 Vector<String> wtfKeys; | 82 Vector<String> wtfKeys; |
83 for (size_t i = 0; i < keys->size(); ++i) | 83 for (size_t i = 0; i < keys->size(); ++i) |
84 wtfKeys.append((*keys)[i]); | 84 wtfKeys.append((*keys)[i]); |
85 m_resolver->resolve(wtfKeys); | 85 m_resolver->resolve(wtfKeys); |
86 } | 86 } |
87 | 87 |
88 virtual void onError(WebServiceWorkerCacheError* reason) OVERRIDE | 88 virtual void onError(WebServiceWorkerCacheError* reason) OVERRIDE |
89 { | 89 { |
90 m_resolver->reject(CacheErrorToString(*reason)); | 90 m_resolver->reject(CacheErrorToString(*reason)); |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
165 | 165 |
166 return promise; | 166 return promise; |
167 } | 167 } |
168 | 168 |
169 CacheStorage::CacheStorage(WebServiceWorkerCacheStorage* webCacheStorage) : m_we
bCacheStorage(webCacheStorage) | 169 CacheStorage::CacheStorage(WebServiceWorkerCacheStorage* webCacheStorage) : m_we
bCacheStorage(webCacheStorage) |
170 { | 170 { |
171 ScriptWrappable::init(this); | 171 ScriptWrappable::init(this); |
172 } | 172 } |
173 | 173 |
174 } // namespace blink | 174 } // namespace blink |
OLD | NEW |