Chromium Code Reviews| 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 374 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 385 int flags = nacl_loader_prefix.empty() ? ChildProcessHost::CHILD_ALLOW_SELF : | 385 int flags = nacl_loader_prefix.empty() ? ChildProcessHost::CHILD_ALLOW_SELF : |
| 386 ChildProcessHost::CHILD_NORMAL; | 386 ChildProcessHost::CHILD_NORMAL; |
| 387 #else | 387 #else |
| 388 int flags = ChildProcessHost::CHILD_NORMAL; | 388 int flags = ChildProcessHost::CHILD_NORMAL; |
| 389 #endif | 389 #endif |
| 390 | 390 |
| 391 FilePath exe_path = ChildProcessHost::GetChildPath(flags); | 391 FilePath exe_path = ChildProcessHost::GetChildPath(flags); |
| 392 if (exe_path.empty()) | 392 if (exe_path.empty()) |
| 393 return false; | 393 return false; |
| 394 | 394 |
| 395 CommandLine* cmd_line = new CommandLine(exe_path); | 395 CommandLine* cmd_line = new CommandLine(exe_path); |
|
sehr (please use chromium)
2012/03/01 19:05:48
It would be better if this became:
scoped_ptr<Comm
halyavin
2012/03/02 09:21:24
Done.
| |
| 396 nacl::CopyNaClCommandLineArguments(cmd_line); | 396 nacl::CopyNaClCommandLineArguments(cmd_line); |
| 397 | 397 |
| 398 cmd_line->AppendSwitchASCII(switches::kProcessType, | 398 cmd_line->AppendSwitchASCII(switches::kProcessType, |
| 399 switches::kNaClLoaderProcess); | 399 switches::kNaClLoaderProcess); |
| 400 cmd_line->AppendSwitchASCII(switches::kProcessChannelID, channel_id); | 400 cmd_line->AppendSwitchASCII(switches::kProcessChannelID, channel_id); |
| 401 if (logging::DialogsAreSuppressed()) | 401 if (logging::DialogsAreSuppressed()) |
| 402 cmd_line->AppendSwitch(switches::kNoErrorDialogs); | 402 cmd_line->AppendSwitch(switches::kNoErrorDialogs); |
| 403 | 403 |
| 404 if (!nacl_loader_prefix.empty()) | 404 if (!nacl_loader_prefix.empty()) |
| 405 cmd_line->PrependWrapper(nacl_loader_prefix); | 405 cmd_line->PrependWrapper(nacl_loader_prefix); |
| 406 | 406 |
| 407 // On Windows we might need to start the broker process to launch a new loader | 407 // On Windows we might need to start the broker process to launch a new loader |
| 408 #if defined(OS_WIN) | 408 #if defined(OS_WIN) |
| 409 if (RunningOnWOW64()) { | 409 if (RunningOnWOW64()) { |
| 410 delete cmd_line; | |
|
sehr (please use chromium)
2012/03/01 19:05:48
Then we could remove this line.
halyavin
2012/03/02 09:21:24
Done.
| |
| 410 return NaClBrokerService::GetInstance()->LaunchLoader( | 411 return NaClBrokerService::GetInstance()->LaunchLoader( |
| 411 this, ASCIIToWide(channel_id)); | 412 this, ASCIIToWide(channel_id)); |
| 412 } else { | 413 } else { |
| 413 process_->Launch(FilePath(), cmd_line); | 414 process_->Launch(FilePath(), cmd_line); |
|
sehr (please use chromium)
2012/03/01 19:05:48
This would have to be cmd_line.release()
halyavin
2012/03/02 09:21:24
Done.
| |
| 414 } | 415 } |
| 415 #elif defined(OS_POSIX) | 416 #elif defined(OS_POSIX) |
| 416 process_->Launch(nacl_loader_prefix.empty(), // use_zygote | 417 process_->Launch(nacl_loader_prefix.empty(), // use_zygote |
| 417 base::EnvironmentVector(), | 418 base::EnvironmentVector(), |
| 418 cmd_line); | 419 cmd_line); |
|
sehr (please use chromium)
2012/03/01 19:05:48
As would this.
halyavin
2012/03/02 09:21:24
Done.
| |
| 419 #endif | 420 #endif |
| 420 | 421 |
| 421 return true; | 422 return true; |
| 422 } | 423 } |
| 423 | 424 |
| 424 void NaClProcessHost::OnProcessLaunchedByBroker(base::ProcessHandle handle) { | 425 void NaClProcessHost::OnProcessLaunchedByBroker(base::ProcessHandle handle) { |
| 425 process_->SetHandle(handle); | 426 process_->SetHandle(handle); |
| 426 OnProcessLaunched(); | 427 OnProcessLaunched(); |
| 427 } | 428 } |
| 428 | 429 |
| (...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 727 process_->Send(new NaClProcessMsg_Start(handles_for_sel_ldr)); | 728 process_->Send(new NaClProcessMsg_Start(handles_for_sel_ldr)); |
| 728 #endif | 729 #endif |
| 729 | 730 |
| 730 internal_->sockets_for_sel_ldr.clear(); | 731 internal_->sockets_for_sel_ldr.clear(); |
| 731 } | 732 } |
| 732 | 733 |
| 733 bool NaClProcessHost::OnMessageReceived(const IPC::Message& msg) { | 734 bool NaClProcessHost::OnMessageReceived(const IPC::Message& msg) { |
| 734 NOTREACHED() << "Invalid message with type = " << msg.type(); | 735 NOTREACHED() << "Invalid message with type = " << msg.type(); |
| 735 return false; | 736 return false; |
| 736 } | 737 } |
| OLD | NEW |