| 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/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" |
| 11 #include "content/browser/message_port_service.h" | 11 #include "content/browser/message_port_service.h" |
| 12 #include "content/browser/shared_worker/shared_worker_instance.h" | 12 #include "content/browser/shared_worker/shared_worker_instance.h" |
| 13 #include "content/browser/shared_worker/shared_worker_message_filter.h" | 13 #include "content/browser/shared_worker/shared_worker_message_filter.h" |
| 14 #include "content/browser/shared_worker/shared_worker_service_impl.h" | 14 #include "content/browser/shared_worker/shared_worker_service_impl.h" |
| 15 #include "content/browser/shared_worker/worker_document_set.h" | 15 #include "content/browser/shared_worker/worker_document_set.h" |
| 16 #include "content/common/view_messages.h" | 16 #include "content/common/view_messages.h" |
| 17 #include "content/common/worker_messages.h" | 17 #include "content/common/worker_messages.h" |
| 18 #include "content/public/browser/browser_thread.h" | 18 #include "content/public/browser/browser_thread.h" |
| (...skipping 15 matching lines...) Expand all Loading... |
| 34 void NotifyWorkerReadyForInspection(int worker_process_id, | 34 void NotifyWorkerReadyForInspection(int worker_process_id, |
| 35 int worker_route_id) { | 35 int worker_route_id) { |
| 36 if (!BrowserThread::CurrentlyOn(BrowserThread::UI)) { | 36 if (!BrowserThread::CurrentlyOn(BrowserThread::UI)) { |
| 37 BrowserThread::PostTask(BrowserThread::UI, | 37 BrowserThread::PostTask(BrowserThread::UI, |
| 38 FROM_HERE, | 38 FROM_HERE, |
| 39 base::Bind(NotifyWorkerReadyForInspection, | 39 base::Bind(NotifyWorkerReadyForInspection, |
| 40 worker_process_id, | 40 worker_process_id, |
| 41 worker_route_id)); | 41 worker_route_id)); |
| 42 return; | 42 return; |
| 43 } | 43 } |
| 44 EmbeddedWorkerDevToolsManager::GetInstance()->WorkerReadyForInspection( | 44 SharedWorkerDevToolsManager::GetInstance()->WorkerReadyForInspection( |
| 45 worker_process_id, worker_route_id); | 45 worker_process_id, worker_route_id); |
| 46 } | 46 } |
| 47 | 47 |
| 48 void NotifyWorkerDestroyed(int worker_process_id, int worker_route_id) { | 48 void NotifyWorkerDestroyed(int worker_process_id, int worker_route_id) { |
| 49 if (!BrowserThread::CurrentlyOn(BrowserThread::UI)) { | 49 if (!BrowserThread::CurrentlyOn(BrowserThread::UI)) { |
| 50 BrowserThread::PostTask( | 50 BrowserThread::PostTask( |
| 51 BrowserThread::UI, | 51 BrowserThread::UI, |
| 52 FROM_HERE, | 52 FROM_HERE, |
| 53 base::Bind(NotifyWorkerDestroyed, worker_process_id, worker_route_id)); | 53 base::Bind(NotifyWorkerDestroyed, worker_process_id, worker_route_id)); |
| 54 return; | 54 return; |
| 55 } | 55 } |
| 56 EmbeddedWorkerDevToolsManager::GetInstance()->WorkerDestroyed( | 56 SharedWorkerDevToolsManager::GetInstance()->WorkerDestroyed( |
| 57 worker_process_id, worker_route_id); | 57 worker_process_id, worker_route_id); |
| 58 } | 58 } |
| 59 | 59 |
| 60 } // namespace | 60 } // namespace |
| 61 | 61 |
| 62 SharedWorkerHost::SharedWorkerHost(SharedWorkerInstance* instance, | 62 SharedWorkerHost::SharedWorkerHost(SharedWorkerInstance* instance, |
| 63 SharedWorkerMessageFilter* filter, | 63 SharedWorkerMessageFilter* filter, |
| 64 int worker_route_id) | 64 int worker_route_id) |
| 65 : instance_(instance), | 65 : instance_(instance), |
| 66 worker_document_set_(new WorkerDocumentSet()), | 66 worker_document_set_(new WorkerDocumentSet()), |
| (...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 346 int message_port_id) { | 346 int message_port_id) { |
| 347 for (FilterList::iterator i = filters_.begin(); i != filters_.end(); ++i) { | 347 for (FilterList::iterator i = filters_.begin(); i != filters_.end(); ++i) { |
| 348 if (i->filter() == filter && i->route_id() == route_id) { | 348 if (i->filter() == filter && i->route_id() == route_id) { |
| 349 i->set_message_port_id(message_port_id); | 349 i->set_message_port_id(message_port_id); |
| 350 return; | 350 return; |
| 351 } | 351 } |
| 352 } | 352 } |
| 353 } | 353 } |
| 354 | 354 |
| 355 } // namespace content | 355 } // namespace content |
| OLD | NEW |