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 <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/id_map.h" | 10 #include "base/id_map.h" |
(...skipping 21 matching lines...) Expand all Loading... |
32 class CONTENT_EXPORT ServiceWorkerDispatcherHost : public BrowserMessageFilter { | 32 class CONTENT_EXPORT ServiceWorkerDispatcherHost : public BrowserMessageFilter { |
33 public: | 33 public: |
34 ServiceWorkerDispatcherHost( | 34 ServiceWorkerDispatcherHost( |
35 int render_process_id, | 35 int render_process_id, |
36 MessagePortMessageFilter* message_port_message_filter, | 36 MessagePortMessageFilter* message_port_message_filter, |
37 ResourceContext* resource_context); | 37 ResourceContext* resource_context); |
38 | 38 |
39 void Init(ServiceWorkerContextWrapper* context_wrapper); | 39 void Init(ServiceWorkerContextWrapper* context_wrapper); |
40 | 40 |
41 // BrowserMessageFilter implementation | 41 // BrowserMessageFilter implementation |
42 virtual void OnFilterAdded(IPC::Sender* sender) override; | 42 void OnFilterAdded(IPC::Sender* sender) override; |
43 virtual void OnDestruct() const override; | 43 void OnDestruct() const override; |
44 virtual bool OnMessageReceived(const IPC::Message& message) override; | 44 bool OnMessageReceived(const IPC::Message& message) override; |
45 | 45 |
46 // IPC::Sender implementation | 46 // IPC::Sender implementation |
47 | 47 |
48 // Send() queues the message until the underlying sender is ready. This | 48 // Send() queues the message until the underlying sender is ready. This |
49 // class assumes that Send() can only fail after that when the renderer | 49 // class assumes that Send() can only fail after that when the renderer |
50 // process has terminated, at which point the whole instance will eventually | 50 // process has terminated, at which point the whole instance will eventually |
51 // be destroyed. | 51 // be destroyed. |
52 virtual bool Send(IPC::Message* message) override; | 52 bool Send(IPC::Message* message) override; |
53 | 53 |
54 // Returns the existing registration handle whose reference count is | 54 // Returns the existing registration handle whose reference count is |
55 // incremented or newly created one if it doesn't exist. | 55 // incremented or newly created one if it doesn't exist. |
56 ServiceWorkerRegistrationHandle* GetOrCreateRegistrationHandle( | 56 ServiceWorkerRegistrationHandle* GetOrCreateRegistrationHandle( |
57 int provider_id, | 57 int provider_id, |
58 ServiceWorkerRegistration* registration); | 58 ServiceWorkerRegistration* registration); |
59 | 59 |
60 void RegisterServiceWorkerHandle(scoped_ptr<ServiceWorkerHandle> handle); | 60 void RegisterServiceWorkerHandle(scoped_ptr<ServiceWorkerHandle> handle); |
61 void RegisterServiceWorkerRegistrationHandle( | 61 void RegisterServiceWorkerRegistrationHandle( |
62 scoped_ptr<ServiceWorkerRegistrationHandle> handle); | 62 scoped_ptr<ServiceWorkerRegistrationHandle> handle); |
63 | 63 |
64 MessagePortMessageFilter* message_port_message_filter() { | 64 MessagePortMessageFilter* message_port_message_filter() { |
65 return message_port_message_filter_; | 65 return message_port_message_filter_; |
66 } | 66 } |
67 | 67 |
68 protected: | 68 protected: |
69 virtual ~ServiceWorkerDispatcherHost(); | 69 ~ServiceWorkerDispatcherHost() override; |
70 | 70 |
71 private: | 71 private: |
72 friend class BrowserThread; | 72 friend class BrowserThread; |
73 friend class base::DeleteHelper<ServiceWorkerDispatcherHost>; | 73 friend class base::DeleteHelper<ServiceWorkerDispatcherHost>; |
74 friend class TestingServiceWorkerDispatcherHost; | 74 friend class TestingServiceWorkerDispatcherHost; |
75 | 75 |
76 // IPC Message handlers | 76 // IPC Message handlers |
77 void OnRegisterServiceWorker(int thread_id, | 77 void OnRegisterServiceWorker(int thread_id, |
78 int request_id, | 78 int request_id, |
79 int provider_id, | 79 int provider_id, |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
168 | 168 |
169 bool channel_ready_; // True after BrowserMessageFilter::sender_ != NULL. | 169 bool channel_ready_; // True after BrowserMessageFilter::sender_ != NULL. |
170 ScopedVector<IPC::Message> pending_messages_; | 170 ScopedVector<IPC::Message> pending_messages_; |
171 | 171 |
172 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerDispatcherHost); | 172 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerDispatcherHost); |
173 }; | 173 }; |
174 | 174 |
175 } // namespace content | 175 } // namespace content |
176 | 176 |
177 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_DISPATCHER_HOST_H_ | 177 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_DISPATCHER_HOST_H_ |
OLD | NEW |