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 <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 #include <utility> | 10 #include <utility> |
(...skipping 443 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
454 cmd_line, | 454 cmd_line, |
455 true); | 455 true); |
456 return true; | 456 return true; |
457 } | 457 } |
458 | 458 |
459 void PpapiPluginProcessHost::RequestPluginChannel(Client* client) { | 459 void PpapiPluginProcessHost::RequestPluginChannel(Client* client) { |
460 base::ProcessHandle process_handle; | 460 base::ProcessHandle process_handle; |
461 int renderer_child_id; | 461 int renderer_child_id; |
462 client->GetPpapiChannelInfo(&process_handle, &renderer_child_id); | 462 client->GetPpapiChannelInfo(&process_handle, &renderer_child_id); |
463 | 463 |
464 base::ProcessId process_id = (process_handle == base::kNullProcessHandle) ? | 464 base::ProcessId process_id = base::kNullProcessId; |
465 0 : base::GetProcId(process_handle); | 465 if (process_handle != base::kNullProcessHandle) { |
| 466 // This channel is not used by the browser itself. |
| 467 process_id = base::GetProcId(process_handle); |
| 468 CHECK_NE(base::kNullProcessId, process_id); |
| 469 } |
466 | 470 |
467 // We can't send any sync messages from the browser because it might lead to | 471 // We can't send any sync messages from the browser because it might lead to |
468 // a hang. See the similar code in PluginProcessHost for more description. | 472 // a hang. See the similar code in PluginProcessHost for more description. |
469 PpapiMsg_CreateChannel* msg = new PpapiMsg_CreateChannel( | 473 PpapiMsg_CreateChannel* msg = new PpapiMsg_CreateChannel( |
470 process_id, renderer_child_id, client->OffTheRecord()); | 474 process_id, renderer_child_id, client->OffTheRecord()); |
471 msg->set_unblock(true); | 475 msg->set_unblock(true); |
472 if (Send(msg)) { | 476 if (Send(msg)) { |
473 sent_requests_.push(client); | 477 sent_requests_.push(client); |
474 } else { | 478 } else { |
475 client->OnPpapiChannelOpened(IPC::ChannelHandle(), base::kNullProcessId, 0); | 479 client->OnPpapiChannelOpened(IPC::ChannelHandle(), base::kNullProcessId, 0); |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
548 // sent_requests_ queue should be the one that the plugin just created. | 552 // sent_requests_ queue should be the one that the plugin just created. |
549 Client* client = sent_requests_.front(); | 553 Client* client = sent_requests_.front(); |
550 sent_requests_.pop(); | 554 sent_requests_.pop(); |
551 | 555 |
552 const ChildProcessData& data = process_->GetData(); | 556 const ChildProcessData& data = process_->GetData(); |
553 client->OnPpapiChannelOpened(channel_handle, base::GetProcId(data.handle), | 557 client->OnPpapiChannelOpened(channel_handle, base::GetProcId(data.handle), |
554 data.id); | 558 data.id); |
555 } | 559 } |
556 | 560 |
557 } // namespace content | 561 } // namespace content |
OLD | NEW |