| 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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 }; | 52 }; |
| 53 | 53 |
| 54 class CacheStorageWithCacheCallbacks : public WebServiceWorkerCacheStorage::Cach
eStorageWithCacheCallbacks { | 54 class CacheStorageWithCacheCallbacks : public WebServiceWorkerCacheStorage::Cach
eStorageWithCacheCallbacks { |
| 55 WTF_MAKE_NONCOPYABLE(CacheStorageWithCacheCallbacks); | 55 WTF_MAKE_NONCOPYABLE(CacheStorageWithCacheCallbacks); |
| 56 public: | 56 public: |
| 57 explicit CacheStorageWithCacheCallbacks(PassRefPtr<ScriptPromiseResolver> re
solver) : m_resolver(resolver) { } | 57 explicit CacheStorageWithCacheCallbacks(PassRefPtr<ScriptPromiseResolver> re
solver) : m_resolver(resolver) { } |
| 58 virtual ~CacheStorageWithCacheCallbacks() { } | 58 virtual ~CacheStorageWithCacheCallbacks() { } |
| 59 | 59 |
| 60 virtual void onSuccess(WebServiceWorkerCache* cache) OVERRIDE | 60 virtual void onSuccess(WebServiceWorkerCache* cache) OVERRIDE |
| 61 { | 61 { |
| 62 // FIXME: Remove this once content's WebServiceWorkerCache implementatio
n has landed. |
| 63 if (!cache) { |
| 64 m_resolver->reject("not implemented"); |
| 65 return; |
| 66 } |
| 62 m_resolver->resolve(Cache::fromWebServiceWorkerCache(cache)); | 67 m_resolver->resolve(Cache::fromWebServiceWorkerCache(cache)); |
| 63 } | 68 } |
| 64 | 69 |
| 65 virtual void onError(WebServiceWorkerCacheError* reason) OVERRIDE | 70 virtual void onError(WebServiceWorkerCacheError* reason) OVERRIDE |
| 66 { | 71 { |
| 67 m_resolver->reject(cacheErrorToString(*reason)); | 72 m_resolver->reject(cacheErrorToString(*reason)); |
| 68 } | 73 } |
| 69 | 74 |
| 70 private: | 75 private: |
| 71 const RefPtr<ScriptPromiseResolver> m_resolver; | 76 const RefPtr<ScriptPromiseResolver> m_resolver; |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 165 | 170 |
| 166 return promise; | 171 return promise; |
| 167 } | 172 } |
| 168 | 173 |
| 169 CacheStorage::CacheStorage(WebServiceWorkerCacheStorage* webCacheStorage) : m_we
bCacheStorage(webCacheStorage) | 174 CacheStorage::CacheStorage(WebServiceWorkerCacheStorage* webCacheStorage) : m_we
bCacheStorage(webCacheStorage) |
| 170 { | 175 { |
| 171 ScriptWrappable::init(this); | 176 ScriptWrappable::init(this); |
| 172 } | 177 } |
| 173 | 178 |
| 174 } // namespace blink | 179 } // namespace blink |
| OLD | NEW |