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 "app/app_switches.h" | 5 #include "app/app_switches.h" |
6 #include "app/hi_res_timer_manager.h" | 6 #include "app/hi_res_timer_manager.h" |
7 #include "app/system_monitor.h" | 7 #include "app/system_monitor.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
11 #include "chrome/common/child_process.h" | 11 #include "chrome/common/child_process.h" |
12 #include "chrome/common/chrome_constants.h" | 12 #include "chrome/common/chrome_constants.h" |
13 #include "chrome/common/chrome_switches.h" | 13 #include "chrome/common/chrome_switches.h" |
14 #include "chrome/common/extensions/extension_l10n_util.h" | 14 #include "chrome/common/extensions/extension_l10n_util.h" |
15 #include "chrome/common/logging_chrome.h" | 15 #include "chrome/common/logging_chrome.h" |
16 #include "chrome/common/main_function_params.h" | 16 #include "chrome/common/main_function_params.h" |
17 #include "chrome/utility/utility_thread.h" | 17 #include "chrome/utility/utility_thread.h" |
18 | 18 |
19 #if defined(OS_WIN) | 19 #if defined(OS_WIN) |
20 #include "chrome/common/sandbox_init_wrapper.h" | 20 #include "chrome/common/sandbox_init_wrapper.h" |
21 #include "sandbox/src/sandbox.h" | 21 #include "sandbox/src/sandbox.h" |
22 #endif | 22 #endif |
23 | 23 |
24 // Mainline routine for running as the utility process. | 24 // Mainline routine for running as the utility process. |
25 int UtilityMain(const MainFunctionParams& parameters) { | 25 int UtilityMain(const MainFunctionParams& parameters) { |
26 // The main message loop of the utility process. | 26 // The main message loop of the utility process. |
27 MessageLoop main_message_loop; | 27 MessageLoop main_message_loop; |
28 std::wstring app_name = chrome::kBrowserAppName; | 28 std::wstring app_name = chrome::kBrowserAppName; |
Avi (use Gerrit)
2010/06/08 23:13:18
kill app_name too?
| |
29 PlatformThread::SetName(WideToASCII(app_name + L"_UtilityMain").c_str()); | 29 PlatformThread::SetName("CrUtilityMain"); |
30 | 30 |
31 SystemMonitor system_monitor; | 31 SystemMonitor system_monitor; |
32 HighResolutionTimerManager hi_res_timer_manager; | 32 HighResolutionTimerManager hi_res_timer_manager; |
33 | 33 |
34 ChildProcess utility_process; | 34 ChildProcess utility_process; |
35 utility_process.set_main_thread(new UtilityThread()); | 35 utility_process.set_main_thread(new UtilityThread()); |
36 #if defined(OS_WIN) | 36 #if defined(OS_WIN) |
37 sandbox::TargetServices* target_services = | 37 sandbox::TargetServices* target_services = |
38 parameters.sandbox_info_.TargetServices(); | 38 parameters.sandbox_info_.TargetServices(); |
39 if (!target_services) | 39 if (!target_services) |
40 return false; | 40 return false; |
41 | 41 |
42 target_services->LowerToken(); | 42 target_services->LowerToken(); |
43 #endif | 43 #endif |
44 | 44 |
45 CommandLine* command_line = CommandLine::ForCurrentProcess(); | 45 CommandLine* command_line = CommandLine::ForCurrentProcess(); |
46 std::string lang = command_line->GetSwitchValueASCII(switches::kLang); | 46 std::string lang = command_line->GetSwitchValueASCII(switches::kLang); |
47 if (!lang.empty()) | 47 if (!lang.empty()) |
48 extension_l10n_util::SetProcessLocale(lang); | 48 extension_l10n_util::SetProcessLocale(lang); |
49 | 49 |
50 MessageLoop::current()->Run(); | 50 MessageLoop::current()->Run(); |
51 | 51 |
52 return 0; | 52 return 0; |
53 } | 53 } |
OLD | NEW |