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