| 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 <utility> |
| 8 |
| 7 #include "base/guid.h" | 9 #include "base/guid.h" |
| 8 #include "base/stl_util.h" | 10 #include "base/stl_util.h" |
| 9 #include "base/time/time.h" | 11 #include "base/time/time.h" |
| 10 #include "content/browser/frame_host/frame_tree.h" | 12 #include "content/browser/frame_host/frame_tree.h" |
| 11 #include "content/browser/frame_host/frame_tree_node.h" | 13 #include "content/browser/frame_host/frame_tree_node.h" |
| 12 #include "content/browser/frame_host/render_frame_host_impl.h" | 14 #include "content/browser/frame_host/render_frame_host_impl.h" |
| 13 #include "content/browser/message_port_message_filter.h" | 15 #include "content/browser/message_port_message_filter.h" |
| 14 #include "content/browser/service_worker/service_worker_context_core.h" | 16 #include "content/browser/service_worker/service_worker_context_core.h" |
| 15 #include "content/browser/service_worker/service_worker_context_request_handler.
h" | 17 #include "content/browser/service_worker/service_worker_context_request_handler.
h" |
| 16 #include "content/browser/service_worker/service_worker_controllee_request_handl
er.h" | 18 #include "content/browser/service_worker/service_worker_controllee_request_handl
er.h" |
| (...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 387 ServiceWorkerHandle* handle = dispatcher_host_->FindServiceWorkerHandle( | 389 ServiceWorkerHandle* handle = dispatcher_host_->FindServiceWorkerHandle( |
| 388 provider_id(), version->version_id()); | 390 provider_id(), version->version_id()); |
| 389 if (handle) { | 391 if (handle) { |
| 390 handle->IncrementRefCount(); | 392 handle->IncrementRefCount(); |
| 391 return handle->GetObjectInfo(); | 393 return handle->GetObjectInfo(); |
| 392 } | 394 } |
| 393 | 395 |
| 394 scoped_ptr<ServiceWorkerHandle> new_handle( | 396 scoped_ptr<ServiceWorkerHandle> new_handle( |
| 395 ServiceWorkerHandle::Create(context_, AsWeakPtr(), version)); | 397 ServiceWorkerHandle::Create(context_, AsWeakPtr(), version)); |
| 396 handle = new_handle.get(); | 398 handle = new_handle.get(); |
| 397 dispatcher_host_->RegisterServiceWorkerHandle(new_handle.Pass()); | 399 dispatcher_host_->RegisterServiceWorkerHandle(std::move(new_handle)); |
| 398 return handle->GetObjectInfo(); | 400 return handle->GetObjectInfo(); |
| 399 } | 401 } |
| 400 | 402 |
| 401 bool ServiceWorkerProviderHost::CanAssociateRegistration( | 403 bool ServiceWorkerProviderHost::CanAssociateRegistration( |
| 402 ServiceWorkerRegistration* registration) { | 404 ServiceWorkerRegistration* registration) { |
| 403 if (!context_) | 405 if (!context_) |
| 404 return false; | 406 return false; |
| 405 if (running_hosted_version_.get()) | 407 if (running_hosted_version_.get()) |
| 406 return false; | 408 return false; |
| 407 if (!registration || associated_registration_.get() || !allow_association_) | 409 if (!registration || associated_registration_.get() || !allow_association_) |
| (...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 725 Send(new ServiceWorkerMsg_SetControllerServiceWorker( | 727 Send(new ServiceWorkerMsg_SetControllerServiceWorker( |
| 726 render_thread_id_, provider_id(), | 728 render_thread_id_, provider_id(), |
| 727 GetOrCreateServiceWorkerHandle( | 729 GetOrCreateServiceWorkerHandle( |
| 728 associated_registration_->active_version()), | 730 associated_registration_->active_version()), |
| 729 false /* shouldNotifyControllerChange */)); | 731 false /* shouldNotifyControllerChange */)); |
| 730 } | 732 } |
| 731 } | 733 } |
| 732 } | 734 } |
| 733 | 735 |
| 734 } // namespace content | 736 } // namespace content |
| OLD | NEW |