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

Unified Diff: Source/modules/cachestorage/CacheStorage.cpp

Issue 1284173004: [CacheStorage] Use appopriate type parameters for WebCallbacks (1/3). (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/modules/cachestorage/Cache.cpp ('k') | Source/modules/cachestorage/CacheTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/modules/cachestorage/CacheStorage.cpp
diff --git a/Source/modules/cachestorage/CacheStorage.cpp b/Source/modules/cachestorage/CacheStorage.cpp
index 347629b773c3dc18759d2b904868d5dd65bdab4a..40b2da2379503a8e239f1cbfa5a624551b5b7bc8 100644
--- a/Source/modules/cachestorage/CacheStorage.cpp
+++ b/Source/modules/cachestorage/CacheStorage.cpp
@@ -58,15 +58,14 @@ public:
}
// Ownership of |rawReason| must be passed.
nhiroki 2015/08/19 11:25:14 nit: Can you remove this comment?
yhirano 2015/08/19 11:34:58 Done.
- void onError(WebServiceWorkerCacheError* rawReason) override
+ void onError(WebServiceWorkerCacheError reason) override
{
- OwnPtr<WebServiceWorkerCacheError> reason = adoptPtr(rawReason);
if (!m_resolver->executionContext() || m_resolver->executionContext()->activeDOMObjectsAreStopped())
return;
- if (*reason == WebServiceWorkerCacheErrorNotFound)
+ if (reason == WebServiceWorkerCacheErrorNotFound)
m_resolver->resolve(false);
else
- m_resolver->reject(CacheStorageError::createException(*reason));
+ m_resolver->reject(CacheStorageError::createException(reason));
m_resolver.clear();
}
@@ -82,10 +81,9 @@ public:
: m_cacheName(cacheName), m_cacheStorage(cacheStorage), m_resolver(resolver) { }
~WithCacheCallbacks() override { }
- // Ownership of |rawWebCache| must be passed.
- void onSuccess(WebServiceWorkerCache* rawWebCache) override
+ void onSuccess(WebPassOwnPtr<WebServiceWorkerCache> rawWebCache) override
{
- OwnPtr<WebServiceWorkerCache> webCache = adoptPtr(rawWebCache);
+ OwnPtr<WebServiceWorkerCache> webCache = rawWebCache.release();
nhiroki 2015/08/19 11:25:14 How about removing this indirection and directly p
yhirano 2015/08/19 11:34:58 Done.
if (!m_resolver->executionContext() || m_resolver->executionContext()->activeDOMObjectsAreStopped())
return;
// FIXME: Remove this once content's WebServiceWorkerCache implementation has landed.
@@ -99,16 +97,14 @@ public:
m_resolver.clear();
}
- // Ownership of |rawReason| must be passed.
- void onError(WebServiceWorkerCacheError* rawReason) override
+ void onError(WebServiceWorkerCacheError reason) override
{
- OwnPtr<WebServiceWorkerCacheError> reason = adoptPtr(rawReason);
if (!m_resolver->executionContext() || m_resolver->executionContext()->activeDOMObjectsAreStopped())
return;
- if (*reason == WebServiceWorkerCacheErrorNotFound)
+ if (reason == WebServiceWorkerCacheErrorNotFound)
m_resolver->resolve();
else
- m_resolver->reject(CacheStorageError::createException(*reason));
+ m_resolver->reject(CacheStorageError::createException(reason));
m_resolver.clear();
}
@@ -125,24 +121,22 @@ public:
explicit MatchCallbacks(ScriptPromiseResolver* resolver)
: m_resolver(resolver) { }
- void onSuccess(WebServiceWorkerResponse* webResponse) override
+ void onSuccess(const WebServiceWorkerResponse& webResponse) override
{
if (!m_resolver->executionContext() || m_resolver->executionContext()->activeDOMObjectsAreStopped())
return;
- m_resolver->resolve(Response::create(m_resolver->scriptState()->executionContext(), *webResponse));
+ m_resolver->resolve(Response::create(m_resolver->scriptState()->executionContext(), webResponse));
m_resolver.clear();
}
- // Ownership of |rawReason| must be passed.
- void onError(WebServiceWorkerCacheError* rawReason) override
+ void onError(WebServiceWorkerCacheError reason) override
{
- OwnPtr<WebServiceWorkerCacheError> reason = adoptPtr(rawReason);
if (!m_resolver->executionContext() || m_resolver->executionContext()->activeDOMObjectsAreStopped())
return;
- if (*reason == WebServiceWorkerCacheErrorNotFound)
+ if (reason == WebServiceWorkerCacheErrorNotFound)
m_resolver->resolve();
else
- m_resolver->reject(CacheStorageError::createException(*reason));
+ m_resolver->reject(CacheStorageError::createException(reason));
m_resolver.clear();
}
@@ -168,16 +162,14 @@ public:
m_resolver.clear();
}
- // Ownership of |rawReason| must be passed.
- void onError(WebServiceWorkerCacheError* rawReason) override
+ void onError(WebServiceWorkerCacheError reason) override
{
- OwnPtr<WebServiceWorkerCacheError> reason = adoptPtr(rawReason);
if (!m_resolver->executionContext() || m_resolver->executionContext()->activeDOMObjectsAreStopped())
return;
- if (*reason == WebServiceWorkerCacheErrorNotFound)
+ if (reason == WebServiceWorkerCacheErrorNotFound)
m_resolver->resolve(false);
else
- m_resolver->reject(CacheStorageError::createException(*reason));
+ m_resolver->reject(CacheStorageError::createException(reason));
m_resolver.clear();
}
@@ -195,24 +187,22 @@ public:
: m_resolver(resolver) { }
~KeysCallbacks() override { }
- void onSuccess(WebVector<WebString>* keys) override
+ void onSuccess(const WebVector<WebString>& keys) override
{
if (!m_resolver->executionContext() || m_resolver->executionContext()->activeDOMObjectsAreStopped())
return;
Vector<String> wtfKeys;
- for (size_t i = 0; i < keys->size(); ++i)
- wtfKeys.append((*keys)[i]);
+ for (size_t i = 0; i < keys.size(); ++i)
+ wtfKeys.append(keys[i]);
m_resolver->resolve(wtfKeys);
m_resolver.clear();
}
- // Ownership of |rawReason| must be passed.
- void onError(WebServiceWorkerCacheError* rawReason) override
+ void onError(WebServiceWorkerCacheError reason) override
{
- OwnPtr<WebServiceWorkerCacheError> reason = adoptPtr(rawReason);
if (!m_resolver->executionContext() || m_resolver->executionContext()->activeDOMObjectsAreStopped())
return;
- m_resolver->reject(CacheStorageError::createException(*reason));
+ m_resolver->reject(CacheStorageError::createException(reason));
m_resolver.clear();
}
« no previous file with comments | « Source/modules/cachestorage/Cache.cpp ('k') | Source/modules/cachestorage/CacheTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698