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