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 "core/dom/DOMException.h" | 10 #include "core/dom/DOMException.h" |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
94 m_resolver->reject(Cache::domExceptionForCacheError(*reason)); | 94 m_resolver->reject(Cache::domExceptionForCacheError(*reason)); |
95 m_resolver.clear(); | 95 m_resolver.clear(); |
96 } | 96 } |
97 | 97 |
98 private: | 98 private: |
99 RefPtr<ScriptPromiseResolver> m_resolver; | 99 RefPtr<ScriptPromiseResolver> m_resolver; |
100 }; | 100 }; |
101 | 101 |
102 } | 102 } |
103 | 103 |
104 PassRefPtrWillBeRawPtr<CacheStorage> CacheStorage::create(WebServiceWorkerCacheS torage* webCacheStorage) | 104 CacheStorage* CacheStorage::create(WebServiceWorkerCacheStorage* webCacheStorage ) |
dominicc (has gone to gerrit)
2014/08/26 14:01:34
Now that this is a simple "new" can we remove this
haraken
2014/09/03 07:49:10
As far as I know, Blink prefers having a create me
| |
105 { | 105 { |
106 return adoptRefWillBeNoop(new CacheStorage(webCacheStorage)); | 106 return new CacheStorage(webCacheStorage); |
107 } | 107 } |
108 | 108 |
109 ScriptPromise CacheStorage::get(ScriptState* scriptState, const String& cacheNam e) | 109 ScriptPromise CacheStorage::get(ScriptState* scriptState, const String& cacheNam e) |
110 { | 110 { |
111 RefPtr<ScriptPromiseResolver> resolver = ScriptPromiseResolver::create(scrip tState); | 111 RefPtr<ScriptPromiseResolver> resolver = ScriptPromiseResolver::create(scrip tState); |
112 const ScriptPromise promise = resolver->promise(); | 112 const ScriptPromise promise = resolver->promise(); |
113 | 113 |
114 if (m_webCacheStorage) | 114 if (m_webCacheStorage) |
115 m_webCacheStorage->dispatchGet(new CacheStorageWithCacheCallbacks(resolv er), cacheName); | 115 m_webCacheStorage->dispatchGet(new CacheStorageWithCacheCallbacks(resolv er), cacheName); |
116 else | 116 else |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
170 | 170 |
171 return promise; | 171 return promise; |
172 } | 172 } |
173 | 173 |
174 CacheStorage::CacheStorage(WebServiceWorkerCacheStorage* webCacheStorage) : m_we bCacheStorage(webCacheStorage) | 174 CacheStorage::CacheStorage(WebServiceWorkerCacheStorage* webCacheStorage) : m_we bCacheStorage(webCacheStorage) |
175 { | 175 { |
176 ScriptWrappable::init(this); | 176 ScriptWrappable::init(this); |
177 } | 177 } |
178 | 178 |
179 } // namespace blink | 179 } // namespace blink |
OLD | NEW |