Index: Source/modules/serviceworkers/InspectorServiceWorkerCacheAgent.cpp |
diff --git a/Source/modules/serviceworkers/InspectorServiceWorkerCacheAgent.cpp b/Source/modules/serviceworkers/InspectorServiceWorkerCacheAgent.cpp |
index f05db4438ca3e496554b4c3414bb883a95de6c5d..64f7d6fd5c436802d59112c68958f3aeac981434 100644 |
--- a/Source/modules/serviceworkers/InspectorServiceWorkerCacheAgent.cpp |
+++ b/Source/modules/serviceworkers/InspectorServiceWorkerCacheAgent.cpp |
@@ -7,11 +7,10 @@ |
#include "core/InspectorBackendDispatcher.h" |
#include "core/InspectorTypeBuilder.h" |
-#include "modules/serviceworkers/ServiceWorkerGlobalScope.h" |
-#include "modules/serviceworkers/ServiceWorkerGlobalScopeClient.h" |
#include "platform/JSONValues.h" |
#include "platform/heap/Handle.h" |
#include "platform/weborigin/DatabaseIdentifier.h" |
+#include "platform/weborigin/SecurityOrigin.h" |
#include "public/platform/Platform.h" |
#include "public/platform/WebServiceWorkerCache.h" |
#include "public/platform/WebServiceWorkerCacheError.h" |
@@ -32,26 +31,25 @@ |
#include <algorithm> |
using blink::TypeBuilder::Array; |
-using blink::TypeBuilder::ServiceWorkerCache::DataEntry; |
+using blink::TypeBuilder::CacheStorage::DataEntry; |
-typedef blink::InspectorBackendDispatcher::ServiceWorkerCacheCommandHandler::DeleteCacheCallback DeleteCacheCallback; |
-typedef blink::InspectorBackendDispatcher::ServiceWorkerCacheCommandHandler::RequestCacheNamesCallback RequestCacheNamesCallback; |
-typedef blink::InspectorBackendDispatcher::ServiceWorkerCacheCommandHandler::RequestEntriesCallback RequestEntriesCallback; |
+typedef blink::InspectorBackendDispatcher::CacheStorageCommandHandler::DeleteCacheCallback DeleteCacheCallback; |
+typedef blink::InspectorBackendDispatcher::CacheStorageCommandHandler::RequestCacheNamesCallback RequestCacheNamesCallback; |
+typedef blink::InspectorBackendDispatcher::CacheStorageCommandHandler::RequestEntriesCallback RequestEntriesCallback; |
typedef blink::InspectorBackendDispatcher::CallbackBase RequestCallback; |
namespace blink { |
namespace { |
-PassOwnPtr<WebServiceWorkerCacheStorage> assertCacheStorage(ErrorString* errorString, ServiceWorkerGlobalScope* globalScope) |
+WebServiceWorkerCacheStorage* assertCacheStorage(ErrorString* errorString, const String& securityOrigin) |
{ |
- String identifier = createDatabaseIdentifierFromSecurityOrigin(globalScope->securityOrigin()); |
- OwnPtr<WebServiceWorkerCacheStorage> caches = adoptPtr(Platform::current()->cacheStorage(identifier)); |
- if (!caches) { |
- *errorString = "Cache Storage not available in global scope."; |
- return nullptr; |
- } |
- return caches.release(); |
+ RefPtr<SecurityOrigin> secOrigin = SecurityOrigin::createFromString(securityOrigin); |
+ String identifier = createDatabaseIdentifierFromSecurityOrigin(secOrigin.get()); |
+ WebServiceWorkerCacheStorage* cache = Platform::current()->cacheStorage(identifier); |
horo
2015/04/03 01:23:46
nit: unnecessary apace after =
horo
2015/04/03 01:23:46
Who deletes this |cache|?
https://code.google.com
jsbell
2015/04/03 03:21:08
Agreed - this this should keep the PassOwnPtr<WebS
dmurph
2015/04/08 19:35:35
Done.
|
+ if (!cache) |
+ *errorString = "Could not find cache storage."; |
+ return cache; |
} |
CString serviceWorkerCacheErrorString(WebServiceWorkerCacheError* error) |
@@ -290,9 +288,8 @@ private: |
} // namespace |
-InspectorServiceWorkerCacheAgent::InspectorServiceWorkerCacheAgent(ServiceWorkerGlobalScope* scope) |
- : InspectorBaseAgent<blink::InspectorServiceWorkerCacheAgent, InspectorFrontend::ServiceWorkerCache>("ServiceWorkerCache") |
- , m_globalScope(scope) |
+InspectorServiceWorkerCacheAgent::InspectorServiceWorkerCacheAgent() |
+ : InspectorBaseAgent<InspectorServiceWorkerCacheAgent, InspectorFrontend::CacheStorage>("CacheStorage") |
{ |
} |
@@ -303,9 +300,9 @@ DEFINE_TRACE(InspectorServiceWorkerCacheAgent) |
InspectorBaseAgent::trace(visitor); |
} |
-void InspectorServiceWorkerCacheAgent::requestCacheNames(ErrorString* errorString, PassRefPtrWillBeRawPtr<RequestCacheNamesCallback> callback) |
+void InspectorServiceWorkerCacheAgent::requestCacheNames(ErrorString* errorString, const String& securityOrigin, PassRefPtrWillBeRawPtr<RequestCacheNamesCallback> callback) |
{ |
- OwnPtr<WebServiceWorkerCacheStorage> cache = assertCacheStorage(errorString, m_globalScope); |
+ WebServiceWorkerCacheStorage* cache = assertCacheStorage(errorString, securityOrigin); |
if (!cache) { |
callback->sendFailure(*errorString); |
return; |
@@ -313,10 +310,9 @@ void InspectorServiceWorkerCacheAgent::requestCacheNames(ErrorString* errorStrin |
cache->dispatchKeys(new RequestCacheNames(callback)); |
} |
- |
-void InspectorServiceWorkerCacheAgent::requestEntries(ErrorString* errorString, const String& cacheName, int skipCount, int pageSize, PassRefPtrWillBeRawPtr<RequestEntriesCallback> callback) |
+void InspectorServiceWorkerCacheAgent::requestEntries(ErrorString* errorString, const String& securityOrigin, const String& cacheName, int skipCount, int pageSize, PassRefPtrWillBeRawPtr<RequestEntriesCallback> callback) |
{ |
- OwnPtr<WebServiceWorkerCacheStorage> cache = assertCacheStorage(errorString, m_globalScope); |
+ WebServiceWorkerCacheStorage* cache = assertCacheStorage(errorString, securityOrigin); |
if (!cache) { |
callback->sendFailure(*errorString); |
return; |
@@ -328,9 +324,9 @@ void InspectorServiceWorkerCacheAgent::requestEntries(ErrorString* errorString, |
cache->dispatchOpen(new GetCacheForRequestData(params, callback), WebString(cacheName)); |
} |
-void InspectorServiceWorkerCacheAgent::deleteCache(ErrorString* errorString, const String& cacheName, PassRefPtrWillBeRawPtr<DeleteCacheCallback> callback) |
+void InspectorServiceWorkerCacheAgent::deleteCache(ErrorString* errorString, const String& securityOrigin, const String& cacheName, PassRefPtrWillBeRawPtr<DeleteCacheCallback> callback) |
{ |
- OwnPtr<WebServiceWorkerCacheStorage> cache = assertCacheStorage(errorString, m_globalScope); |
+ WebServiceWorkerCacheStorage* cache = assertCacheStorage(errorString, securityOrigin); |
if (!cache) { |
callback->sendFailure(*errorString); |
return; |