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

Side by Side Diff: Source/modules/cachestorage/Cache.cpp

Issue 1240763002: CallbackPromiseAdapter types should be more compatible with WebCallbacks (3/3). (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 5 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/cachestorage/Cache.h" 6 #include "modules/cachestorage/Cache.h"
7 7
8 #include "bindings/core/v8/CallbackPromiseAdapter.h" 8 #include "bindings/core/v8/CallbackPromiseAdapter.h"
9 #include "bindings/core/v8/ExceptionState.h" 9 #include "bindings/core/v8/ExceptionState.h"
10 #include "bindings/core/v8/ScriptPromiseResolver.h" 10 #include "bindings/core/v8/ScriptPromiseResolver.h"
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 public: 89 public:
90 CacheDeleteCallback(PassRefPtrWillBeRawPtr<ScriptPromiseResolver> resolver) 90 CacheDeleteCallback(PassRefPtrWillBeRawPtr<ScriptPromiseResolver> resolver)
91 : m_resolver(resolver) { } 91 : m_resolver(resolver) { }
92 92
93 void onSuccess() override 93 void onSuccess() override
94 { 94 {
95 m_resolver->resolve(true); 95 m_resolver->resolve(true);
96 m_resolver.clear(); 96 m_resolver.clear();
97 } 97 }
98 98
99 void onError(WebPassOwnPtr<WebServiceWorkerCacheError> rawReason) override 99 void onError(WebServiceWorkerCacheError reason) override
100 { 100 {
101 OwnPtr<WebServiceWorkerCacheError> reason = rawReason.release(); 101 if (reason == WebServiceWorkerCacheErrorNotFound)
102 if (*reason == WebServiceWorkerCacheErrorNotFound)
103 m_resolver->resolve(false); 102 m_resolver->resolve(false);
104 else 103 else
105 m_resolver->reject(CacheStorageError::createException(*reason)); 104 m_resolver->reject(CacheStorageError::createException(reason));
106 m_resolver.clear(); 105 m_resolver.clear();
107 } 106 }
108 107
109 private: 108 private:
110 RefPtrWillBePersistent<ScriptPromiseResolver> m_resolver; 109 RefPtrWillBePersistent<ScriptPromiseResolver> m_resolver;
111 }; 110 };
112 111
113 // FIXME: Consider using CallbackPromiseAdapter. 112 // FIXME: Consider using CallbackPromiseAdapter.
114 class CacheWithRequestsCallbacks : public WebServiceWorkerCache::CacheWithReques tsCallbacks { 113 class CacheWithRequestsCallbacks : public WebServiceWorkerCache::CacheWithReques tsCallbacks {
115 WTF_MAKE_NONCOPYABLE(CacheWithRequestsCallbacks); 114 WTF_MAKE_NONCOPYABLE(CacheWithRequestsCallbacks);
(...skipping 478 matching lines...) Expand 10 before | Expand all | Expand 10 after
594 m_webCache->dispatchKeys(new CacheWithRequestsCallbacks(resolver), 0, toWebQ ueryParams(options)); 593 m_webCache->dispatchKeys(new CacheWithRequestsCallbacks(resolver), 0, toWebQ ueryParams(options));
595 return promise; 594 return promise;
596 } 595 }
597 596
598 WebServiceWorkerCache* Cache::webCache() const 597 WebServiceWorkerCache* Cache::webCache() const
599 { 598 {
600 return m_webCache.get(); 599 return m_webCache.get();
601 } 600 }
602 601
603 } // namespace blink 602 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698