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

Unified Diff: Source/modules/serviceworkers/ServiceWorkerGlobalScope.cpp

Issue 1029423004: Cache Storage: Add Platform API to retrieve CacheStorage for origin (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Remove cruft, rename arg Created 5 years, 9 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
Index: Source/modules/serviceworkers/ServiceWorkerGlobalScope.cpp
diff --git a/Source/modules/serviceworkers/ServiceWorkerGlobalScope.cpp b/Source/modules/serviceworkers/ServiceWorkerGlobalScope.cpp
index 79931fd04bfc2e58bdfb4dfaf4ff190b434d54a9..5a2e75b00b6aff57b58b8db64f46ebb830c90cfa 100644
--- a/Source/modules/serviceworkers/ServiceWorkerGlobalScope.cpp
+++ b/Source/modules/serviceworkers/ServiceWorkerGlobalScope.cpp
@@ -53,6 +53,7 @@
#include "modules/serviceworkers/ServiceWorkerThread.h"
#include "modules/serviceworkers/WaitUntilObserver.h"
#include "platform/network/ResourceRequest.h"
+#include "platform/weborigin/DatabaseIdentifier.h"
#include "platform/weborigin/KURL.h"
#include "public/platform/WebServiceWorkerSkipWaitingCallbacks.h"
#include "public/platform/WebURL.h"
@@ -106,8 +107,11 @@ void ServiceWorkerGlobalScope::didEvaluateWorkerScript()
CacheStorage* ServiceWorkerGlobalScope::caches(ExecutionContext* context)
{
- if (!m_caches)
- m_caches = CacheStorage::create(ServiceWorkerGlobalScopeClient::from(context)->cacheStorage());
+ if (!m_caches) {
+ String identifier = createDatabaseIdentifierFromSecurityOrigin(context->securityOrigin());
+ ASSERT(!identifier.isEmpty());
+ m_caches = CacheStorage::create(Platform::current()->cacheStorage(identifier));
+ }
return m_caches;
}

Powered by Google App Engine
This is Rietveld 408576698