| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "app/app_switches.h" | 5 #include "app/app_switches.h" |
| 6 #include "app/hi_res_timer_manager.h" | |
| 7 #include "app/system_monitor.h" | |
| 8 #include "base/command_line.h" | 6 #include "base/command_line.h" |
| 9 #include "base/file_util.h" | 7 #include "base/file_util.h" |
| 10 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
| 11 #include "base/path_service.h" | 9 #include "base/path_service.h" |
| 12 #include "base/string_util.h" | 10 #include "base/string_util.h" |
| 13 #include "base/threading/platform_thread.h" | 11 #include "base/threading/platform_thread.h" |
| 14 #include "chrome/common/child_process.h" | 12 #include "chrome/common/child_process.h" |
| 15 #include "chrome/common/chrome_constants.h" | 13 #include "chrome/common/chrome_constants.h" |
| 16 #include "chrome/common/chrome_paths.h" | 14 #include "chrome/common/chrome_paths.h" |
| 17 #include "chrome/common/extensions/extension_l10n_util.h" | 15 #include "chrome/common/extensions/extension_l10n_util.h" |
| 16 #include "chrome/common/hi_res_timer_manager.h" |
| 18 #include "chrome/common/logging_chrome.h" | 17 #include "chrome/common/logging_chrome.h" |
| 19 #include "chrome/common/main_function_params.h" | 18 #include "chrome/common/main_function_params.h" |
| 20 #include "chrome/utility/utility_thread.h" | 19 #include "chrome/utility/utility_thread.h" |
| 20 #include "ui/base/system_monitor/system_monitor.h" |
| 21 | 21 |
| 22 #if defined(OS_WIN) | 22 #if defined(OS_WIN) |
| 23 #include "chrome/common/chrome_switches.h" | 23 #include "chrome/common/chrome_switches.h" |
| 24 #include "chrome/common/sandbox_init_wrapper.h" | 24 #include "chrome/common/sandbox_init_wrapper.h" |
| 25 #include "sandbox/src/sandbox.h" | 25 #include "sandbox/src/sandbox.h" |
| 26 #endif // defined(OS_WIN) | 26 #endif // defined(OS_WIN) |
| 27 | 27 |
| 28 // Mainline routine for running as the utility process. | 28 // Mainline routine for running as the utility process. |
| 29 int UtilityMain(const MainFunctionParams& parameters) { | 29 int UtilityMain(const MainFunctionParams& parameters) { |
| 30 // The main message loop of the utility process. | 30 // The main message loop of the utility process. |
| 31 MessageLoop main_message_loop; | 31 MessageLoop main_message_loop; |
| 32 base::PlatformThread::SetName("CrUtilityMain"); | 32 base::PlatformThread::SetName("CrUtilityMain"); |
| 33 | 33 |
| 34 SystemMonitor system_monitor; | 34 ui::SystemMonitor system_monitor; |
| 35 HighResolutionTimerManager hi_res_timer_manager; | 35 HighResolutionTimerManager hi_res_timer_manager; |
| 36 | 36 |
| 37 ChildProcess utility_process; | 37 ChildProcess utility_process; |
| 38 utility_process.set_main_thread(new UtilityThread()); | 38 utility_process.set_main_thread(new UtilityThread()); |
| 39 #if defined(OS_WIN) | 39 #if defined(OS_WIN) |
| 40 // Load the pdf plugin before the sandbox is turned on. This is for Windows | 40 // Load the pdf plugin before the sandbox is turned on. This is for Windows |
| 41 // only because we need this DLL only on Windows. | 41 // only because we need this DLL only on Windows. |
| 42 FilePath pdf; | 42 FilePath pdf; |
| 43 if (PathService::Get(chrome::FILE_PDF_PLUGIN, &pdf) && | 43 if (PathService::Get(chrome::FILE_PDF_PLUGIN, &pdf) && |
| 44 file_util::PathExists(pdf)) { | 44 file_util::PathExists(pdf)) { |
| (...skipping 13 matching lines...) Expand all Loading... |
| 58 | 58 |
| 59 CommandLine* command_line = CommandLine::ForCurrentProcess(); | 59 CommandLine* command_line = CommandLine::ForCurrentProcess(); |
| 60 std::string lang = command_line->GetSwitchValueASCII(switches::kLang); | 60 std::string lang = command_line->GetSwitchValueASCII(switches::kLang); |
| 61 if (!lang.empty()) | 61 if (!lang.empty()) |
| 62 extension_l10n_util::SetProcessLocale(lang); | 62 extension_l10n_util::SetProcessLocale(lang); |
| 63 | 63 |
| 64 MessageLoop::current()->Run(); | 64 MessageLoop::current()->Run(); |
| 65 | 65 |
| 66 return 0; | 66 return 0; |
| 67 } | 67 } |
| OLD | NEW |