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 <vector> | 10 #include <vector> |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 MessagePortMessageFilter* message_port_message_filter() { | 81 MessagePortMessageFilter* message_port_message_filter() { |
82 return message_port_message_filter_; | 82 return message_port_message_filter_; |
83 } | 83 } |
84 | 84 |
85 protected: | 85 protected: |
86 ~ServiceWorkerDispatcherHost() override; | 86 ~ServiceWorkerDispatcherHost() override; |
87 | 87 |
88 private: | 88 private: |
89 friend class BrowserThread; | 89 friend class BrowserThread; |
90 friend class base::DeleteHelper<ServiceWorkerDispatcherHost>; | 90 friend class base::DeleteHelper<ServiceWorkerDispatcherHost>; |
| 91 friend class ServiceWorkerDispatcherHostTest; |
91 friend class TestingServiceWorkerDispatcherHost; | 92 friend class TestingServiceWorkerDispatcherHost; |
92 | 93 |
| 94 using StatusCallback = base::Callback<void(ServiceWorkerStatusCode status)>; |
| 95 |
93 // IPC Message handlers | 96 // IPC Message handlers |
94 void OnRegisterServiceWorker(int thread_id, | 97 void OnRegisterServiceWorker(int thread_id, |
95 int request_id, | 98 int request_id, |
96 int provider_id, | 99 int provider_id, |
97 const GURL& pattern, | 100 const GURL& pattern, |
98 const GURL& script_url); | 101 const GURL& script_url); |
99 void OnUpdateServiceWorker(int thread_id, | 102 void OnUpdateServiceWorker(int thread_id, |
100 int request_id, | 103 int request_id, |
101 int provider_id, | 104 int provider_id, |
102 int64_t registration_id); | 105 int64_t registration_id); |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
147 | 150 |
148 // TODO(nhiroki): Remove this after ExtendableMessageEvent is enabled by | 151 // TODO(nhiroki): Remove this after ExtendableMessageEvent is enabled by |
149 // default (crbug.com/543198). | 152 // default (crbug.com/543198). |
150 void OnDeprecatedPostMessageToWorker( | 153 void OnDeprecatedPostMessageToWorker( |
151 int handle_id, | 154 int handle_id, |
152 const base::string16& message, | 155 const base::string16& message, |
153 const std::vector<TransferredMessagePort>& sent_message_ports); | 156 const std::vector<TransferredMessagePort>& sent_message_ports); |
154 | 157 |
155 void OnTerminateWorker(int handle_id); | 158 void OnTerminateWorker(int handle_id); |
156 | 159 |
157 template <typename SourceInfo> | |
158 void DispatchExtendableMessageEvent( | 160 void DispatchExtendableMessageEvent( |
159 scoped_refptr<ServiceWorkerVersion> worker, | 161 scoped_refptr<ServiceWorkerVersion> worker, |
160 const base::string16& message, | 162 const base::string16& message, |
161 const url::Origin& source_origin, | 163 const url::Origin& source_origin, |
162 const std::vector<TransferredMessagePort>& sent_message_ports, | 164 const std::vector<TransferredMessagePort>& sent_message_ports, |
| 165 ServiceWorkerProviderHost* sender_provider_host, |
| 166 const StatusCallback& callback); |
| 167 template <typename SourceInfo> |
| 168 void DispatchExtendableMessageEventInternal( |
| 169 scoped_refptr<ServiceWorkerVersion> worker, |
| 170 const base::string16& message, |
| 171 const url::Origin& source_origin, |
| 172 const std::vector<TransferredMessagePort>& sent_message_ports, |
| 173 const StatusCallback& callback, |
163 const SourceInfo& source_info); | 174 const SourceInfo& source_info); |
164 void DispatchExtendableMessageEventAfterStartWorker( | 175 void DispatchExtendableMessageEventAfterStartWorker( |
165 scoped_refptr<ServiceWorkerVersion> worker, | 176 scoped_refptr<ServiceWorkerVersion> worker, |
166 const base::string16& message, | 177 const base::string16& message, |
167 const url::Origin& source_origin, | 178 const url::Origin& source_origin, |
168 const std::vector<TransferredMessagePort>& sent_message_ports, | 179 const std::vector<TransferredMessagePort>& sent_message_ports, |
169 const ExtendableMessageEventSource& source); | 180 const ExtendableMessageEventSource& source, |
| 181 const StatusCallback& callback); |
| 182 template <typename SourceInfo> |
170 void DidFailToDispatchExtendableMessageEvent( | 183 void DidFailToDispatchExtendableMessageEvent( |
171 const std::vector<TransferredMessagePort>& sent_message_ports, | 184 const std::vector<TransferredMessagePort>& sent_message_ports, |
| 185 const SourceInfo& source_info, |
| 186 const StatusCallback& callback, |
172 ServiceWorkerStatusCode status); | 187 ServiceWorkerStatusCode status); |
| 188 void ReleaseSourceInfo(const ServiceWorkerClientInfo& source_info); |
| 189 void ReleaseSourceInfo(const ServiceWorkerObjectInfo& source_info); |
173 | 190 |
174 ServiceWorkerRegistrationHandle* FindRegistrationHandle( | 191 ServiceWorkerRegistrationHandle* FindRegistrationHandle( |
175 int provider_id, | 192 int provider_id, |
176 int64_t registration_handle_id); | 193 int64_t registration_handle_id); |
177 | 194 |
178 void GetRegistrationObjectInfoAndVersionAttributes( | 195 void GetRegistrationObjectInfoAndVersionAttributes( |
179 base::WeakPtr<ServiceWorkerProviderHost> provider_host, | 196 base::WeakPtr<ServiceWorkerProviderHost> provider_host, |
180 ServiceWorkerRegistration* registration, | 197 ServiceWorkerRegistration* registration, |
181 ServiceWorkerRegistrationObjectInfo* info, | 198 ServiceWorkerRegistrationObjectInfo* info, |
182 ServiceWorkerVersionAttributes* attrs); | 199 ServiceWorkerVersionAttributes* attrs); |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
231 | 248 |
232 bool channel_ready_; // True after BrowserMessageFilter::sender_ != NULL. | 249 bool channel_ready_; // True after BrowserMessageFilter::sender_ != NULL. |
233 std::vector<scoped_ptr<IPC::Message>> pending_messages_; | 250 std::vector<scoped_ptr<IPC::Message>> pending_messages_; |
234 | 251 |
235 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerDispatcherHost); | 252 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerDispatcherHost); |
236 }; | 253 }; |
237 | 254 |
238 } // namespace content | 255 } // namespace content |
239 | 256 |
240 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_DISPATCHER_HOST_H_ | 257 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_DISPATCHER_HOST_H_ |
OLD | NEW |