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 <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <memory> | 10 #include <memory> |
(...skipping 22 matching lines...) Expand all Loading... |
33 class ServiceWorkerContextWrapper; | 33 class ServiceWorkerContextWrapper; |
34 class ServiceWorkerHandle; | 34 class ServiceWorkerHandle; |
35 class ServiceWorkerProviderHost; | 35 class ServiceWorkerProviderHost; |
36 class ServiceWorkerRegistration; | 36 class ServiceWorkerRegistration; |
37 class ServiceWorkerRegistrationHandle; | 37 class ServiceWorkerRegistrationHandle; |
38 class ServiceWorkerVersion; | 38 class ServiceWorkerVersion; |
39 struct ServiceWorkerObjectInfo; | 39 struct ServiceWorkerObjectInfo; |
40 struct ServiceWorkerRegistrationInfo; | 40 struct ServiceWorkerRegistrationInfo; |
41 struct ServiceWorkerRegistrationObjectInfo; | 41 struct ServiceWorkerRegistrationObjectInfo; |
42 struct ServiceWorkerVersionAttributes; | 42 struct ServiceWorkerVersionAttributes; |
43 struct TransferredMessagePort; | |
44 | 43 |
45 class CONTENT_EXPORT ServiceWorkerDispatcherHost : public BrowserMessageFilter { | 44 class CONTENT_EXPORT ServiceWorkerDispatcherHost : public BrowserMessageFilter { |
46 public: | 45 public: |
47 ServiceWorkerDispatcherHost( | 46 ServiceWorkerDispatcherHost( |
48 int render_process_id, | 47 int render_process_id, |
49 MessagePortMessageFilter* message_port_message_filter, | 48 MessagePortMessageFilter* message_port_message_filter, |
50 ResourceContext* resource_context); | 49 ResourceContext* resource_context); |
51 | 50 |
52 void Init(ServiceWorkerContextWrapper* context_wrapper); | 51 void Init(ServiceWorkerContextWrapper* context_wrapper); |
53 | 52 |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
134 int line_number, | 133 int line_number, |
135 int column_number, | 134 int column_number, |
136 const GURL& source_url); | 135 const GURL& source_url); |
137 void OnReportConsoleMessage( | 136 void OnReportConsoleMessage( |
138 int embedded_worker_id, | 137 int embedded_worker_id, |
139 const EmbeddedWorkerHostMsg_ReportConsoleMessage_Params& params); | 138 const EmbeddedWorkerHostMsg_ReportConsoleMessage_Params& params); |
140 void OnIncrementServiceWorkerRefCount(int handle_id); | 139 void OnIncrementServiceWorkerRefCount(int handle_id); |
141 void OnDecrementServiceWorkerRefCount(int handle_id); | 140 void OnDecrementServiceWorkerRefCount(int handle_id); |
142 void OnIncrementRegistrationRefCount(int registration_handle_id); | 141 void OnIncrementRegistrationRefCount(int registration_handle_id); |
143 void OnDecrementRegistrationRefCount(int registration_handle_id); | 142 void OnDecrementRegistrationRefCount(int registration_handle_id); |
144 void OnPostMessageToWorker( | 143 void OnPostMessageToWorker(int handle_id, |
145 int handle_id, | 144 int provider_id, |
146 int provider_id, | 145 const base::string16& message, |
147 const base::string16& message, | 146 const url::Origin& source_origin, |
148 const url::Origin& source_origin, | 147 const std::vector<int>& sent_message_ports); |
149 const std::vector<TransferredMessagePort>& sent_message_ports); | |
150 | 148 |
151 void OnTerminateWorker(int handle_id); | 149 void OnTerminateWorker(int handle_id); |
152 | 150 |
153 void DispatchExtendableMessageEvent( | 151 void DispatchExtendableMessageEvent( |
154 scoped_refptr<ServiceWorkerVersion> worker, | 152 scoped_refptr<ServiceWorkerVersion> worker, |
155 const base::string16& message, | 153 const base::string16& message, |
156 const url::Origin& source_origin, | 154 const url::Origin& source_origin, |
157 const std::vector<TransferredMessagePort>& sent_message_ports, | 155 const std::vector<int>& sent_message_ports, |
158 ServiceWorkerProviderHost* sender_provider_host, | 156 ServiceWorkerProviderHost* sender_provider_host, |
159 const StatusCallback& callback); | 157 const StatusCallback& callback); |
160 template <typename SourceInfo> | 158 template <typename SourceInfo> |
161 void DispatchExtendableMessageEventInternal( | 159 void DispatchExtendableMessageEventInternal( |
162 scoped_refptr<ServiceWorkerVersion> worker, | 160 scoped_refptr<ServiceWorkerVersion> worker, |
163 const base::string16& message, | 161 const base::string16& message, |
164 const url::Origin& source_origin, | 162 const url::Origin& source_origin, |
165 const std::vector<TransferredMessagePort>& sent_message_ports, | 163 const std::vector<int>& sent_message_ports, |
166 const StatusCallback& callback, | 164 const StatusCallback& callback, |
167 const SourceInfo& source_info); | 165 const SourceInfo& source_info); |
168 void DispatchExtendableMessageEventAfterStartWorker( | 166 void DispatchExtendableMessageEventAfterStartWorker( |
169 scoped_refptr<ServiceWorkerVersion> worker, | 167 scoped_refptr<ServiceWorkerVersion> worker, |
170 const base::string16& message, | 168 const base::string16& message, |
171 const url::Origin& source_origin, | 169 const url::Origin& source_origin, |
172 const std::vector<TransferredMessagePort>& sent_message_ports, | 170 const std::vector<int>& sent_message_ports, |
173 const ExtendableMessageEventSource& source, | 171 const ExtendableMessageEventSource& source, |
174 const StatusCallback& callback); | 172 const StatusCallback& callback); |
175 template <typename SourceInfo> | 173 template <typename SourceInfo> |
176 void DidFailToDispatchExtendableMessageEvent( | 174 void DidFailToDispatchExtendableMessageEvent( |
177 const std::vector<TransferredMessagePort>& sent_message_ports, | 175 const std::vector<int>& sent_message_ports, |
178 const SourceInfo& source_info, | 176 const SourceInfo& source_info, |
179 const StatusCallback& callback, | 177 const StatusCallback& callback, |
180 ServiceWorkerStatusCode status); | 178 ServiceWorkerStatusCode status); |
181 void ReleaseSourceInfo(const ServiceWorkerClientInfo& source_info); | 179 void ReleaseSourceInfo(const ServiceWorkerClientInfo& source_info); |
182 void ReleaseSourceInfo(const ServiceWorkerObjectInfo& source_info); | 180 void ReleaseSourceInfo(const ServiceWorkerObjectInfo& source_info); |
183 | 181 |
184 ServiceWorkerRegistrationHandle* FindRegistrationHandle( | 182 ServiceWorkerRegistrationHandle* FindRegistrationHandle( |
185 int provider_id, | 183 int provider_id, |
186 int64_t registration_handle_id); | 184 int64_t registration_handle_id); |
187 | 185 |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
241 | 239 |
242 bool channel_ready_; // True after BrowserMessageFilter::sender_ != NULL. | 240 bool channel_ready_; // True after BrowserMessageFilter::sender_ != NULL. |
243 std::vector<std::unique_ptr<IPC::Message>> pending_messages_; | 241 std::vector<std::unique_ptr<IPC::Message>> pending_messages_; |
244 | 242 |
245 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerDispatcherHost); | 243 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerDispatcherHost); |
246 }; | 244 }; |
247 | 245 |
248 } // namespace content | 246 } // namespace content |
249 | 247 |
250 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_DISPATCHER_HOST_H_ | 248 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_DISPATCHER_HOST_H_ |
OLD | NEW |