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 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 { | 89 { |
90 m_resolver->reject(CacheErrorToString(*reason)); | 90 m_resolver->reject(CacheErrorToString(*reason)); |
91 } | 91 } |
92 | 92 |
93 private: | 93 private: |
94 const RefPtr<ScriptPromiseResolver> m_resolver; | 94 const RefPtr<ScriptPromiseResolver> m_resolver; |
95 }; | 95 }; |
96 | 96 |
97 } | 97 } |
98 | 98 |
99 PassRefPtrWillBeRawPtr<CacheStorage> CacheStorage::create(WebServiceWorkerCacheS
torage* webCacheStorage) | 99 CacheStorage* CacheStorage::create(WebServiceWorkerCacheStorage* webCacheStorage
) |
100 { | 100 { |
101 return adoptRefWillBeNoop(new CacheStorage(webCacheStorage)); | 101 return new CacheStorage(webCacheStorage); |
102 } | 102 } |
103 | 103 |
104 ScriptPromise CacheStorage::get(ScriptState* scriptState, const String& cacheNam
e) | 104 ScriptPromise CacheStorage::get(ScriptState* scriptState, const String& cacheNam
e) |
105 { | 105 { |
106 RefPtr<ScriptPromiseResolver> resolver = ScriptPromiseResolver::create(scrip
tState); | 106 RefPtr<ScriptPromiseResolver> resolver = ScriptPromiseResolver::create(scrip
tState); |
107 const ScriptPromise promise = resolver->promise(); | 107 const ScriptPromise promise = resolver->promise(); |
108 | 108 |
109 if (m_webCacheStorage) | 109 if (m_webCacheStorage) |
110 m_webCacheStorage->dispatchGet(new CacheStorageWithCacheCallbacks(resolv
er), cacheName); | 110 m_webCacheStorage->dispatchGet(new CacheStorageWithCacheCallbacks(resolv
er), cacheName); |
111 else | 111 else |
(...skipping 53 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 |