OLD | NEW |
---|---|
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/shared_worker/shared_worker_host.h" | 5 #include "content/browser/shared_worker/shared_worker_host.h" |
6 | 6 |
7 #include "base/metrics/histogram.h" | 7 #include "base/metrics/histogram.h" |
8 #include "content/browser/devtools/shared_worker_devtools_manager.h" | 8 #include "content/browser/devtools/shared_worker_devtools_manager.h" |
9 #include "content/browser/message_port_message_filter.h" | 9 #include "content/browser/message_port_message_filter.h" |
10 #include "content/browser/message_port_service.h" | 10 #include "content/browser/message_port_service.h" |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
125 if (!instance_) | 125 if (!instance_) |
126 return; | 126 return; |
127 // Walk all instances and remove the document from their document set. | 127 // Walk all instances and remove the document from their document set. |
128 worker_document_set_->Remove(filter, document_id); | 128 worker_document_set_->Remove(filter, document_id); |
129 if (worker_document_set_->IsEmpty()) { | 129 if (worker_document_set_->IsEmpty()) { |
130 // This worker has no more associated documents - shut it down. | 130 // This worker has no more associated documents - shut it down. |
131 TerminateWorker(); | 131 TerminateWorker(); |
132 } | 132 } |
133 } | 133 } |
134 | 134 |
135 void SharedWorkerHost::RenderFrameDetached(int render_process_id, | |
136 int render_frame_id) { | |
137 if (!instance_) | |
138 return; | |
139 // Walk all instances and remove the all documents in the frame from their | |
nhiroki
2016/08/25 09:38:19
all the documents
horo
2016/08/25 10:55:55
Done.
| |
140 // document set. | |
141 worker_document_set_->RemoveRenderFrame(render_process_id, render_frame_id); | |
142 if (worker_document_set_->IsEmpty()) { | |
143 // This worker has no more associated documents - shut it down. | |
144 TerminateWorker(); | |
145 } | |
146 } | |
147 | |
135 void SharedWorkerHost::WorkerContextClosed() { | 148 void SharedWorkerHost::WorkerContextClosed() { |
136 if (!instance_) | 149 if (!instance_) |
137 return; | 150 return; |
138 // Set the closed flag - this will stop any further messages from | 151 // Set the closed flag - this will stop any further messages from |
139 // being sent to the worker (messages can still be sent from the worker, | 152 // being sent to the worker (messages can still be sent from the worker, |
140 // for exception reporting, etc). | 153 // for exception reporting, etc). |
141 closed_ = true; | 154 closed_ = true; |
142 if (!termination_message_sent_) | 155 if (!termination_message_sent_) |
143 NotifyWorkerDestroyed(worker_process_id_, worker_route_id_); | 156 NotifyWorkerDestroyed(worker_process_id_, worker_route_id_); |
144 } | 157 } |
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
311 int message_port_id) { | 324 int message_port_id) { |
312 for (FilterList::iterator i = filters_.begin(); i != filters_.end(); ++i) { | 325 for (FilterList::iterator i = filters_.begin(); i != filters_.end(); ++i) { |
313 if (i->filter() == filter && i->route_id() == route_id) { | 326 if (i->filter() == filter && i->route_id() == route_id) { |
314 i->set_message_port_id(message_port_id); | 327 i->set_message_port_id(message_port_id); |
315 return; | 328 return; |
316 } | 329 } |
317 } | 330 } |
318 } | 331 } |
319 | 332 |
320 } // namespace content | 333 } // namespace content |
OLD | NEW |