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/debug/debugger.h" | 5 #include "base/debug/debugger.h" |
6 #include "base/message_loop.h" | 6 #include "base/message_loop.h" |
7 #include "chrome/common/chrome_switches.h" | 7 #include "chrome/common/chrome_switches.h" |
8 #include "chrome/common/service_process_util.h" | 8 #include "chrome/common/service_process_util.h" |
9 #include "chrome/service/service_process.h" | 9 #include "chrome/service/service_process.h" |
10 #include "content/public/common/main_function_params.h" | 10 #include "content/public/common/main_function_params.h" |
(...skipping 10 matching lines...) Expand all Loading... |
21 MessageLoopForUI main_message_loop; | 21 MessageLoopForUI main_message_loop; |
22 main_message_loop.set_thread_name("MainThread"); | 22 main_message_loop.set_thread_name("MainThread"); |
23 if (parameters.command_line.HasSwitch(switches::kWaitForDebugger)) { | 23 if (parameters.command_line.HasSwitch(switches::kWaitForDebugger)) { |
24 base::debug::WaitForDebugger(60, true); | 24 base::debug::WaitForDebugger(60, true); |
25 } | 25 } |
26 | 26 |
27 VLOG(1) << "Service process launched: " | 27 VLOG(1) << "Service process launched: " |
28 << parameters.command_line.GetCommandLineString(); | 28 << parameters.command_line.GetCommandLineString(); |
29 | 29 |
30 #if defined(OS_MACOSX) | 30 #if defined(OS_MACOSX) |
31 chrome_service_application_mac::RegisterServiceCrApp(); | 31 chrome_service_application_mac::RegisterServiceApp(); |
32 #endif | 32 #endif |
33 | 33 |
34 base::PlatformThread::SetName("CrServiceMain"); | 34 base::PlatformThread::SetName("CrServiceMain"); |
35 | 35 |
36 // If there is already a service process running, quit now. | 36 // If there is already a service process running, quit now. |
37 scoped_ptr<ServiceProcessState> state(new ServiceProcessState); | 37 scoped_ptr<ServiceProcessState> state(new ServiceProcessState); |
38 if (!state->Initialize()) | 38 if (!state->Initialize()) |
39 return 0; | 39 return 0; |
40 | 40 |
41 #if defined(OS_WIN) | 41 #if defined(OS_WIN) |
42 sandbox::BrokerServices* broker_services = | 42 sandbox::BrokerServices* broker_services = |
43 parameters.sandbox_info->broker_services; | 43 parameters.sandbox_info->broker_services; |
44 if (broker_services) | 44 if (broker_services) |
45 sandbox::InitBrokerServices(broker_services); | 45 sandbox::InitBrokerServices(broker_services); |
46 #endif // defined(OS_WIN) | 46 #endif // defined(OS_WIN) |
47 | 47 |
48 ServiceProcess service_process; | 48 ServiceProcess service_process; |
49 if (service_process.Initialize(&main_message_loop, | 49 if (service_process.Initialize(&main_message_loop, |
50 parameters.command_line, | 50 parameters.command_line, |
51 state.release())) { | 51 state.release())) { |
52 MessageLoop::current()->Run(); | 52 MessageLoop::current()->Run(); |
53 } else { | 53 } else { |
54 LOG(ERROR) << "Service process failed to initialize"; | 54 LOG(ERROR) << "Service process failed to initialize"; |
55 } | 55 } |
56 service_process.Teardown(); | 56 service_process.Teardown(); |
57 return 0; | 57 return 0; |
58 } | 58 } |
OLD | NEW |