Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(69)

Side by Side Diff: trunk/src/components/nacl/browser/nacl_process_host.cc

Issue 290633006: Revert 270907 "Remove knowledge of nacl from content." (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 "components/nacl/browser/nacl_process_host.h" 5 #include "components/nacl/browser/nacl_process_host.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after
305 int exit_code = 0; 305 int exit_code = 0;
306 process_->GetTerminationStatus(false /* known_dead */, &exit_code); 306 process_->GetTerminationStatus(false /* known_dead */, &exit_code);
307 std::string message = 307 std::string message =
308 base::StringPrintf("NaCl process exited with status %i (0x%x)", 308 base::StringPrintf("NaCl process exited with status %i (0x%x)",
309 exit_code, exit_code); 309 exit_code, exit_code);
310 if (exit_code == 0) { 310 if (exit_code == 0) {
311 VLOG(1) << message; 311 VLOG(1) << message;
312 } else { 312 } else {
313 LOG(ERROR) << message; 313 LOG(ERROR) << message;
314 } 314 }
315 NaClBrowser::GetInstance()->OnProcessEnd(process_->GetData().id);
316 } 315 }
317 316
318 if (internal_->socket_for_renderer != NACL_INVALID_HANDLE) { 317 if (internal_->socket_for_renderer != NACL_INVALID_HANDLE) {
319 if (NaClClose(internal_->socket_for_renderer) != 0) { 318 if (NaClClose(internal_->socket_for_renderer) != 0) {
320 NOTREACHED() << "NaClClose() failed"; 319 NOTREACHED() << "NaClClose() failed";
321 } 320 }
322 } 321 }
323 322
324 if (internal_->socket_for_sel_ldr != NACL_INVALID_HANDLE) { 323 if (internal_->socket_for_sel_ldr != NACL_INVALID_HANDLE) {
325 if (NaClClose(internal_->socket_for_sel_ldr) != 0) { 324 if (NaClClose(internal_->socket_for_sel_ldr) != 0) {
(...skipping 19 matching lines...) Expand all
345 !CommandLine::ForCurrentProcess()->HasSwitch( 344 !CommandLine::ForCurrentProcess()->HasSwitch(
346 switches::kDisablePnaclCrashThrottling)) { 345 switches::kDisablePnaclCrashThrottling)) {
347 NaClBrowser::GetInstance()->OnProcessCrashed(); 346 NaClBrowser::GetInstance()->OnProcessCrashed();
348 } 347 }
349 } 348 }
350 349
351 // This is called at browser startup. 350 // This is called at browser startup.
352 // static 351 // static
353 void NaClProcessHost::EarlyStartup() { 352 void NaClProcessHost::EarlyStartup() {
354 NaClBrowser::GetInstance()->EarlyStartup(); 353 NaClBrowser::GetInstance()->EarlyStartup();
355 // Inform NaClBrowser that we exist and will have a debug port at some point.
356 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) 354 #if defined(OS_LINUX) && !defined(OS_CHROMEOS)
357 // Open the IRT file early to make sure that it isn't replaced out from 355 // Open the IRT file early to make sure that it isn't replaced out from
358 // under us by autoupdate. 356 // under us by autoupdate.
359 NaClBrowser::GetInstance()->EnsureIrtAvailable(); 357 NaClBrowser::GetInstance()->EnsureIrtAvailable();
360 #endif 358 #endif
361 CommandLine* cmd = CommandLine::ForCurrentProcess(); 359 CommandLine* cmd = CommandLine::ForCurrentProcess();
362 UMA_HISTOGRAM_BOOLEAN( 360 UMA_HISTOGRAM_BOOLEAN(
363 "NaCl.nacl-gdb", 361 "NaCl.nacl-gdb",
364 !cmd->GetSwitchValuePath(switches::kNaClGdb).empty()); 362 !cmd->GetSwitchValuePath(switches::kNaClGdb).empty());
365 UMA_HISTOGRAM_BOOLEAN( 363 UMA_HISTOGRAM_BOOLEAN(
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
486 if (!CommandLine::ForCurrentProcess()->GetSwitchValuePath( 484 if (!CommandLine::ForCurrentProcess()->GetSwitchValuePath(
487 switches::kNaClGdb).empty()) { 485 switches::kNaClGdb).empty()) {
488 LaunchNaClGdb(); 486 LaunchNaClGdb();
489 } 487 }
490 } 488 }
491 489
492 #if defined(OS_WIN) 490 #if defined(OS_WIN)
493 void NaClProcessHost::OnProcessLaunchedByBroker(base::ProcessHandle handle) { 491 void NaClProcessHost::OnProcessLaunchedByBroker(base::ProcessHandle handle) {
494 process_launched_by_broker_ = true; 492 process_launched_by_broker_ = true;
495 process_->SetHandle(handle); 493 process_->SetHandle(handle);
496 SetDebugStubPort(nacl::kGdbDebugStubPortUnknown);
497 if (!StartWithLaunchedProcess()) 494 if (!StartWithLaunchedProcess())
498 delete this; 495 delete this;
499 } 496 }
500 497
501 void NaClProcessHost::OnDebugExceptionHandlerLaunchedByBroker(bool success) { 498 void NaClProcessHost::OnDebugExceptionHandlerLaunchedByBroker(bool success) {
502 IPC::Message* reply = attach_debug_exception_handler_reply_msg_.release(); 499 IPC::Message* reply = attach_debug_exception_handler_reply_msg_.release();
503 NaClProcessMsg_AttachDebugExceptionHandler::WriteReplyParams(reply, success); 500 NaClProcessMsg_AttachDebugExceptionHandler::WriteReplyParams(reply, success);
504 Send(reply); 501 Send(reply);
505 } 502 }
506 #endif 503 #endif
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after
762 DCHECK(reply_msg_); 759 DCHECK(reply_msg_);
763 if (nacl_host_message_filter_ != NULL && reply_msg_ != NULL) { 760 if (nacl_host_message_filter_ != NULL && reply_msg_ != NULL) {
764 NaClHostMsg_LaunchNaCl::WriteReplyParams( 761 NaClHostMsg_LaunchNaCl::WriteReplyParams(
765 reply_msg_, result, error_message); 762 reply_msg_, result, error_message);
766 nacl_host_message_filter_->Send(reply_msg_); 763 nacl_host_message_filter_->Send(reply_msg_);
767 nacl_host_message_filter_ = NULL; 764 nacl_host_message_filter_ = NULL;
768 reply_msg_ = NULL; 765 reply_msg_ = NULL;
769 } 766 }
770 } 767 }
771 768
772 void NaClProcessHost::SetDebugStubPort(int port) { 769 void NaClProcessHost::SetDebugStubPort(uint16_t port) {
773 NaClBrowser* nacl_browser = NaClBrowser::GetInstance(); 770 NaClBrowser* nacl_browser = NaClBrowser::GetInstance();
774 nacl_browser->SetProcessGdbDebugStubPort(process_->GetData().id, port); 771 if (nacl_browser->HasGdbDebugStubPortListener()) {
772 nacl_browser->FireGdbDebugStubPortOpened(port);
773 }
774 // Set debug stub port on the process object.
775 process_->SetNaClDebugStubPort(port);
775 } 776 }
776 777
777 #if defined(OS_POSIX) 778 #if defined(OS_POSIX)
778 // TCP port we chose for NaCl debug stub. It can be any other number. 779 // TCP port we chose for NaCl debug stub. It can be any other number.
779 static const int kInitialDebugStubPort = 4014; 780 static const int kInitialDebugStubPort = 4014;
780 781
781 net::SocketDescriptor NaClProcessHost::GetDebugStubSocketHandle() { 782 net::SocketDescriptor NaClProcessHost::GetDebugStubSocketHandle() {
782 net::SocketDescriptor s = net::kInvalidSocket; 783 net::SocketDescriptor s = net::kInvalidSocket;
783 // We always try to allocate the default port first. If this fails, we then 784 // We always try to allocate the default port first. If this fails, we then
784 // allocate any available port. 785 // allocate any available port.
(...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after
1131 process_handle.Take(), info, 1132 process_handle.Take(), info,
1132 base::MessageLoopProxy::current(), 1133 base::MessageLoopProxy::current(),
1133 base::Bind(&NaClProcessHost::OnDebugExceptionHandlerLaunchedByBroker, 1134 base::Bind(&NaClProcessHost::OnDebugExceptionHandlerLaunchedByBroker,
1134 weak_factory_.GetWeakPtr())); 1135 weak_factory_.GetWeakPtr()));
1135 return true; 1136 return true;
1136 } 1137 }
1137 } 1138 }
1138 #endif 1139 #endif
1139 1140
1140 } // namespace nacl 1141 } // namespace nacl
OLDNEW
« no previous file with comments | « trunk/src/components/nacl/browser/nacl_process_host.h ('k') | trunk/src/content/browser/browser_child_process_host_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698