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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 void SendRegistrationError(int thread_id, | 108 void SendRegistrationError(int thread_id, |
109 int request_id, | 109 int request_id, |
110 ServiceWorkerStatusCode status); | 110 ServiceWorkerStatusCode status); |
111 | 111 |
112 int render_process_id_; | 112 int render_process_id_; |
113 MessagePortMessageFilter* const message_port_message_filter_; | 113 MessagePortMessageFilter* const message_port_message_filter_; |
114 base::WeakPtr<ServiceWorkerContextCore> context_; | 114 base::WeakPtr<ServiceWorkerContextCore> context_; |
115 | 115 |
116 IDMap<ServiceWorkerHandle, IDMapOwnPointer> handles_; | 116 IDMap<ServiceWorkerHandle, IDMapOwnPointer> handles_; |
117 | 117 |
118 bool channel_ready_; // True after BrowserMessageFilter::channel_ != NULL. | 118 bool sender_ready_; // True after BrowserMessageFilter::sender_ != NULL. |
119 ScopedVector<IPC::Message> pending_messages_; | 119 ScopedVector<IPC::Message> pending_messages_; |
120 | 120 |
121 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerDispatcherHost); | 121 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerDispatcherHost); |
122 }; | 122 }; |
123 | 123 |
124 } // namespace content | 124 } // namespace content |
125 | 125 |
126 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_DISPATCHER_HOST_H_ | 126 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_DISPATCHER_HOST_H_ |
OLD | NEW |