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 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 context_(context), | 84 context_(context), |
85 dispatcher_host_(dispatcher_host), | 85 dispatcher_host_(dispatcher_host), |
86 allow_association_(true), | 86 allow_association_(true), |
87 is_claiming_(false) { | 87 is_claiming_(false) { |
88 DCHECK_NE(ChildProcessHost::kInvalidUniqueID, render_process_id_); | 88 DCHECK_NE(ChildProcessHost::kInvalidUniqueID, render_process_id_); |
89 DCHECK_NE(SERVICE_WORKER_PROVIDER_UNKNOWN, provider_type_); | 89 DCHECK_NE(SERVICE_WORKER_PROVIDER_UNKNOWN, provider_type_); |
90 if (provider_type_ == SERVICE_WORKER_PROVIDER_FOR_CONTROLLER) { | 90 if (provider_type_ == SERVICE_WORKER_PROVIDER_FOR_CONTROLLER) { |
91 // Actual thread id is set when the service worker context gets started. | 91 // Actual thread id is set when the service worker context gets started. |
92 render_thread_id_ = kInvalidEmbeddedWorkerThreadId; | 92 render_thread_id_ = kInvalidEmbeddedWorkerThreadId; |
93 } | 93 } |
94 context_->RegisterProviderHostByClientID(client_uuid_, this); | 94 context_->RegisterClientIDForProviderHost(client_uuid_, this); |
95 } | 95 } |
96 | 96 |
97 ServiceWorkerProviderHost::~ServiceWorkerProviderHost() { | 97 ServiceWorkerProviderHost::~ServiceWorkerProviderHost() { |
98 if (context_) | |
99 context_->UnregisterProviderHostByClientID(client_uuid_); | |
100 | |
101 // Clear docurl so the deferred activation of a waiting worker | 98 // Clear docurl so the deferred activation of a waiting worker |
102 // won't associate the new version with a provider being destroyed. | 99 // won't associate the new version with a provider being destroyed. |
103 document_url_ = GURL(); | 100 document_url_ = GURL(); |
104 if (controlling_version_.get()) | 101 if (controlling_version_.get()) |
105 controlling_version_->RemoveControllee(this); | 102 controlling_version_->RemoveControllee(this); |
106 | 103 |
107 for (auto& key_registration : matching_registrations_) { | 104 for (auto& key_registration : matching_registrations_) { |
108 DecreaseProcessReference(key_registration.second->pattern()); | 105 DecreaseProcessReference(key_registration.second->pattern()); |
109 key_registration.second->RemoveListener(this); | 106 key_registration.second->RemoveListener(this); |
110 } | 107 } |
(...skipping 500 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
611 return context_ != NULL; | 608 return context_ != NULL; |
612 } | 609 } |
613 | 610 |
614 void ServiceWorkerProviderHost::Send(IPC::Message* message) const { | 611 void ServiceWorkerProviderHost::Send(IPC::Message* message) const { |
615 DCHECK(dispatcher_host_); | 612 DCHECK(dispatcher_host_); |
616 DCHECK(IsReadyToSendMessages()); | 613 DCHECK(IsReadyToSendMessages()); |
617 dispatcher_host_->Send(message); | 614 dispatcher_host_->Send(message); |
618 } | 615 } |
619 | 616 |
620 } // namespace content | 617 } // namespace content |
OLD | NEW |