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

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

Issue 155944: Switch the first thread in a child process to be the main thread... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: sync Created 11 years, 5 months 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 "base/command_line.h" 5 #include "base/command_line.h"
6 #include "base/message_loop.h" 6 #include "base/message_loop.h"
7 #include "base/string_util.h" 7 #include "base/string_util.h"
8 #include "base/system_monitor.h" 8 #include "base/system_monitor.h"
9 #include "chrome/common/child_process.h" 9 #include "chrome/common/child_process.h"
10 #include "chrome/common/chrome_constants.h" 10 #include "chrome/common/chrome_constants.h"
11 #include "chrome/common/chrome_switches.h" 11 #include "chrome/common/chrome_switches.h"
12 #include "chrome/common/logging_chrome.h" 12 #include "chrome/common/logging_chrome.h"
13 #include "chrome/common/main_function_params.h" 13 #include "chrome/common/main_function_params.h"
14 #include "chrome/utility/utility_thread.h" 14 #include "chrome/utility/utility_thread.h"
15 15
16 #if defined(OS_WIN) 16 #if defined(OS_WIN)
17 #include "chrome/common/sandbox_init_wrapper.h" 17 #include "chrome/common/sandbox_init_wrapper.h"
18 #include "sandbox/src/sandbox.h" 18 #include "sandbox/src/sandbox.h"
19 #endif 19 #endif
20 20
21 // Mainline routine for running as the utility process. 21 // Mainline routine for running as the utility process.
22 int UtilityMain(const MainFunctionParams& parameters) { 22 int UtilityMain(const MainFunctionParams& parameters) {
23 // The main thread of the render process. 23 // The main message loop of the utility process.
24 MessageLoopForIO main_message_loop; 24 MessageLoop main_message_loop;
25 std::wstring app_name = chrome::kBrowserAppName; 25 std::wstring app_name = chrome::kBrowserAppName;
26 PlatformThread::SetName(WideToASCII(app_name + L"_UtilityMain").c_str()); 26 PlatformThread::SetName(WideToASCII(app_name + L"_UtilityMain").c_str());
27 27
28 // Initialize the SystemMonitor 28 // Initialize the SystemMonitor
29 base::SystemMonitor::Start(); 29 base::SystemMonitor::Start();
30 30
31 ChildProcess utility_process(new UtilityThread()); 31 ChildProcess utility_process;
32 utility_process.set_main_thread(new UtilityThread());
32 #if defined(OS_WIN) 33 #if defined(OS_WIN)
33 sandbox::TargetServices* target_services = 34 sandbox::TargetServices* target_services =
34 parameters.sandbox_info_.TargetServices(); 35 parameters.sandbox_info_.TargetServices();
35 if (!target_services) 36 if (!target_services)
36 return false; 37 return false;
37 38
38 target_services->LowerToken(); 39 target_services->LowerToken();
39 #endif 40 #endif
40 41
41 MessageLoop::current()->Run(); 42 MessageLoop::current()->Run();
42 43
43 return 0; 44 return 0;
44 } 45 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698