Chromium Code Reviews| 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/guid.h" | 7 #include "base/guid.h" |
| 8 #include "base/stl_util.h" | 8 #include "base/stl_util.h" |
| 9 #include "content/browser/frame_host/frame_tree.h" | 9 #include "content/browser/frame_host/frame_tree.h" |
| 10 #include "content/browser/frame_host/frame_tree_node.h" | 10 #include "content/browser/frame_host/frame_tree_node.h" |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 64 : callback(callback), | 64 : callback(callback), |
| 65 called(false) { | 65 called(false) { |
| 66 } | 66 } |
| 67 | 67 |
| 68 ServiceWorkerProviderHost::OneShotGetReadyCallback::~OneShotGetReadyCallback() { | 68 ServiceWorkerProviderHost::OneShotGetReadyCallback::~OneShotGetReadyCallback() { |
| 69 } | 69 } |
| 70 | 70 |
| 71 ServiceWorkerProviderHost::ServiceWorkerProviderHost( | 71 ServiceWorkerProviderHost::ServiceWorkerProviderHost( |
| 72 int render_process_id, | 72 int render_process_id, |
| 73 int render_frame_id, | 73 int render_frame_id, |
| 74 int shared_worker_route_id, | |
| 74 int provider_id, | 75 int provider_id, |
| 75 ServiceWorkerProviderType provider_type, | |
| 76 base::WeakPtr<ServiceWorkerContextCore> context, | 76 base::WeakPtr<ServiceWorkerContextCore> context, |
| 77 ServiceWorkerDispatcherHost* dispatcher_host) | 77 ServiceWorkerDispatcherHost* dispatcher_host) |
| 78 : client_uuid_(base::GenerateGUID()), | 78 : client_uuid_(base::GenerateGUID()), |
| 79 render_process_id_(render_process_id), | 79 render_process_id_(render_process_id), |
| 80 render_frame_id_(render_frame_id), | 80 render_frame_id_(render_frame_id), |
| 81 shared_worker_route_id_(shared_worker_route_id), | |
| 81 render_thread_id_(kDocumentMainThreadId), | 82 render_thread_id_(kDocumentMainThreadId), |
| 82 provider_id_(provider_id), | 83 provider_id_(provider_id), |
| 83 provider_type_(provider_type), | 84 provider_type_(SERVICE_WORKER_PROVIDER_FOR_CONTROLLER), |
| 84 context_(context), | 85 context_(context), |
| 85 dispatcher_host_(dispatcher_host), | 86 dispatcher_host_(dispatcher_host), |
| 86 allow_association_(true) { | 87 allow_association_(true) { |
| 87 DCHECK_NE(ChildProcessHost::kInvalidUniqueID, render_process_id_); | 88 DCHECK_NE(ChildProcessHost::kInvalidUniqueID, render_process_id_); |
| 88 DCHECK_NE(SERVICE_WORKER_PROVIDER_UNKNOWN, provider_type_); | 89 DCHECK(render_frame_id == MSG_ROUTING_NONE || |
| 90 shared_worker_route_id == MSG_ROUTING_NONE); | |
| 91 if (render_frame_id != MSG_ROUTING_NONE) | |
| 92 provider_type_ = SERVICE_WORKER_PROVIDER_FOR_WINDOW; | |
| 93 else if (shared_worker_route_id_ != MSG_ROUTING_NONE) | |
| 94 provider_type_ = SERVICE_WORKER_PROVIDER_FOR_SHARED_WORKER; | |
|
nhiroki
2015/06/12 02:11:27
(I'm assuming that "shared_worker_route_id" is alm
horo
2015/06/12 04:19:19
Done.
| |
| 89 if (provider_type_ == SERVICE_WORKER_PROVIDER_FOR_CONTROLLER) { | 95 if (provider_type_ == SERVICE_WORKER_PROVIDER_FOR_CONTROLLER) { |
| 90 // Actual thread id is set when the service worker context gets started. | 96 // Actual thread id is set when the service worker context gets started. |
| 91 render_thread_id_ = kInvalidEmbeddedWorkerThreadId; | 97 render_thread_id_ = kInvalidEmbeddedWorkerThreadId; |
| 92 } | 98 } |
| 93 context_->RegisterProviderHostByClientID(client_uuid_, this); | 99 context_->RegisterProviderHostByClientID(client_uuid_, this); |
| 94 } | 100 } |
| 95 | 101 |
| 96 ServiceWorkerProviderHost::~ServiceWorkerProviderHost() { | 102 ServiceWorkerProviderHost::~ServiceWorkerProviderHost() { |
| 97 if (context_) | 103 if (context_) |
| 98 context_->UnregisterProviderHostByClientID(client_uuid_); | 104 context_->UnregisterProviderHostByClientID(client_uuid_); |
| (...skipping 551 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 650 return context_ != NULL; | 656 return context_ != NULL; |
| 651 } | 657 } |
| 652 | 658 |
| 653 void ServiceWorkerProviderHost::Send(IPC::Message* message) const { | 659 void ServiceWorkerProviderHost::Send(IPC::Message* message) const { |
| 654 DCHECK(dispatcher_host_); | 660 DCHECK(dispatcher_host_); |
| 655 DCHECK(IsReadyToSendMessages()); | 661 DCHECK(IsReadyToSendMessages()); |
| 656 dispatcher_host_->Send(message); | 662 dispatcher_host_->Send(message); |
| 657 } | 663 } |
| 658 | 664 |
| 659 } // namespace content | 665 } // namespace content |
| OLD | NEW |