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_message_filter.h" | 11 #include "content/browser/message_port_message_filter.h" |
12 #include "content/browser/message_port_service.h" | 12 #include "content/browser/message_port_service.h" |
13 #include "content/browser/shared_worker/shared_worker_instance.h" | 13 #include "content/browser/shared_worker/shared_worker_instance.h" |
14 #include "content/browser/shared_worker/shared_worker_message_filter.h" | 14 #include "content/browser/shared_worker/shared_worker_message_filter.h" |
15 #include "content/browser/shared_worker/shared_worker_service_impl.h" | 15 #include "content/browser/shared_worker/shared_worker_service_impl.h" |
16 #include "content/browser/shared_worker/worker_document_set.h" | 16 #include "content/browser/shared_worker/worker_document_set.h" |
17 #include "content/common/view_messages.h" | 17 #include "content/common/view_messages.h" |
18 #include "content/common/worker_messages.h" | 18 #include "content/common/worker_messages.h" |
(...skipping 16 matching lines...) Expand all Loading... |
35 void NotifyWorkerReadyForInspection(int worker_process_id, | 35 void NotifyWorkerReadyForInspection(int worker_process_id, |
36 int worker_route_id) { | 36 int worker_route_id) { |
37 if (!BrowserThread::CurrentlyOn(BrowserThread::UI)) { | 37 if (!BrowserThread::CurrentlyOn(BrowserThread::UI)) { |
38 BrowserThread::PostTask(BrowserThread::UI, | 38 BrowserThread::PostTask(BrowserThread::UI, |
39 FROM_HERE, | 39 FROM_HERE, |
40 base::Bind(NotifyWorkerReadyForInspection, | 40 base::Bind(NotifyWorkerReadyForInspection, |
41 worker_process_id, | 41 worker_process_id, |
42 worker_route_id)); | 42 worker_route_id)); |
43 return; | 43 return; |
44 } | 44 } |
45 EmbeddedWorkerDevToolsManager::GetInstance()->WorkerReadyForInspection( | 45 SharedWorkerDevToolsManager::GetInstance()->WorkerReadyForInspection( |
46 worker_process_id, worker_route_id); | 46 worker_process_id, worker_route_id); |
47 } | 47 } |
48 | 48 |
49 void NotifyWorkerDestroyed(int worker_process_id, int worker_route_id) { | 49 void NotifyWorkerDestroyed(int worker_process_id, int worker_route_id) { |
50 if (!BrowserThread::CurrentlyOn(BrowserThread::UI)) { | 50 if (!BrowserThread::CurrentlyOn(BrowserThread::UI)) { |
51 BrowserThread::PostTask( | 51 BrowserThread::PostTask( |
52 BrowserThread::UI, | 52 BrowserThread::UI, |
53 FROM_HERE, | 53 FROM_HERE, |
54 base::Bind(NotifyWorkerDestroyed, worker_process_id, worker_route_id)); | 54 base::Bind(NotifyWorkerDestroyed, worker_process_id, worker_route_id)); |
55 return; | 55 return; |
56 } | 56 } |
57 EmbeddedWorkerDevToolsManager::GetInstance()->WorkerDestroyed( | 57 SharedWorkerDevToolsManager::GetInstance()->WorkerDestroyed( |
58 worker_process_id, worker_route_id); | 58 worker_process_id, worker_route_id); |
59 } | 59 } |
60 | 60 |
61 } // namespace | 61 } // namespace |
62 | 62 |
63 SharedWorkerHost::SharedWorkerHost(SharedWorkerInstance* instance, | 63 SharedWorkerHost::SharedWorkerHost(SharedWorkerInstance* instance, |
64 SharedWorkerMessageFilter* filter, | 64 SharedWorkerMessageFilter* filter, |
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()), |
(...skipping 279 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 |