1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "content/renderer/cache_storage/webserviceworkercachestorage_impl.h"
7 #include "content/child/thread_safe_sender.h"
8 #include "content/renderer/cache_storage/cache_storage_dispatcher.h"
9 #include "third_party/WebKit/public/platform/WebHTTPHeaderVisitor.h"
10 #include "third_party/WebKit/public/platform/modules/serviceworker/WebServiceWorkerCache.h"
11 #include "third_party/WebKit/public/platform/modules/serviceworker/WebServiceWorkerRequest.h"
12 #include "third_party/WebKit/public/platform/modules/serviceworker/WebServiceWorkerResponse.h"
14 using base::TimeTicks
;
18 WebServiceWorkerCacheStorageImpl::WebServiceWorkerCacheStorageImpl(
19 ThreadSafeSender
* thread_safe_sender
,
21 : thread_safe_sender_(thread_safe_sender
), origin_(origin
) {
24 WebServiceWorkerCacheStorageImpl::~WebServiceWorkerCacheStorageImpl() {
27 void WebServiceWorkerCacheStorageImpl::dispatchHas(
28 CacheStorageCallbacks
* callbacks
,
29 const blink::WebString
& cacheName
) {
30 GetDispatcher()->dispatchHas(callbacks
, origin_
, cacheName
);
33 void WebServiceWorkerCacheStorageImpl::dispatchOpen(
34 CacheStorageWithCacheCallbacks
* callbacks
,
35 const blink::WebString
& cacheName
) {
36 GetDispatcher()->dispatchOpen(callbacks
, origin_
, cacheName
);
39 void WebServiceWorkerCacheStorageImpl::dispatchDelete(
40 CacheStorageCallbacks
* callbacks
,
41 const blink::WebString
& cacheName
) {
42 GetDispatcher()->dispatchDelete(callbacks
, origin_
, cacheName
);
45 void WebServiceWorkerCacheStorageImpl::dispatchKeys(
46 CacheStorageKeysCallbacks
* callbacks
) {
47 GetDispatcher()->dispatchKeys(callbacks
, origin_
);
50 void WebServiceWorkerCacheStorageImpl::dispatchMatch(
51 CacheStorageMatchCallbacks
* callbacks
,
52 const blink::WebServiceWorkerRequest
& request
,
53 const blink::WebServiceWorkerCache::QueryParams
& query_params
) {
54 GetDispatcher()->dispatchMatch(callbacks
, origin_
, request
, query_params
);
57 CacheStorageDispatcher
* WebServiceWorkerCacheStorageImpl::GetDispatcher()
59 return CacheStorageDispatcher::ThreadSpecificInstance(
60 thread_safe_sender_
.get());
63 } // namespace content