OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_plugin_process_host.h" | 5 #include "content/browser/ppapi_plugin_process_host.h" |
6 | 6 |
| 7 #include <string> |
| 8 |
7 #include "base/base_switches.h" | 9 #include "base/base_switches.h" |
8 #include "base/command_line.h" | 10 #include "base/command_line.h" |
9 #include "base/file_path.h" | 11 #include "base/file_path.h" |
10 #include "base/process_util.h" | 12 #include "base/process_util.h" |
11 #include "base/utf_string_conversions.h" | 13 #include "base/utf_string_conversions.h" |
12 #include "content/browser/browser_child_process_host_impl.h" | 14 #include "content/browser/browser_child_process_host_impl.h" |
13 #include "content/browser/plugin_service_impl.h" | 15 #include "content/browser/plugin_service_impl.h" |
14 #include "content/browser/renderer_host/render_message_filter.h" | 16 #include "content/browser/renderer_host/render_message_filter.h" |
15 #include "content/common/child_process_host_impl.h" | 17 #include "content/common/child_process_host_impl.h" |
16 #include "content/common/child_process_messages.h" | 18 #include "content/common/child_process_messages.h" |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 DVLOG(1) << "PpapiPluginProcessHost" << (is_broker_ ? "[broker]" : "") | 65 DVLOG(1) << "PpapiPluginProcessHost" << (is_broker_ ? "[broker]" : "") |
64 << "~PpapiPluginProcessHost()"; | 66 << "~PpapiPluginProcessHost()"; |
65 CancelRequests(); | 67 CancelRequests(); |
66 } | 68 } |
67 | 69 |
68 PpapiPluginProcessHost* PpapiPluginProcessHost::CreatePluginHost( | 70 PpapiPluginProcessHost* PpapiPluginProcessHost::CreatePluginHost( |
69 const content::PepperPluginInfo& info, | 71 const content::PepperPluginInfo& info, |
70 net::HostResolver* host_resolver) { | 72 net::HostResolver* host_resolver) { |
71 PpapiPluginProcessHost* plugin_host = | 73 PpapiPluginProcessHost* plugin_host = |
72 new PpapiPluginProcessHost(host_resolver); | 74 new PpapiPluginProcessHost(host_resolver); |
73 if(plugin_host->Init(info)) | 75 if (plugin_host->Init(info)) |
74 return plugin_host; | 76 return plugin_host; |
75 | 77 |
76 NOTREACHED(); // Init is not expected to fail. | 78 NOTREACHED(); // Init is not expected to fail. |
77 return NULL; | 79 return NULL; |
78 } | 80 } |
79 | 81 |
80 PpapiPluginProcessHost* PpapiPluginProcessHost::CreateBrokerHost( | 82 PpapiPluginProcessHost* PpapiPluginProcessHost::CreateBrokerHost( |
81 const content::PepperPluginInfo& info) { | 83 const content::PepperPluginInfo& info) { |
82 PpapiPluginProcessHost* plugin_host = | 84 PpapiPluginProcessHost* plugin_host = |
83 new PpapiPluginProcessHost(); | 85 new PpapiPluginProcessHost(); |
84 if(plugin_host->Init(info)) | 86 if (plugin_host->Init(info)) |
85 return plugin_host; | 87 return plugin_host; |
86 | 88 |
87 NOTREACHED(); // Init is not expected to fail. | 89 NOTREACHED(); // Init is not expected to fail. |
88 return NULL; | 90 return NULL; |
89 } | 91 } |
90 | 92 |
91 bool PpapiPluginProcessHost::Send(IPC::Message* message) { | 93 bool PpapiPluginProcessHost::Send(IPC::Message* message) { |
92 return process_->Send(message); | 94 return process_->Send(message); |
93 } | 95 } |
94 | 96 |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
181 // plugin launcher means we need to use another process instead of just | 183 // plugin launcher means we need to use another process instead of just |
182 // forking the zygote. | 184 // forking the zygote. |
183 #if defined(OS_POSIX) | 185 #if defined(OS_POSIX) |
184 bool use_zygote = !is_broker_ && plugin_launcher.empty() && info.is_sandboxed; | 186 bool use_zygote = !is_broker_ && plugin_launcher.empty() && info.is_sandboxed; |
185 #endif // OS_POSIX | 187 #endif // OS_POSIX |
186 process_->Launch( | 188 process_->Launch( |
187 #if defined(OS_WIN) | 189 #if defined(OS_WIN) |
188 FilePath(), | 190 FilePath(), |
189 #elif defined(OS_POSIX) | 191 #elif defined(OS_POSIX) |
190 use_zygote, | 192 use_zygote, |
191 base::environment_vector(), | 193 base::EnvironmentVector(), |
192 #endif | 194 #endif |
193 cmd_line); | 195 cmd_line); |
194 return true; | 196 return true; |
195 } | 197 } |
196 | 198 |
197 void PpapiPluginProcessHost::RequestPluginChannel(Client* client) { | 199 void PpapiPluginProcessHost::RequestPluginChannel(Client* client) { |
198 base::ProcessHandle process_handle; | 200 base::ProcessHandle process_handle; |
199 int renderer_id; | 201 int renderer_id; |
200 client->GetChannelInfo(&process_handle, &renderer_id); | 202 client->GetChannelInfo(&process_handle, &renderer_id); |
201 | 203 |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
287 ::DuplicateHandle(::GetCurrentProcess(), plugin_process, | 289 ::DuplicateHandle(::GetCurrentProcess(), plugin_process, |
288 renderer_process, &renderers_plugin_handle, | 290 renderer_process, &renderers_plugin_handle, |
289 0, FALSE, DUPLICATE_SAME_ACCESS); | 291 0, FALSE, DUPLICATE_SAME_ACCESS); |
290 #elif defined(OS_POSIX) | 292 #elif defined(OS_POSIX) |
291 // Don't need to duplicate anything on POSIX since it's just a PID. | 293 // Don't need to duplicate anything on POSIX since it's just a PID. |
292 base::ProcessHandle renderers_plugin_handle = plugin_process; | 294 base::ProcessHandle renderers_plugin_handle = plugin_process; |
293 #endif | 295 #endif |
294 | 296 |
295 client->OnChannelOpened(renderers_plugin_handle, channel_handle); | 297 client->OnChannelOpened(renderers_plugin_handle, channel_handle); |
296 } | 298 } |
OLD | NEW |