Index: content/browser/service_worker/cache_storage_dispatcher_host.h |
diff --git a/content/browser/service_worker/cache_storage_dispatcher_host.h b/content/browser/service_worker/cache_storage_dispatcher_host.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..0c674a760e61d3776ff749dddde8e951c8d0d93e |
--- /dev/null |
+++ b/content/browser/service_worker/cache_storage_dispatcher_host.h |
@@ -0,0 +1,50 @@ |
+// Copyright 2015 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef CONTENT_BROWSER_SERVICE_WORKER_CACHE_STORAGE_DISPATCHER_HOST_H_ |
+#define CONTENT_BROWSER_SERVICE_WORKER_CACHE_STORAGE_DISPATCHER_HOST_H_ |
+ |
+#include "content/public/browser/browser_message_filter.h" |
+ |
+namespace content { |
+ |
+class CacheStorageContextImpl; |
+class ServiceWorkerCacheListener; |
+ |
+// Handles Cache Storage related messages sent to the browser process from |
+// child processes. One host instance exists per child process. All |
+// messages are processed on the IO thread. Currently, all messages are |
+// passed directly to the owned ServiceWorkerCacheListener instance, which |
+// in turn dispatches calls to the ServiceWorkerCacheStorageManager owned |
+// by the CacheStorageContextImpl for the entire browsing context. |
+// TODO(jsbell): Merge this with ServiceWorkerCacheListener crbug.com/439389 |
+class CONTENT_EXPORT CacheStorageDispatcherHost : public BrowserMessageFilter { |
+ public: |
+ CacheStorageDispatcherHost(); |
+ |
+ // Runs on UI thread. |
+ void Init(CacheStorageContextImpl* context); |
+ |
+ // BrowserMessageFilter implementation |
+ void OnDestruct() const override; |
+ bool OnMessageReceived(const IPC::Message& message) override; |
+ |
+ private: |
+ // Friends to allow OnDestruct() delegation |
+ friend class BrowserThread; |
+ friend class base::DeleteHelper<CacheStorageDispatcherHost>; |
+ |
+ ~CacheStorageDispatcherHost() override; |
+ |
+ // Called by Init() on IO thread. |
+ void CreateCacheListener(CacheStorageContextImpl* context); |
+ |
+ scoped_ptr<ServiceWorkerCacheListener> cache_listener_; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(CacheStorageDispatcherHost); |
+}; |
+ |
+} // namespace content |
+ |
+#endif // CONTENT_BROWSER_SERVICE_WORKER_CACHE_STORAGE_DISPATCHER_HOST_H_ |