Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(305)

Side by Side Diff: chrome/utility/utility_main.cc

Issue 431008: Make SystemMonitor not a Singleton and move it out of base (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: fix ChromeFrame build Created 11 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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"
7 #include "app/system_monitor.h"
6 #include "base/command_line.h" 8 #include "base/command_line.h"
7 #include "base/message_loop.h" 9 #include "base/message_loop.h"
8 #include "base/string_util.h" 10 #include "base/string_util.h"
9 #include "base/system_monitor.h"
10 #include "chrome/common/child_process.h" 11 #include "chrome/common/child_process.h"
11 #include "chrome/common/chrome_constants.h" 12 #include "chrome/common/chrome_constants.h"
12 #include "chrome/common/chrome_switches.h" 13 #include "chrome/common/chrome_switches.h"
13 #include "chrome/common/extensions/extension_l10n_util.h" 14 #include "chrome/common/extensions/extension_l10n_util.h"
14 #include "chrome/common/logging_chrome.h" 15 #include "chrome/common/logging_chrome.h"
15 #include "chrome/common/main_function_params.h" 16 #include "chrome/common/main_function_params.h"
16 #include "chrome/utility/utility_thread.h" 17 #include "chrome/utility/utility_thread.h"
17 18
18 #if defined(OS_WIN) 19 #if defined(OS_WIN)
19 #include "chrome/common/sandbox_init_wrapper.h" 20 #include "chrome/common/sandbox_init_wrapper.h"
20 #include "sandbox/src/sandbox.h" 21 #include "sandbox/src/sandbox.h"
21 #endif 22 #endif
22 23
23 // Mainline routine for running as the utility process. 24 // Mainline routine for running as the utility process.
24 int UtilityMain(const MainFunctionParams& parameters) { 25 int UtilityMain(const MainFunctionParams& parameters) {
25 // The main message loop of the utility process. 26 // The main message loop of the utility process.
26 MessageLoop main_message_loop; 27 MessageLoop main_message_loop;
27 std::wstring app_name = chrome::kBrowserAppName; 28 std::wstring app_name = chrome::kBrowserAppName;
28 PlatformThread::SetName(WideToASCII(app_name + L"_UtilityMain").c_str()); 29 PlatformThread::SetName(WideToASCII(app_name + L"_UtilityMain").c_str());
29 30
30 // Initialize the SystemMonitor 31 SystemMonitor system_monitor;
31 base::SystemMonitor::Start(); 32 HighResolutionTimerManager hi_res_timer_manager;
32 33
33 ChildProcess utility_process; 34 ChildProcess utility_process;
34 utility_process.set_main_thread(new UtilityThread()); 35 utility_process.set_main_thread(new UtilityThread());
35 #if defined(OS_WIN) 36 #if defined(OS_WIN)
36 sandbox::TargetServices* target_services = 37 sandbox::TargetServices* target_services =
37 parameters.sandbox_info_.TargetServices(); 38 parameters.sandbox_info_.TargetServices();
38 if (!target_services) 39 if (!target_services)
39 return false; 40 return false;
40 41
41 target_services->LowerToken(); 42 target_services->LowerToken();
42 #endif 43 #endif
43 44
44 CommandLine* command_line = CommandLine::ForCurrentProcess(); 45 CommandLine* command_line = CommandLine::ForCurrentProcess();
45 std::string lang = command_line->GetSwitchValueASCII(switches::kLang); 46 std::string lang = command_line->GetSwitchValueASCII(switches::kLang);
46 if (!lang.empty()) 47 if (!lang.empty())
47 extension_l10n_util::SetProcessLocale(lang); 48 extension_l10n_util::SetProcessLocale(lang);
48 49
49 MessageLoop::current()->Run(); 50 MessageLoop::current()->Run();
50 51
51 return 0; 52 return 0;
52 } 53 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698