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 "chrome/browser/service/service_process_control.h" | 5 #include "chrome/browser/service/service_process_control.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/file_path.h" | 8 #include "base/file_path.h" |
9 #include "base/process_util.h" | 9 #include "base/process_util.h" |
10 #include "base/stl_util.h" | 10 #include "base/stl_util.h" |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 } | 111 } |
112 | 112 |
113 // If the service process is already running then connects to it. | 113 // If the service process is already running then connects to it. |
114 if (CheckServiceProcessReady()) { | 114 if (CheckServiceProcessReady()) { |
115 ConnectInternal(); | 115 ConnectInternal(); |
116 return; | 116 return; |
117 } | 117 } |
118 | 118 |
119 // A service process should have a different mechanism for starting, but now | 119 // A service process should have a different mechanism for starting, but now |
120 // we start it as if it is a child process. | 120 // we start it as if it is a child process. |
121 FilePath exe_path = ChildProcessHost::GetChildPath(true); | 121 |
| 122 #if defined(OS_LINUX) |
| 123 int flags = ChildProcessHost::CHILD_ALLOW_SELF; |
| 124 #else |
| 125 int flags = ChildProcessHost::CHILD_NORMAL; |
| 126 #endif |
| 127 |
| 128 FilePath exe_path = ChildProcessHost::GetChildPath(flags); |
122 if (exe_path.empty()) { | 129 if (exe_path.empty()) { |
123 NOTREACHED() << "Unable to get service process binary name."; | 130 NOTREACHED() << "Unable to get service process binary name."; |
124 } | 131 } |
125 | 132 |
126 CommandLine* cmd_line = new CommandLine(exe_path); | 133 CommandLine* cmd_line = new CommandLine(exe_path); |
127 cmd_line->AppendSwitchASCII(switches::kProcessType, | 134 cmd_line->AppendSwitchASCII(switches::kProcessType, |
128 switches::kServiceProcess); | 135 switches::kServiceProcess); |
129 | 136 |
130 const CommandLine& browser_command_line = *CommandLine::ForCurrentProcess(); | 137 const CommandLine& browser_command_line = *CommandLine::ForCurrentProcess(); |
131 FilePath user_data_dir = | 138 FilePath user_data_dir = |
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
319 if (base::LaunchProcess(*cmd_line_, options, NULL)) { | 326 if (base::LaunchProcess(*cmd_line_, options, NULL)) { |
320 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, | 327 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, |
321 NewRunnableMethod(this, | 328 NewRunnableMethod(this, |
322 &Launcher::DoDetectLaunched)); | 329 &Launcher::DoDetectLaunched)); |
323 } else { | 330 } else { |
324 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, | 331 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, |
325 NewRunnableMethod(this, &Launcher::Notify)); | 332 NewRunnableMethod(this, &Launcher::Notify)); |
326 } | 333 } |
327 } | 334 } |
328 #endif // !OS_MACOSX | 335 #endif // !OS_MACOSX |
OLD | NEW |