| 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/frame_host/render_frame_host_delegate.h" | 9 #include "content/browser/frame_host/render_frame_host_delegate.h" |
| 10 #include "content/browser/frame_host/render_frame_host_impl.h" | 10 #include "content/browser/frame_host/render_frame_host_impl.h" |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 int worker_route_id) | 65 int worker_route_id) |
| 66 : instance_(instance), | 66 : instance_(instance), |
| 67 worker_document_set_(new WorkerDocumentSet()), | 67 worker_document_set_(new WorkerDocumentSet()), |
| 68 container_render_filter_(filter), | 68 container_render_filter_(filter), |
| 69 worker_process_id_(filter->render_process_id()), | 69 worker_process_id_(filter->render_process_id()), |
| 70 worker_route_id_(worker_route_id), | 70 worker_route_id_(worker_route_id), |
| 71 load_failed_(false), | 71 load_failed_(false), |
| 72 closed_(false), | 72 closed_(false), |
| 73 creation_time_(base::TimeTicks::Now()), | 73 creation_time_(base::TimeTicks::Now()), |
| 74 weak_factory_(this) { | 74 weak_factory_(this) { |
| 75 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 75 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 76 } | 76 } |
| 77 | 77 |
| 78 SharedWorkerHost::~SharedWorkerHost() { | 78 SharedWorkerHost::~SharedWorkerHost() { |
| 79 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 79 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 80 UMA_HISTOGRAM_LONG_TIMES("SharedWorker.TimeToDeleted", | 80 UMA_HISTOGRAM_LONG_TIMES("SharedWorker.TimeToDeleted", |
| 81 base::TimeTicks::Now() - creation_time_); | 81 base::TimeTicks::Now() - creation_time_); |
| 82 // If we crashed, tell the RenderViewHosts. | 82 // If we crashed, tell the RenderViewHosts. |
| 83 if (instance_ && !load_failed_) { | 83 if (instance_ && !load_failed_) { |
| 84 const WorkerDocumentSet::DocumentInfoSet& parents = | 84 const WorkerDocumentSet::DocumentInfoSet& parents = |
| 85 worker_document_set_->documents(); | 85 worker_document_set_->documents(); |
| 86 for (WorkerDocumentSet::DocumentInfoSet::const_iterator parent_iter = | 86 for (WorkerDocumentSet::DocumentInfoSet::const_iterator parent_iter = |
| 87 parents.begin(); | 87 parents.begin(); |
| 88 parent_iter != parents.end(); | 88 parent_iter != parents.end(); |
| 89 ++parent_iter) { | 89 ++parent_iter) { |
| (...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 347 int message_port_id) { | 347 int message_port_id) { |
| 348 for (FilterList::iterator i = filters_.begin(); i != filters_.end(); ++i) { | 348 for (FilterList::iterator i = filters_.begin(); i != filters_.end(); ++i) { |
| 349 if (i->filter() == filter && i->route_id() == route_id) { | 349 if (i->filter() == filter && i->route_id() == route_id) { |
| 350 i->set_message_port_id(message_port_id); | 350 i->set_message_port_id(message_port_id); |
| 351 return; | 351 return; |
| 352 } | 352 } |
| 353 } | 353 } |
| 354 } | 354 } |
| 355 | 355 |
| 356 } // namespace content | 356 } // namespace content |
| OLD | NEW |