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/plugin_process_host.h" | 5 #include "content/browser/plugin_process_host.h" |
6 | 6 |
7 #if defined(OS_WIN) | 7 #if defined(OS_WIN) |
8 #include <windows.h> | 8 #include <windows.h> |
9 #elif defined(OS_POSIX) | 9 #elif defined(OS_POSIX) |
10 #include <utility> // for pair<> | 10 #include <utility> // for pair<> |
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
168 set_version(info_.version); | 168 set_version(info_.version); |
169 | 169 |
170 if (!CreateChannel()) | 170 if (!CreateChannel()) |
171 return false; | 171 return false; |
172 | 172 |
173 // Build command line for plugin. When we have a plugin launcher, we can't | 173 // Build command line for plugin. When we have a plugin launcher, we can't |
174 // allow "self" on linux and we need the real file path. | 174 // allow "self" on linux and we need the real file path. |
175 const CommandLine& browser_command_line = *CommandLine::ForCurrentProcess(); | 175 const CommandLine& browser_command_line = *CommandLine::ForCurrentProcess(); |
176 CommandLine::StringType plugin_launcher = | 176 CommandLine::StringType plugin_launcher = |
177 browser_command_line.GetSwitchValueNative(switches::kPluginLauncher); | 177 browser_command_line.GetSwitchValueNative(switches::kPluginLauncher); |
178 FilePath exe_path = GetChildPath(plugin_launcher.empty()); | 178 |
| 179 #if defined(OS_MACOSX) |
| 180 // Run the plug-in process in a mode tolerant of heap execution without |
| 181 // explicit mprotect calls. Some plug-ins still rely on this quaint and |
| 182 // archaic "feature." See http://crbug.com/93551. |
| 183 int flags = CHILD_ALLOW_HEAP_EXECUTION; |
| 184 #elif defined(OS_LINUX) |
| 185 int flags = plugin_launcher.empty() ? CHILD_ALLOW_SELF : CHILD_NORMAL; |
| 186 #else |
| 187 int flags = CHILD_NORMAL; |
| 188 #endif |
| 189 |
| 190 FilePath exe_path = GetChildPath(flags); |
179 if (exe_path.empty()) | 191 if (exe_path.empty()) |
180 return false; | 192 return false; |
181 | 193 |
182 CommandLine* cmd_line = new CommandLine(exe_path); | 194 CommandLine* cmd_line = new CommandLine(exe_path); |
183 // Put the process type and plugin path first so they're easier to see | 195 // Put the process type and plugin path first so they're easier to see |
184 // in process listings using native process management tools. | 196 // in process listings using native process management tools. |
185 cmd_line->AppendSwitchASCII(switches::kProcessType, switches::kPluginProcess); | 197 cmd_line->AppendSwitchASCII(switches::kProcessType, switches::kPluginProcess); |
186 cmd_line->AppendSwitchPath(switches::kPluginPath, info.path); | 198 cmd_line->AppendSwitchPath(switches::kPluginPath, info.path); |
187 | 199 |
188 // Propagate the following switches to the plugin command line (along with | 200 // Propagate the following switches to the plugin command line (along with |
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
355 } | 367 } |
356 } | 368 } |
357 | 369 |
358 void PluginProcessHost::OnChannelCreated( | 370 void PluginProcessHost::OnChannelCreated( |
359 const IPC::ChannelHandle& channel_handle) { | 371 const IPC::ChannelHandle& channel_handle) { |
360 Client* client = sent_requests_.front(); | 372 Client* client = sent_requests_.front(); |
361 | 373 |
362 client->OnChannelOpened(channel_handle); | 374 client->OnChannelOpened(channel_handle); |
363 sent_requests_.pop(); | 375 sent_requests_.pop(); |
364 } | 376 } |
OLD | NEW |