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

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

Issue 180223004: Amend PATH for nacl64 so loader can find x64 CRT (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 6 years, 10 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 | « build/gyp_chromium ('k') | 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 "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 494 matching lines...) Expand 10 before | Expand all | Expand 10 after
505 if (exe_path.empty()) 505 if (exe_path.empty())
506 return false; 506 return false;
507 507
508 #if defined(OS_WIN) 508 #if defined(OS_WIN)
509 // On Windows 64-bit NaCl loader is called nacl64.exe instead of chrome.exe 509 // On Windows 64-bit NaCl loader is called nacl64.exe instead of chrome.exe
510 if (RunningOnWOW64()) { 510 if (RunningOnWOW64()) {
511 if (!NaClBrowser::GetInstance()->GetNaCl64ExePath(&exe_path)) { 511 if (!NaClBrowser::GetInstance()->GetNaCl64ExePath(&exe_path)) {
512 SendErrorToRenderer("could not get path to nacl64.exe"); 512 SendErrorToRenderer("could not get path to nacl64.exe");
513 return false; 513 return false;
514 } 514 }
515
516 #ifdef _DLL
517 // When using the DLL CRT on Windows, we need to amend the PATH to include
518 // the location of the x64 CRT DLLs. This is only the case when using a
519 // component=shared_library build (i.e. generally dev debug builds). The
520 // x86 CRT DLLs are in e.g. out\Debug for chrome.exe etc., so the x64 ones
521 // are put in out\Debug\x64 which we add to the PATH here so that loader
522 // can find them. See http://crbug.com/346034.
523 scoped_ptr<base::Environment> env(base::Environment::Create());
524 static const char kPath[] = "PATH";
525 std::string old_path;
526 base::FilePath module_path;
527 if (!PathService::Get(base::FILE_MODULE, &module_path)) {
528 SendErrorToRenderer("could not get path to current module");
529 return false;
530 }
531 std::string x64_crt_path =
532 base::WideToUTF8(module_path.DirName().Append(L"x64").value());
533 if (!env->GetVar(kPath, &old_path))
534 env->SetVar(kPath, x64_crt_path);
535 if (old_path.find(x64_crt_path) == std::string::npos) {
cpu_(ooo_6.6-7.5) 2014/02/25 21:29:34 if --> else if ?
scottmg 2014/02/25 21:36:35 Done.
536 std::string new_path(old_path);
537 new_path.append(";");
538 new_path.append(x64_crt_path);
539 env->SetVar(kPath, new_path);
540 }
541 #endif // _DLL
515 } 542 }
516 #endif 543 #endif
517 544
518 scoped_ptr<CommandLine> cmd_line(new CommandLine(exe_path)); 545 scoped_ptr<CommandLine> cmd_line(new CommandLine(exe_path));
519 CopyNaClCommandLineArguments(cmd_line.get()); 546 CopyNaClCommandLineArguments(cmd_line.get());
520 547
521 cmd_line->AppendSwitchASCII(switches::kProcessType, 548 cmd_line->AppendSwitchASCII(switches::kProcessType,
522 switches::kNaClLoaderProcess); 549 switches::kNaClLoaderProcess);
523 cmd_line->AppendSwitchASCII(switches::kProcessChannelID, channel_id); 550 cmd_line->AppendSwitchASCII(switches::kProcessChannelID, channel_id);
524 if (NaClBrowser::GetDelegate()->DialogsAreSuppressed()) 551 if (NaClBrowser::GetDelegate()->DialogsAreSuppressed())
(...skipping 480 matching lines...) Expand 10 before | Expand all | Expand 10 after
1005 process_handle.Take(), info, 1032 process_handle.Take(), info,
1006 base::MessageLoopProxy::current(), 1033 base::MessageLoopProxy::current(),
1007 base::Bind(&NaClProcessHost::OnDebugExceptionHandlerLaunchedByBroker, 1034 base::Bind(&NaClProcessHost::OnDebugExceptionHandlerLaunchedByBroker,
1008 weak_factory_.GetWeakPtr())); 1035 weak_factory_.GetWeakPtr()));
1009 return true; 1036 return true;
1010 } 1037 }
1011 } 1038 }
1012 #endif 1039 #endif
1013 1040
1014 } // namespace nacl 1041 } // namespace nacl
OLDNEW
« no previous file with comments | « build/gyp_chromium ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698