| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 "chrome/browser/worker_host/worker_process_host.h" | 5 #include "chrome/browser/worker_host/worker_process_host.h" |
| 6 | 6 |
| 7 #include <set> | 7 #include <set> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| 11 #include "base/debug_util.h" | 11 #include "base/debug_util.h" |
| 12 #if defined(OS_POSIX) | 12 #if defined(OS_POSIX) |
| 13 #include "base/global_descriptors_posix.h" | 13 #include "base/global_descriptors_posix.h" |
| 14 #endif | 14 #endif |
| 15 #include "base/message_loop.h" | 15 #include "base/message_loop.h" |
| 16 #include "base/path_service.h" | 16 #include "base/path_service.h" |
| 17 #include "base/process_util.h" | 17 #include "base/process_util.h" |
| 18 #include "base/string_util.h" | 18 #include "base/string_util.h" |
| 19 #include "chrome/browser/browser_process.h" | 19 #include "chrome/browser/chrome_thread.h" |
| 20 #include "chrome/browser/child_process_security_policy.h" | 20 #include "chrome/browser/child_process_security_policy.h" |
| 21 #include "chrome/browser/renderer_host/render_view_host.h" | 21 #include "chrome/browser/renderer_host/render_view_host.h" |
| 22 #include "chrome/browser/renderer_host/render_view_host_delegate.h" | 22 #include "chrome/browser/renderer_host/render_view_host_delegate.h" |
| 23 #include "chrome/browser/renderer_host/resource_message_filter.h" | 23 #include "chrome/browser/renderer_host/resource_message_filter.h" |
| 24 #include "chrome/browser/worker_host/message_port_dispatcher.h" | 24 #include "chrome/browser/worker_host/message_port_dispatcher.h" |
| 25 #include "chrome/browser/worker_host/worker_service.h" | 25 #include "chrome/browser/worker_host/worker_service.h" |
| 26 #include "chrome/common/chrome_switches.h" | 26 #include "chrome/common/chrome_switches.h" |
| 27 #include "chrome/common/debug_flags.h" | 27 #include "chrome/common/debug_flags.h" |
| 28 #include "chrome/common/notification_service.h" | 28 #include "chrome/common/notification_service.h" |
| 29 #include "chrome/common/process_watcher.h" | 29 #include "chrome/common/process_watcher.h" |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 } | 70 } |
| 71 | 71 |
| 72 WorkerProcessHost::~WorkerProcessHost() { | 72 WorkerProcessHost::~WorkerProcessHost() { |
| 73 // Let interested observers know we are being deleted. | 73 // Let interested observers know we are being deleted. |
| 74 NotificationService::current()->Notify( | 74 NotificationService::current()->Notify( |
| 75 NotificationType::WORKER_PROCESS_HOST_SHUTDOWN, | 75 NotificationType::WORKER_PROCESS_HOST_SHUTDOWN, |
| 76 Source<WorkerProcessHost>(this), | 76 Source<WorkerProcessHost>(this), |
| 77 NotificationService::NoDetails()); | 77 NotificationService::NoDetails()); |
| 78 | 78 |
| 79 // If we crashed, tell the RenderViewHost. | 79 // If we crashed, tell the RenderViewHost. |
| 80 MessageLoop* ui_loop = WorkerService::GetInstance()->ui_loop(); | |
| 81 for (Instances::iterator i = instances_.begin(); i != instances_.end(); ++i) { | 80 for (Instances::iterator i = instances_.begin(); i != instances_.end(); ++i) { |
| 82 ui_loop->PostTask(FROM_HERE, new WorkerCrashTask( | 81 ChromeThread::PostTask( |
| 83 i->renderer_id, i->render_view_route_id)); | 82 ChromeThread::UI, FROM_HERE, |
| 83 new WorkerCrashTask(i->renderer_id, i->render_view_route_id)); |
| 84 } | 84 } |
| 85 | 85 |
| 86 ChildProcessSecurityPolicy::GetInstance()->Remove(id()); | 86 ChildProcessSecurityPolicy::GetInstance()->Remove(id()); |
| 87 } | 87 } |
| 88 | 88 |
| 89 bool WorkerProcessHost::Init() { | 89 bool WorkerProcessHost::Init() { |
| 90 if (!CreateChannel()) | 90 if (!CreateChannel()) |
| 91 return false; | 91 return false; |
| 92 | 92 |
| 93 FilePath exe_path = GetChildPath(); | 93 FilePath exe_path = GetChildPath(); |
| (...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 331 instances_.front().render_view_route_id, this, id(), *route_id); | 331 instances_.front().render_view_route_id, this, id(), *route_id); |
| 332 } | 332 } |
| 333 | 333 |
| 334 void WorkerProcessHost::OnCancelCreateDedicatedWorker(int route_id) { | 334 void WorkerProcessHost::OnCancelCreateDedicatedWorker(int route_id) { |
| 335 WorkerService::GetInstance()->CancelCreateDedicatedWorker(id(), route_id); | 335 WorkerService::GetInstance()->CancelCreateDedicatedWorker(id(), route_id); |
| 336 } | 336 } |
| 337 | 337 |
| 338 void WorkerProcessHost::OnForwardToWorker(const IPC::Message& message) { | 338 void WorkerProcessHost::OnForwardToWorker(const IPC::Message& message) { |
| 339 WorkerService::GetInstance()->ForwardMessage(message, id()); | 339 WorkerService::GetInstance()->ForwardMessage(message, id()); |
| 340 } | 340 } |
| OLD | NEW |