| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "build/build_config.h" | 5 #include "build/build_config.h" |
| 6 | 6 |
| 7 #include "chrome/browser/nacl_host/nacl_process_host.h" | 7 #include "chrome/browser/nacl_host/nacl_process_host.h" |
| 8 | 8 |
| 9 #if defined(OS_POSIX) | 9 #if defined(OS_POSIX) |
| 10 #include <fcntl.h> | 10 #include <fcntl.h> |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 142 LOG(ERROR) << "nacl::Close() failed"; | 142 LOG(ERROR) << "nacl::Close() failed"; |
| 143 } | 143 } |
| 144 } | 144 } |
| 145 | 145 |
| 146 if (reply_msg_) { | 146 if (reply_msg_) { |
| 147 // The process failed to launch for some reason. | 147 // The process failed to launch for some reason. |
| 148 // Don't keep the renderer hanging. | 148 // Don't keep the renderer hanging. |
| 149 reply_msg_->set_reply_error(); | 149 reply_msg_->set_reply_error(); |
| 150 chrome_render_message_filter_->Send(reply_msg_); | 150 chrome_render_message_filter_->Send(reply_msg_); |
| 151 } | 151 } |
| 152 |
| 153 #if defined(OS_WIN) |
| 154 NaClBrokerService::GetInstance()->OnLoaderDied(); |
| 155 #endif |
| 152 } | 156 } |
| 153 | 157 |
| 154 // Attempt to ensure the IRT will be available when we need it, but don't wait. | 158 // Attempt to ensure the IRT will be available when we need it, but don't wait. |
| 155 bool NaClBrowser::EnsureIrtAvailable() { | 159 bool NaClBrowser::EnsureIrtAvailable() { |
| 156 if (IrtAvailable()) | 160 if (IrtAvailable()) |
| 157 return true; | 161 return true; |
| 158 | 162 |
| 159 return BrowserThread::PostTask( | 163 return BrowserThread::PostTask( |
| 160 BrowserThread::FILE, FROM_HERE, | 164 BrowserThread::FILE, FROM_HERE, |
| 161 base::Bind(&NaClBrowser::DoOpenIrtLibraryFile)); | 165 base::Bind(&NaClBrowser::DoOpenIrtLibraryFile)); |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 286 #endif | 290 #endif |
| 287 | 291 |
| 288 return true; | 292 return true; |
| 289 } | 293 } |
| 290 | 294 |
| 291 void NaClProcessHost::OnProcessLaunchedByBroker(base::ProcessHandle handle) { | 295 void NaClProcessHost::OnProcessLaunchedByBroker(base::ProcessHandle handle) { |
| 292 set_handle(handle); | 296 set_handle(handle); |
| 293 OnProcessLaunched(); | 297 OnProcessLaunched(); |
| 294 } | 298 } |
| 295 | 299 |
| 296 base::TerminationStatus NaClProcessHost::GetChildTerminationStatus( | 300 void NaClProcessHost::OnProcessCrashed(int exit_code) { |
| 297 int* exit_code) { | 301 std::string message = base::StringPrintf( |
| 298 if (RunningOnWOW64()) | 302 "NaCl process exited with status %i (0x%x)", exit_code, exit_code); |
| 299 return base::GetTerminationStatus(handle(), exit_code); | 303 LOG(ERROR) << message; |
| 300 return BrowserChildProcessHost::GetChildTerminationStatus(exit_code); | |
| 301 } | 304 } |
| 302 | 305 |
| 303 // This only ever runs on the BrowserThread::FILE thread. | 306 // This only ever runs on the BrowserThread::FILE thread. |
| 304 // If multiple tasks are posted, the later ones are no-ops. | 307 // If multiple tasks are posted, the later ones are no-ops. |
| 305 void NaClBrowser::OpenIrtLibraryFile() { | 308 void NaClBrowser::OpenIrtLibraryFile() { |
| 306 if (irt_platform_file_ != base::kInvalidPlatformFileValue) | 309 if (irt_platform_file_ != base::kInvalidPlatformFileValue) |
| 307 // We've already run. | 310 // We've already run. |
| 308 return; | 311 return; |
| 309 | 312 |
| 310 FilePath irt_filepath; | 313 FilePath irt_filepath; |
| (...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 512 #endif | 515 #endif |
| 513 | 516 |
| 514 Send(new NaClProcessMsg_Start(handles_for_sel_ldr)); | 517 Send(new NaClProcessMsg_Start(handles_for_sel_ldr)); |
| 515 internal_->sockets_for_sel_ldr.clear(); | 518 internal_->sockets_for_sel_ldr.clear(); |
| 516 } | 519 } |
| 517 | 520 |
| 518 bool NaClProcessHost::OnMessageReceived(const IPC::Message& msg) { | 521 bool NaClProcessHost::OnMessageReceived(const IPC::Message& msg) { |
| 519 NOTREACHED() << "Invalid message with type = " << msg.type(); | 522 NOTREACHED() << "Invalid message with type = " << msg.type(); |
| 520 return false; | 523 return false; |
| 521 } | 524 } |
| OLD | NEW |