| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "base/base_switches.h" | 5 #include "base/base_switches.h" |
| 6 #include "base/command_line.h" | 6 #include "base/command_line.h" |
| 7 #include "base/message_loop.h" | 7 #include "base/message_loop.h" |
| 8 #include "base/string_util.h" | 8 #include "base/string_util.h" |
| 9 #include "base/system_monitor/system_monitor.h" | 9 #include "base/system_monitor/system_monitor.h" |
| 10 #include "base/threading/platform_thread.h" | |
| 11 #include "content/common/child_process.h" | 10 #include "content/common/child_process.h" |
| 12 #include "content/common/hi_res_timer_manager.h" | 11 #include "content/common/hi_res_timer_manager.h" |
| 13 #include "content/common/main_function_params.h" | 12 #include "content/common/main_function_params.h" |
| 14 #include "content/worker/worker_thread.h" | 13 #include "content/worker/worker_thread.h" |
| 15 | 14 |
| 16 #if defined(OS_WIN) | 15 #if defined(OS_WIN) |
| 17 #include "content/common/sandbox_init_wrapper.h" | 16 #include "content/common/sandbox_init_wrapper.h" |
| 18 #include "sandbox/src/sandbox.h" | 17 #include "sandbox/src/sandbox.h" |
| 19 #endif | 18 #endif |
| 20 | 19 |
| 21 // Mainline routine for running as the worker process. | 20 // Mainline routine for running as the worker process. |
| 22 int WorkerMain(const MainFunctionParams& parameters) { | 21 int WorkerMain(const MainFunctionParams& parameters) { |
| 23 // The main message loop of the worker process. | 22 // The main message loop of the worker process. |
| 24 MessageLoop main_message_loop; | 23 MessageLoop main_message_loop("CrWorkerMain"); |
| 25 base::PlatformThread::SetName("CrWorkerMain"); | |
| 26 | 24 |
| 27 base::SystemMonitor system_monitor; | 25 base::SystemMonitor system_monitor; |
| 28 HighResolutionTimerManager hi_res_timer_manager; | 26 HighResolutionTimerManager hi_res_timer_manager; |
| 29 | 27 |
| 30 ChildProcess worker_process; | 28 ChildProcess worker_process; |
| 31 worker_process.set_main_thread(new WorkerThread()); | 29 worker_process.set_main_thread(new WorkerThread()); |
| 32 #if defined(OS_WIN) | 30 #if defined(OS_WIN) |
| 33 sandbox::TargetServices* target_services = | 31 sandbox::TargetServices* target_services = |
| 34 parameters.sandbox_info_.TargetServices(); | 32 parameters.sandbox_info_.TargetServices(); |
| 35 if (!target_services) | 33 if (!target_services) |
| (...skipping 10 matching lines...) Expand all Loading... |
| 46 if (parsed_command_line.HasSwitch(switches::kWaitForDebugger)) { | 44 if (parsed_command_line.HasSwitch(switches::kWaitForDebugger)) { |
| 47 ChildProcess::WaitForDebugger("Worker"); | 45 ChildProcess::WaitForDebugger("Worker"); |
| 48 } | 46 } |
| 49 | 47 |
| 50 // Load the accelerator table from the browser executable and tell the | 48 // Load the accelerator table from the browser executable and tell the |
| 51 // message loop to use it when translating messages. | 49 // message loop to use it when translating messages. |
| 52 MessageLoop::current()->Run(); | 50 MessageLoop::current()->Run(); |
| 53 | 51 |
| 54 return 0; | 52 return 0; |
| 55 } | 53 } |
| OLD | NEW |