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/id_map.h" | 8 #include "base/id_map.h" |
9 #include "base/memory/weak_ptr.h" | 9 #include "base/memory/weak_ptr.h" |
10 #include "base/strings/string16.h" | 10 #include "base/strings/string16.h" |
(...skipping 14 matching lines...) Expand all Loading... |
25 | 25 |
26 class CONTENT_EXPORT ServiceWorkerDispatcherHost : public BrowserMessageFilter { | 26 class CONTENT_EXPORT ServiceWorkerDispatcherHost : public BrowserMessageFilter { |
27 public: | 27 public: |
28 ServiceWorkerDispatcherHost( | 28 ServiceWorkerDispatcherHost( |
29 int render_process_id, | 29 int render_process_id, |
30 MessagePortMessageFilter* message_port_message_filter); | 30 MessagePortMessageFilter* message_port_message_filter); |
31 | 31 |
32 void Init(ServiceWorkerContextWrapper* context_wrapper); | 32 void Init(ServiceWorkerContextWrapper* context_wrapper); |
33 | 33 |
34 // BrowserMessageFilter implementation | 34 // BrowserMessageFilter implementation |
35 virtual void OnFilterAdded(IPC::Channel* channel) OVERRIDE; | 35 virtual void OnFilterAdded(IPC::Sender* sender) OVERRIDE; |
36 virtual void OnDestruct() const OVERRIDE; | 36 virtual void OnDestruct() const OVERRIDE; |
37 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; | 37 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; |
38 | 38 |
39 // IPC::Sender implementation | 39 // IPC::Sender implementation |
40 | 40 |
41 // Send() queues the message until the underlying channel is ready. This | 41 // Send() queues the message until the underlying sender is ready. This |
42 // class assumes that Send() can only fail after that when the renderer | 42 // class assumes that Send() can only fail after that when the renderer |
43 // process has terminated, at which point the whole instance will eventually | 43 // process has terminated, at which point the whole instance will eventually |
44 // be destroyed. | 44 // be destroyed. |
45 virtual bool Send(IPC::Message* message) OVERRIDE; | 45 virtual bool Send(IPC::Message* message) OVERRIDE; |
46 | 46 |
47 void RegisterServiceWorkerHandle(scoped_ptr<ServiceWorkerHandle> handle); | 47 void RegisterServiceWorkerHandle(scoped_ptr<ServiceWorkerHandle> handle); |
48 | 48 |
49 MessagePortMessageFilter* message_port_message_filter() { | 49 MessagePortMessageFilter* message_port_message_filter() { |
50 return message_port_message_filter_; | 50 return message_port_message_filter_; |
51 } | 51 } |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 ServiceWorkerStatusCode status); | 110 ServiceWorkerStatusCode status); |
111 | 111 |
112 ServiceWorkerContextCore* GetContext(); | 112 ServiceWorkerContextCore* GetContext(); |
113 | 113 |
114 int render_process_id_; | 114 int render_process_id_; |
115 MessagePortMessageFilter* const message_port_message_filter_; | 115 MessagePortMessageFilter* const message_port_message_filter_; |
116 scoped_refptr<ServiceWorkerContextWrapper> context_wrapper_; | 116 scoped_refptr<ServiceWorkerContextWrapper> context_wrapper_; |
117 | 117 |
118 IDMap<ServiceWorkerHandle, IDMapOwnPointer> handles_; | 118 IDMap<ServiceWorkerHandle, IDMapOwnPointer> handles_; |
119 | 119 |
120 bool channel_ready_; // True after BrowserMessageFilter::channel_ != NULL. | 120 bool channel_ready_; // True after BrowserMessageFilter::sender_ != NULL. |
121 ScopedVector<IPC::Message> pending_messages_; | 121 ScopedVector<IPC::Message> pending_messages_; |
122 | 122 |
123 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerDispatcherHost); | 123 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerDispatcherHost); |
124 }; | 124 }; |
125 | 125 |
126 } // namespace content | 126 } // namespace content |
127 | 127 |
128 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_DISPATCHER_HOST_H_ | 128 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_DISPATCHER_HOST_H_ |
OLD | NEW |