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

Side by Side Diff: chrome/browser/nacl_host/nacl_process_host.cc

Issue 9566008: Fix memory leak in LaunchSelLdr. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 9 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "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
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 scoped_ptr<CommandLine> cmd_line(new CommandLine(exe_path));
396 nacl::CopyNaClCommandLineArguments(cmd_line); 396 nacl::CopyNaClCommandLineArguments(cmd_line.get());
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 return NaClBrokerService::GetInstance()->LaunchLoader( 410 return NaClBrokerService::GetInstance()->LaunchLoader(
411 this, ASCIIToWide(channel_id)); 411 this, ASCIIToWide(channel_id));
412 } else { 412 } else {
413 process_->Launch(FilePath(), cmd_line); 413 process_->Launch(FilePath(), cmd_line.release());
414 } 414 }
415 #elif defined(OS_POSIX) 415 #elif defined(OS_POSIX)
416 process_->Launch(nacl_loader_prefix.empty(), // use_zygote 416 process_->Launch(nacl_loader_prefix.empty(), // use_zygote
417 base::EnvironmentVector(), 417 base::EnvironmentVector(),
418 cmd_line); 418 cmd_line.release());
419 #endif 419 #endif
420 420
421 return true; 421 return true;
422 } 422 }
423 423
424 void NaClProcessHost::OnProcessLaunchedByBroker(base::ProcessHandle handle) { 424 void NaClProcessHost::OnProcessLaunchedByBroker(base::ProcessHandle handle) {
425 process_->SetHandle(handle); 425 process_->SetHandle(handle);
426 OnProcessLaunched(); 426 OnProcessLaunched();
427 } 427 }
428 428
(...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after
727 process_->Send(new NaClProcessMsg_Start(handles_for_sel_ldr)); 727 process_->Send(new NaClProcessMsg_Start(handles_for_sel_ldr));
728 #endif 728 #endif
729 729
730 internal_->sockets_for_sel_ldr.clear(); 730 internal_->sockets_for_sel_ldr.clear();
731 } 731 }
732 732
733 bool NaClProcessHost::OnMessageReceived(const IPC::Message& msg) { 733 bool NaClProcessHost::OnMessageReceived(const IPC::Message& msg) {
734 NOTREACHED() << "Invalid message with type = " << msg.type(); 734 NOTREACHED() << "Invalid message with type = " << msg.type();
735 return false; 735 return false;
736 } 736 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698