OLD | NEW |
(Empty) | |
| 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. |
| 4 |
| 5 #ifndef CONTENT_BROWSER_SERVICE_WORKER_CACHE_STORAGE_DISPATCHER_HOST_H_ |
| 6 #define CONTENT_BROWSER_SERVICE_WORKER_CACHE_STORAGE_DISPATCHER_HOST_H_ |
| 7 |
| 8 #include "content/public/browser/browser_message_filter.h" |
| 9 |
| 10 namespace content { |
| 11 |
| 12 class CacheStorageContextImpl; |
| 13 class ServiceWorkerCacheListener; |
| 14 |
| 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(); |
| 25 |
| 26 // Runs on UI thread. |
| 27 void Init(CacheStorageContextImpl* context); |
| 28 |
| 29 // BrowserMessageFilter implementation |
| 30 void OnDestruct() const override; |
| 31 bool OnMessageReceived(const IPC::Message& message) override; |
| 32 |
| 33 private: |
| 34 // Friends to allow OnDestruct() delegation |
| 35 friend class BrowserThread; |
| 36 friend class base::DeleteHelper<CacheStorageDispatcherHost>; |
| 37 |
| 38 ~CacheStorageDispatcherHost() override; |
| 39 |
| 40 // Called by Init() on IO thread. |
| 41 void CreateCacheListener(CacheStorageContextImpl* context); |
| 42 |
| 43 scoped_ptr<ServiceWorkerCacheListener> cache_listener_; |
| 44 |
| 45 DISALLOW_COPY_AND_ASSIGN(CacheStorageDispatcherHost); |
| 46 }; |
| 47 |
| 48 } // namespace content |
| 49 |
| 50 #endif // CONTENT_BROWSER_SERVICE_WORKER_CACHE_STORAGE_DISPATCHER_HOST_H_ |
OLD | NEW |