OLD | NEW |
---|---|
1 // Copyright (c) 2012 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> | 7 #include <string> |
8 | 8 |
9 #include "base/base_switches.h" | 9 #include "base/base_switches.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
319 // plugin launcher means we need to use another process instead of just | 319 // plugin launcher means we need to use another process instead of just |
320 // forking the zygote. | 320 // forking the zygote. |
321 #if defined(OS_POSIX) | 321 #if defined(OS_POSIX) |
322 bool use_zygote = !is_broker_ && plugin_launcher.empty() && info.is_sandboxed; | 322 bool use_zygote = !is_broker_ && plugin_launcher.empty() && info.is_sandboxed; |
323 if (!info.is_sandboxed) | 323 if (!info.is_sandboxed) |
324 cmd_line->AppendSwitchASCII(switches::kNoSandbox, std::string()); | 324 cmd_line->AppendSwitchASCII(switches::kNoSandbox, std::string()); |
325 #endif // OS_POSIX | 325 #endif // OS_POSIX |
326 process_->Launch( | 326 process_->Launch( |
327 #if defined(OS_WIN) | 327 #if defined(OS_WIN) |
328 new PpapiPluginSandboxedProcessLauncherDelegate(is_broker_), | 328 new PpapiPluginSandboxedProcessLauncherDelegate(is_broker_), |
329 false, | |
329 #elif defined(OS_POSIX) | 330 #elif defined(OS_POSIX) |
330 use_zygote, | 331 use_zygote, |
331 base::EnvironmentMap(), | 332 base::EnvironmentMap(), |
332 #endif | 333 #endif |
333 cmd_line); | 334 cmd_line); |
334 return true; | 335 return true; |
335 } | 336 } |
336 | 337 |
337 void PpapiPluginProcessHost::RequestPluginChannel(Client* client) { | 338 void PpapiPluginProcessHost::RequestPluginChannel(Client* client) { |
338 base::ProcessHandle process_handle; | 339 base::ProcessHandle process_handle; |
339 int renderer_child_id; | 340 int renderer_child_id; |
340 client->GetPpapiChannelInfo(&process_handle, &renderer_child_id); | 341 client->GetPpapiChannelInfo(&process_handle, &renderer_child_id); |
341 | 342 |
342 base::ProcessId process_id = (process_handle == base::kNullProcessHandle) ? | 343 base::ProcessId process_id = (process_handle == base::kNullProcessHandle) ? |
343 0 : base::GetProcId(process_handle); | 344 0 : base::GetProcId(process_handle); |
344 | 345 |
345 // We can't send any sync messages from the browser because it might lead to | 346 // We can't send any sync messages from the browser because it might lead to |
346 // a hang. See the similar code in PluginProcessHost for more description. | 347 // a hang. See the similar code in PluginProcessHost for more description. |
347 PpapiMsg_CreateChannel* msg = new PpapiMsg_CreateChannel( | 348 PpapiMsg_CreateChannel* msg = new PpapiMsg_CreateChannel( |
348 process_id, renderer_child_id, client->OffTheRecord()); | 349 process_id, renderer_child_id, client->OffTheRecord()); |
349 msg->set_unblock(true); | 350 msg->set_unblock(true); |
350 if (Send(msg)) { | 351 if (Send(msg)) { |
351 sent_requests_.push(client); | 352 sent_requests_.push(client); |
352 } else { | 353 } else { |
353 client->OnPpapiChannelOpened(IPC::ChannelHandle(), base::kNullProcessId, 0); | 354 client->OnPpapiChannelOpened(IPC::ChannelHandle(), base::kNullProcessId, 0); |
354 } | 355 } |
355 } | 356 } |
356 | 357 |
357 void PpapiPluginProcessHost::OnProcessLaunched() { | 358 void PpapiPluginProcessHost::OnProcessLaunched() { |
358 host_impl_->set_plugin_process_handle(process_->GetHandle()); | 359 host_impl_->set_plugin_process_handle( |
360 static_cast<ChildProcessHostDelegate*>(process_.get())->GetHandle()); | |
jam
2014/02/01 01:09:10
I just noticed this and the other places that case
Drew Haven
2014/02/04 21:25:54
Okay, I sort of thought the same thing. But I did
| |
359 } | 361 } |
360 | 362 |
361 void PpapiPluginProcessHost::OnProcessCrashed(int exit_code) { | 363 void PpapiPluginProcessHost::OnProcessCrashed(int exit_code) { |
362 PluginServiceImpl::GetInstance()->RegisterPluginCrash(plugin_path_); | 364 PluginServiceImpl::GetInstance()->RegisterPluginCrash(plugin_path_); |
363 } | 365 } |
364 | 366 |
365 bool PpapiPluginProcessHost::OnMessageReceived(const IPC::Message& msg) { | 367 bool PpapiPluginProcessHost::OnMessageReceived(const IPC::Message& msg) { |
366 bool handled = true; | 368 bool handled = true; |
367 IPC_BEGIN_MESSAGE_MAP(PpapiPluginProcessHost, msg) | 369 IPC_BEGIN_MESSAGE_MAP(PpapiPluginProcessHost, msg) |
368 IPC_MESSAGE_HANDLER(PpapiHostMsg_ChannelCreated, | 370 IPC_MESSAGE_HANDLER(PpapiHostMsg_ChannelCreated, |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
424 // sent_requests_ queue should be the one that the plugin just created. | 426 // sent_requests_ queue should be the one that the plugin just created. |
425 Client* client = sent_requests_.front(); | 427 Client* client = sent_requests_.front(); |
426 sent_requests_.pop(); | 428 sent_requests_.pop(); |
427 | 429 |
428 const ChildProcessData& data = process_->GetData(); | 430 const ChildProcessData& data = process_->GetData(); |
429 client->OnPpapiChannelOpened(channel_handle, base::GetProcId(data.handle), | 431 client->OnPpapiChannelOpened(channel_handle, base::GetProcId(data.handle), |
430 data.id); | 432 data.id); |
431 } | 433 } |
432 | 434 |
433 } // namespace content | 435 } // namespace content |
OLD | NEW |