| 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 "chrome/browser/nacl_host/nacl_process_host.h" | 5 #include "chrome/browser/nacl_host/nacl_process_host.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 272 } | 272 } |
| 273 | 273 |
| 274 if (reply_msg_) { | 274 if (reply_msg_) { |
| 275 // The process failed to launch for some reason. | 275 // The process failed to launch for some reason. |
| 276 // Don't keep the renderer hanging. | 276 // Don't keep the renderer hanging. |
| 277 reply_msg_->set_reply_error(); | 277 reply_msg_->set_reply_error(); |
| 278 chrome_render_message_filter_->Send(reply_msg_); | 278 chrome_render_message_filter_->Send(reply_msg_); |
| 279 } | 279 } |
| 280 #if defined(OS_WIN) | 280 #if defined(OS_WIN) |
| 281 if (RunningOnWOW64()) { | 281 if (RunningOnWOW64()) { |
| 282 NaClBrokerService::GetInstance()->OnLoaderDied(); | 282 // If the nacl-gdb switch is not empty, the NaCl loader has been launched |
| 283 // without the broker and so we shouldn't inform the broker about |
| 284 // the loader termination. |
| 285 if (CommandLine::ForCurrentProcess()->GetSwitchValuePath( |
| 286 switches::kNaClGdb).empty()) { |
| 287 NaClBrokerService::GetInstance()->OnLoaderDied(); |
| 288 } |
| 283 } else { | 289 } else { |
| 284 debug_context_->SetChildProcessHost(NULL); | 290 debug_context_->SetChildProcessHost(NULL); |
| 285 } | 291 } |
| 286 #endif | 292 #endif |
| 287 } | 293 } |
| 288 | 294 |
| 289 // Attempt to ensure the IRT will be available when we need it, but don't wait. | 295 // Attempt to ensure the IRT will be available when we need it, but don't wait. |
| 290 bool NaClBrowser::EnsureIrtAvailable() { | 296 bool NaClBrowser::EnsureIrtAvailable() { |
| 291 if (IrtAvailable()) | 297 if (IrtAvailable()) |
| 292 return true; | 298 return true; |
| (...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 592 void NaClProcessHost::OnChannelConnected(int32 peer_pid) { | 598 void NaClProcessHost::OnChannelConnected(int32 peer_pid) { |
| 593 // Set process handle, if it was not set previously. | 599 // Set process handle, if it was not set previously. |
| 594 // This is needed when NaCl process is launched with nacl-gdb. | 600 // This is needed when NaCl process is launched with nacl-gdb. |
| 595 if (process_->GetData().handle == base::kNullProcessHandle) { | 601 if (process_->GetData().handle == base::kNullProcessHandle) { |
| 596 base::ProcessHandle process; | 602 base::ProcessHandle process; |
| 597 DCHECK(!CommandLine::ForCurrentProcess()->GetSwitchValuePath( | 603 DCHECK(!CommandLine::ForCurrentProcess()->GetSwitchValuePath( |
| 598 switches::kNaClGdb).empty()); | 604 switches::kNaClGdb).empty()); |
| 599 if (base::OpenProcessHandleWithAccess( | 605 if (base::OpenProcessHandleWithAccess( |
| 600 peer_pid, | 606 peer_pid, |
| 601 base::kProcessAccessDuplicateHandle | | 607 base::kProcessAccessDuplicateHandle | |
| 602 base::kProcessAccessQueryLimitedInfomation | | 608 base::kProcessAccessQueryInformation | |
| 603 base::kProcessAccessWaitForTermination, | 609 base::kProcessAccessWaitForTermination, |
| 604 &process)) { | 610 &process)) { |
| 605 process_->SetHandle(process); | 611 process_->SetHandle(process); |
| 606 OnProcessLaunched(); | 612 OnProcessLaunched(); |
| 607 } else { | 613 } else { |
| 608 LOG(ERROR) << "Failed to get process handle"; | 614 LOG(ERROR) << "Failed to get process handle"; |
| 609 } | 615 } |
| 610 } | 616 } |
| 611 if (!IsHardwareExceptionHandlingEnabled()) { | 617 if (!IsHardwareExceptionHandlingEnabled()) { |
| 612 return; | 618 return; |
| (...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 796 process_->Send(new NaClProcessMsg_Start(handles_for_sel_ldr)); | 802 process_->Send(new NaClProcessMsg_Start(handles_for_sel_ldr)); |
| 797 #endif | 803 #endif |
| 798 | 804 |
| 799 internal_->sockets_for_sel_ldr.clear(); | 805 internal_->sockets_for_sel_ldr.clear(); |
| 800 } | 806 } |
| 801 | 807 |
| 802 bool NaClProcessHost::OnMessageReceived(const IPC::Message& msg) { | 808 bool NaClProcessHost::OnMessageReceived(const IPC::Message& msg) { |
| 803 NOTREACHED() << "Invalid message with type = " << msg.type(); | 809 NOTREACHED() << "Invalid message with type = " << msg.type(); |
| 804 return false; | 810 return false; |
| 805 } | 811 } |
| OLD | NEW |