OLD | NEW |
---|---|
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_DISPATCHER_HOST_H_ | 5 #ifndef CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_DISPATCHER_HOST_H_ |
6 #define CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_DISPATCHER_HOST_H_ | 6 #define CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_DISPATCHER_HOST_H_ |
7 | 7 |
8 #include "base/memory/weak_ptr.h" | 8 #include "base/memory/weak_ptr.h" |
9 #include "content/browser/service_worker/service_worker_provider_host.h" | |
9 #include "content/public/browser/browser_message_filter.h" | 10 #include "content/public/browser/browser_message_filter.h" |
10 | 11 |
11 class GURL; | 12 class GURL; |
12 | 13 |
13 namespace content { | 14 namespace content { |
14 | 15 |
15 class ServiceWorkerContextCore; | 16 class ServiceWorkerContextCore; |
16 class ServiceWorkerContextWrapper; | 17 class ServiceWorkerContextWrapper; |
18 class ServiceWorkerProviderHost; | |
17 | 19 |
18 class CONTENT_EXPORT ServiceWorkerDispatcherHost : public BrowserMessageFilter { | 20 class CONTENT_EXPORT ServiceWorkerDispatcherHost : public BrowserMessageFilter { |
19 public: | 21 public: |
20 explicit ServiceWorkerDispatcherHost(int render_process_id); | 22 explicit ServiceWorkerDispatcherHost(int render_process_id); |
21 | 23 |
22 void Init(ServiceWorkerContextWrapper* context_wrapper); | 24 void Init(ServiceWorkerContextWrapper* context_wrapper); |
23 | 25 |
24 // BrowserIOMessageFilter implementation | 26 // BrowserIOMessageFilter implementation |
27 virtual void OnDestruct() const OVERRIDE; | |
25 virtual bool OnMessageReceived(const IPC::Message& message, | 28 virtual bool OnMessageReceived(const IPC::Message& message, |
26 bool* message_was_ok) OVERRIDE; | 29 bool* message_was_ok) OVERRIDE; |
27 | 30 |
28 protected: | 31 protected: |
29 virtual ~ServiceWorkerDispatcherHost(); | 32 virtual ~ServiceWorkerDispatcherHost(); |
30 | 33 |
31 private: | 34 private: |
35 friend class BrowserThread; | |
36 friend class base::DeleteHelper<ServiceWorkerDispatcherHost>; | |
32 friend class TestingServiceWorkerDispatcherHost; | 37 friend class TestingServiceWorkerDispatcherHost; |
33 | 38 |
34 // IPC Message handlers | 39 // IPC Message handlers |
35 void OnRegisterServiceWorker(int32 thread_id, | 40 void OnRegisterServiceWorker(int32 thread_id, |
36 int32 request_id, | 41 int32 request_id, |
37 const GURL& scope, | 42 const GURL& scope, |
38 const GURL& script_url); | 43 const GURL& script_url); |
39 void OnUnregisterServiceWorker(int32 thread_id, | 44 void OnUnregisterServiceWorker(int32 thread_id, |
40 int32 request_id, | 45 int32 request_id, |
41 const GURL& scope); | 46 const GURL& scope); |
47 void OnProviderCreated(int provider_id); | |
48 void OnProviderDestroyed(int provider_id); | |
42 | 49 |
50 ServiceWorkerProviderHost* GetProviderHost(int provider_id); | |
51 | |
52 int render_process_id_; | |
43 base::WeakPtr<ServiceWorkerContextCore> context_; | 53 base::WeakPtr<ServiceWorkerContextCore> context_; |
54 ServiceWorkerProviderHostMap providers_; | |
kinuko
2013/11/18 05:57:24
nit: can you comment this instance owns provider h
michaeln
2013/11/18 20:18:17
Done.
| |
44 }; | 55 }; |
45 | 56 |
46 } // namespace content | 57 } // namespace content |
47 | 58 |
48 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_DISPATCHER_HOST_H_ | 59 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_DISPATCHER_HOST_H_ |
OLD | NEW |