| 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/embedded_worker_devtools_manager.h" | 8 #include "content/browser/devtools/embedded_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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 worker_process_id, worker_route_id); | 70 worker_process_id, worker_route_id); |
| 71 } | 71 } |
| 72 | 72 |
| 73 } // namespace | 73 } // namespace |
| 74 | 74 |
| 75 SharedWorkerHost::SharedWorkerHost(SharedWorkerInstance* instance, | 75 SharedWorkerHost::SharedWorkerHost(SharedWorkerInstance* instance, |
| 76 SharedWorkerMessageFilter* filter, | 76 SharedWorkerMessageFilter* filter, |
| 77 int worker_route_id) | 77 int worker_route_id) |
| 78 : instance_(instance), | 78 : instance_(instance), |
| 79 worker_document_set_(new WorkerDocumentSet()), | 79 worker_document_set_(new WorkerDocumentSet()), |
| 80 weak_factory_(this), | |
| 81 container_render_filter_(filter), | 80 container_render_filter_(filter), |
| 82 worker_process_id_(filter->render_process_id()), | 81 worker_process_id_(filter->render_process_id()), |
| 83 worker_route_id_(worker_route_id), | 82 worker_route_id_(worker_route_id), |
| 84 load_failed_(false), | 83 load_failed_(false), |
| 85 closed_(false), | 84 closed_(false), |
| 86 creation_time_(base::TimeTicks::Now()) { | 85 creation_time_(base::TimeTicks::Now()), |
| 86 weak_factory_(this) { |
| 87 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 87 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| 88 } | 88 } |
| 89 | 89 |
| 90 SharedWorkerHost::~SharedWorkerHost() { | 90 SharedWorkerHost::~SharedWorkerHost() { |
| 91 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 91 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| 92 UMA_HISTOGRAM_LONG_TIMES("SharedWorker.TimeToDeleted", | 92 UMA_HISTOGRAM_LONG_TIMES("SharedWorker.TimeToDeleted", |
| 93 base::TimeTicks::Now() - creation_time_); | 93 base::TimeTicks::Now() - creation_time_); |
| 94 // If we crashed, tell the RenderViewHosts. | 94 // If we crashed, tell the RenderViewHosts. |
| 95 if (instance_ && !load_failed_) { | 95 if (instance_ && !load_failed_) { |
| 96 const WorkerDocumentSet::DocumentInfoSet& parents = | 96 const WorkerDocumentSet::DocumentInfoSet& parents = |
| (...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 360 int message_port_id) { | 360 int message_port_id) { |
| 361 for (FilterList::iterator i = filters_.begin(); i != filters_.end(); ++i) { | 361 for (FilterList::iterator i = filters_.begin(); i != filters_.end(); ++i) { |
| 362 if (i->filter() == filter && i->route_id() == route_id) { | 362 if (i->filter() == filter && i->route_id() == route_id) { |
| 363 i->set_message_port_id(message_port_id); | 363 i->set_message_port_id(message_port_id); |
| 364 return; | 364 return; |
| 365 } | 365 } |
| 366 } | 366 } |
| 367 } | 367 } |
| 368 | 368 |
| 369 } // namespace content | 369 } // namespace content |
| OLD | NEW |