| 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 "content/browser/ppapi_broker_process_host.h" | 5 #include "content/browser/ppapi_broker_process_host.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/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 set_version(UTF8ToUTF16(info.version)); | 29 set_version(UTF8ToUTF16(info.version)); |
| 30 | 30 |
| 31 if (!CreateChannel()) | 31 if (!CreateChannel()) |
| 32 return false; | 32 return false; |
| 33 | 33 |
| 34 const CommandLine& browser_command_line = *CommandLine::ForCurrentProcess(); | 34 const CommandLine& browser_command_line = *CommandLine::ForCurrentProcess(); |
| 35 // Use the same launcher mechanism as ppapi plugins. | 35 // Use the same launcher mechanism as ppapi plugins. |
| 36 CommandLine::StringType plugin_launcher = | 36 CommandLine::StringType plugin_launcher = |
| 37 browser_command_line.GetSwitchValueNative(switches::kPpapiPluginLauncher); | 37 browser_command_line.GetSwitchValueNative(switches::kPpapiPluginLauncher); |
| 38 | 38 |
| 39 FilePath exe_path = ChildProcessHost::GetChildPath(plugin_launcher.empty()); | 39 #if defined(OS_LINUX) |
| 40 int flags = plugin_launcher.empty() ? ChildProcessHost::CHILD_ALLOW_SELF : |
| 41 ChildProcessHost::CHILD_NORMAL; |
| 42 #else |
| 43 int flags = ChildProcessHost::CHILD_NORMAL; |
| 44 #endif |
| 45 |
| 46 FilePath exe_path = ChildProcessHost::GetChildPath(flags); |
| 40 if (exe_path.empty()) | 47 if (exe_path.empty()) |
| 41 return false; | 48 return false; |
| 42 | 49 |
| 43 CommandLine* cmd_line = new CommandLine(exe_path); | 50 CommandLine* cmd_line = new CommandLine(exe_path); |
| 44 cmd_line->AppendSwitchASCII(switches::kProcessType, | 51 cmd_line->AppendSwitchASCII(switches::kProcessType, |
| 45 switches::kPpapiBrokerProcess); | 52 switches::kPpapiBrokerProcess); |
| 46 cmd_line->AppendSwitchASCII(switches::kProcessChannelID, channel_id()); | 53 cmd_line->AppendSwitchASCII(switches::kProcessChannelID, channel_id()); |
| 47 | 54 |
| 48 if (!plugin_launcher.empty()) | 55 if (!plugin_launcher.empty()) |
| 49 cmd_line->PrependWrapper(plugin_launcher); | 56 cmd_line->PrependWrapper(plugin_launcher); |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 168 ::DuplicateHandle(::GetCurrentProcess(), broker_process, | 175 ::DuplicateHandle(::GetCurrentProcess(), broker_process, |
| 169 renderer_process, &renderers_broker_handle, | 176 renderer_process, &renderers_broker_handle, |
| 170 0, FALSE, DUPLICATE_SAME_ACCESS); | 177 0, FALSE, DUPLICATE_SAME_ACCESS); |
| 171 #elif defined(OS_POSIX) | 178 #elif defined(OS_POSIX) |
| 172 // Don't need to duplicate anything on POSIX since it's just a PID. | 179 // Don't need to duplicate anything on POSIX since it's just a PID. |
| 173 base::ProcessHandle renderers_broker_handle = broker_process; | 180 base::ProcessHandle renderers_broker_handle = broker_process; |
| 174 #endif | 181 #endif |
| 175 | 182 |
| 176 client->OnChannelOpened(renderers_broker_handle, channel_handle); | 183 client->OnChannelOpened(renderers_broker_handle, channel_handle); |
| 177 } | 184 } |
| OLD | NEW |