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/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" |
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/worker_host/worker_document_set.h" | 15 #include "content/browser/worker_host/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" |
19 #include "content/public/browser/content_browser_client.h" | 19 #include "content/public/browser/content_browser_client.h" |
20 #include "content/public/browser/render_process_host.h" | 20 #include "content/public/browser/render_process_host.h" |
21 #include "content/public/common/content_client.h" | 21 #include "content/public/common/content_client.h" |
22 | 22 |
23 namespace content { | 23 namespace content { |
24 namespace { | 24 namespace { |
25 | 25 |
26 // Notifies RenderViewHost that one or more worker objects crashed. | 26 // Notifies RenderViewHost that one or more worker objects crashed. |
27 void WorkerCrashCallback(int render_process_unique_id, int render_frame_id) { | 27 void WorkerCrashCallback(int render_process_unique_id, int render_frame_id) { |
28 RenderFrameHostImpl* host = | 28 RenderFrameHostImpl* host = |
29 RenderFrameHostImpl::FromID(render_process_unique_id, render_frame_id); | 29 RenderFrameHostImpl::FromID(render_process_unique_id, render_frame_id); |
30 if (host) | 30 if (host) |
31 host->delegate()->WorkerCrashed(host); | 31 host->delegate()->WorkerCrashed(host); |
32 } | 32 } |
33 | 33 |
34 void NotifyWorkerScriptLoadedOnUI(int worker_process_id, int worker_route_id) { | 34 void NotifyWorkerScriptLoadedOnUI(int worker_process_id, int worker_route_id) { |
35 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 35 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
36 SharedWorkerDevToolsManager::GetInstance()->WorkerContextStarted( | 36 EmbeddedWorkerDevToolsManager::GetInstance()->WorkerContextStarted( |
37 worker_process_id, worker_route_id); | 37 worker_process_id, worker_route_id); |
38 } | 38 } |
39 | 39 |
40 void NotifyWorkerDestroyedOnUI(int worker_process_id, int worker_route_id) { | 40 void NotifyWorkerDestroyedOnUI(int worker_process_id, int worker_route_id) { |
41 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 41 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
42 SharedWorkerDevToolsManager::GetInstance()->WorkerDestroyed(worker_process_id, | 42 EmbeddedWorkerDevToolsManager::GetInstance()->WorkerDestroyed( |
43 worker_route_id); | 43 worker_process_id, worker_route_id); |
44 } | 44 } |
45 | 45 |
46 } // namespace | 46 } // namespace |
47 | 47 |
48 SharedWorkerHost::SharedWorkerHost(SharedWorkerInstance* instance, | 48 SharedWorkerHost::SharedWorkerHost(SharedWorkerInstance* instance, |
49 SharedWorkerMessageFilter* filter, | 49 SharedWorkerMessageFilter* filter, |
50 int worker_route_id) | 50 int worker_route_id) |
51 : instance_(instance), | 51 : instance_(instance), |
52 worker_document_set_(new WorkerDocumentSet()), | 52 worker_document_set_(new WorkerDocumentSet()), |
53 container_render_filter_(filter), | 53 container_render_filter_(filter), |
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
320 int message_port_id) { | 320 int message_port_id) { |
321 for (FilterList::iterator i = filters_.begin(); i != filters_.end(); ++i) { | 321 for (FilterList::iterator i = filters_.begin(); i != filters_.end(); ++i) { |
322 if (i->filter() == filter && i->route_id() == route_id) { | 322 if (i->filter() == filter && i->route_id() == route_id) { |
323 i->set_message_port_id(message_port_id); | 323 i->set_message_port_id(message_port_id); |
324 return; | 324 return; |
325 } | 325 } |
326 } | 326 } |
327 } | 327 } |
328 | 328 |
329 } // namespace content | 329 } // namespace content |
OLD | NEW |