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 #include "content/browser/service_worker/service_worker_provider_host.h" | 5 #include "content/browser/service_worker/service_worker_provider_host.h" |
6 | 6 |
7 #include "base/stl_util.h" | 7 #include "base/stl_util.h" |
8 #include "content/browser/message_port_message_filter.h" | 8 #include "content/browser/message_port_message_filter.h" |
9 #include "content/browser/service_worker/service_worker_context_core.h" | 9 #include "content/browser/service_worker/service_worker_context_core.h" |
10 #include "content/browser/service_worker/service_worker_context_request_handler. h" | 10 #include "content/browser/service_worker/service_worker_context_request_handler. h" |
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
207 sent_message_port_ids, | 207 sent_message_port_ids, |
208 new_routing_ids)); | 208 new_routing_ids)); |
209 } | 209 } |
210 | 210 |
211 void ServiceWorkerProviderHost::AddScopedProcessReferenceToPattern( | 211 void ServiceWorkerProviderHost::AddScopedProcessReferenceToPattern( |
212 const GURL& pattern) { | 212 const GURL& pattern) { |
213 associated_patterns_.push_back(pattern); | 213 associated_patterns_.push_back(pattern); |
214 IncreaseProcessReference(pattern); | 214 IncreaseProcessReference(pattern); |
215 } | 215 } |
216 | 216 |
217 void ServiceWorkerProviderHost::PrepareForCrossSiteTransfer() { | |
218 DCHECK(!associated_registration()); | |
219 process_id_ = 0; | |
falken
2014/11/11 08:38:57
EmbeddedWorkerInstance uses -1 for "invalid proces
michaeln
2014/11/13 00:05:08
Done
| |
220 provider_id_ = kInvalidServiceWorkerProviderId; | |
221 dispatcher_host_ = nullptr; | |
222 } | |
223 | |
224 void ServiceWorkerProviderHost::CompleteCrossSiteTransfer( | |
225 int new_process_id, | |
226 int new_provider_id, | |
227 ServiceWorkerDispatcherHost* new_dispatcher_host) { | |
228 DCHECK(!dispatcher_host_); | |
229 process_id_ = new_process_id; | |
230 provider_id_ = new_provider_id; | |
231 dispatcher_host_ = new_dispatcher_host; | |
232 } | |
233 | |
217 ServiceWorkerObjectInfo ServiceWorkerProviderHost::CreateHandleAndPass( | 234 ServiceWorkerObjectInfo ServiceWorkerProviderHost::CreateHandleAndPass( |
218 ServiceWorkerVersion* version) { | 235 ServiceWorkerVersion* version) { |
219 ServiceWorkerObjectInfo info; | 236 ServiceWorkerObjectInfo info; |
220 if (context_ && version) { | 237 if (context_ && version) { |
221 scoped_ptr<ServiceWorkerHandle> handle = | 238 scoped_ptr<ServiceWorkerHandle> handle = |
222 ServiceWorkerHandle::Create(context_, | 239 ServiceWorkerHandle::Create(context_, |
223 dispatcher_host_, | 240 dispatcher_host_, |
224 kDocumentMainThreadId, | 241 kDocumentMainThreadId, |
225 provider_id_, | 242 provider_id_, |
226 version); | 243 version); |
(...skipping 17 matching lines...) Expand all Loading... | |
244 context_->process_manager()->RemoveProcessReferenceFromPattern( | 261 context_->process_manager()->RemoveProcessReferenceFromPattern( |
245 pattern, process_id_); | 262 pattern, process_id_); |
246 } | 263 } |
247 } | 264 } |
248 | 265 |
249 bool ServiceWorkerProviderHost::IsContextAlive() { | 266 bool ServiceWorkerProviderHost::IsContextAlive() { |
250 return context_ != NULL; | 267 return context_ != NULL; |
251 } | 268 } |
252 | 269 |
253 } // namespace content | 270 } // namespace content |
OLD | NEW |