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_->RegisterClientIDForProviderHost(client_uuid_, this); | 94 context_->RegisterProviderHostByClientID(client_uuid_, this); |
95 } | 95 } |
96 | 96 |
97 ServiceWorkerProviderHost::~ServiceWorkerProviderHost() { | 97 ServiceWorkerProviderHost::~ServiceWorkerProviderHost() { |
98 if (context_) | |
99 context_->UnregisterProviderHostByClientID(client_uuid_); | |
kinuko
2015/03/16 05:18:51
Somehow I missed to include this in the previous p
| |
100 | |
98 // Clear docurl so the deferred activation of a waiting worker | 101 // Clear docurl so the deferred activation of a waiting worker |
99 // won't associate the new version with a provider being destroyed. | 102 // won't associate the new version with a provider being destroyed. |
100 document_url_ = GURL(); | 103 document_url_ = GURL(); |
101 if (controlling_version_.get()) | 104 if (controlling_version_.get()) |
102 controlling_version_->RemoveControllee(this); | 105 controlling_version_->RemoveControllee(this); |
103 | 106 |
104 for (auto& key_registration : matching_registrations_) { | 107 for (auto& key_registration : matching_registrations_) { |
105 DecreaseProcessReference(key_registration.second->pattern()); | 108 DecreaseProcessReference(key_registration.second->pattern()); |
106 key_registration.second->RemoveListener(this); | 109 key_registration.second->RemoveListener(this); |
107 } | 110 } |
(...skipping 500 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
608 return context_ != NULL; | 611 return context_ != NULL; |
609 } | 612 } |
610 | 613 |
611 void ServiceWorkerProviderHost::Send(IPC::Message* message) const { | 614 void ServiceWorkerProviderHost::Send(IPC::Message* message) const { |
612 DCHECK(dispatcher_host_); | 615 DCHECK(dispatcher_host_); |
613 DCHECK(IsReadyToSendMessages()); | 616 DCHECK(IsReadyToSendMessages()); |
614 dispatcher_host_->Send(message); | 617 dispatcher_host_->Send(message); |
615 } | 618 } |
616 | 619 |
617 } // namespace content | 620 } // namespace content |
OLD | NEW |