Simplify ChildProcessLauncher
[chromium-blink-merge.git] / content / browser / service_worker / cache_storage_dispatcher_host.h
blob0c674a760e61d3776ff749dddde8e951c8d0d93e
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 #ifndef CONTENT_BROWSER_SERVICE_WORKER_CACHE_STORAGE_DISPATCHER_HOST_H_
6 #define CONTENT_BROWSER_SERVICE_WORKER_CACHE_STORAGE_DISPATCHER_HOST_H_
8 #include "content/public/browser/browser_message_filter.h"
10 namespace content {
12 class CacheStorageContextImpl;
13 class ServiceWorkerCacheListener;
15 // Handles Cache Storage related messages sent to the browser process from
16 // child processes. One host instance exists per child process. All
17 // messages are processed on the IO thread. Currently, all messages are
18 // passed directly to the owned ServiceWorkerCacheListener instance, which
19 // in turn dispatches calls to the ServiceWorkerCacheStorageManager owned
20 // by the CacheStorageContextImpl for the entire browsing context.
21 // TODO(jsbell): Merge this with ServiceWorkerCacheListener crbug.com/439389
22 class CONTENT_EXPORT CacheStorageDispatcherHost : public BrowserMessageFilter {
23 public:
24 CacheStorageDispatcherHost();
26 // Runs on UI thread.
27 void Init(CacheStorageContextImpl* context);
29 // BrowserMessageFilter implementation
30 void OnDestruct() const override;
31 bool OnMessageReceived(const IPC::Message& message) override;
33 private:
34 // Friends to allow OnDestruct() delegation
35 friend class BrowserThread;
36 friend class base::DeleteHelper<CacheStorageDispatcherHost>;
38 ~CacheStorageDispatcherHost() override;
40 // Called by Init() on IO thread.
41 void CreateCacheListener(CacheStorageContextImpl* context);
43 scoped_ptr<ServiceWorkerCacheListener> cache_listener_;
45 DISALLOW_COPY_AND_ASSIGN(CacheStorageDispatcherHost);
48 } // namespace content
50 #endif // CONTENT_BROWSER_SERVICE_WORKER_CACHE_STORAGE_DISPATCHER_HOST_H_