Description:
Add support for starting NaCl win64 process if nacl64.exe is in the version
directory.
We now assume that nacl64.exe is in the same directory as chrome.dll (and
not as
chrome.exe as we assumed before).
BUG=28176
TEST=none
Please review this at http://codereview.chromium.org/668130
SVN Base: svn://chrome-svn/chrome/trunk/src/
Affected files:
M chrome/browser/nacl_host/nacl_broker_host.cc
Index: chrome/browser/nacl_host/nacl_broker_host.cc
===================================================================
--- chrome/browser/nacl_host/nacl_broker_host.cc (revision 40698)
+++ chrome/browser/nacl_host/nacl_broker_host.cc (working copy)
@@ -4,6 +4,8 @@
#include "chrome/browser/nacl_host/nacl_broker_host.h"
+#include "shlwapi.h"
+
#include "base/command_line.h"
#include "ipc/ipc_switches.h"
#include "chrome/browser/browser_process.h"
@@ -13,6 +15,7 @@
#include "chrome/common/chrome_switches.h"
#include "chrome/common/nacl_cmd_line.h"
#include "chrome/common/nacl_messages.h"
+#include "chrome/installer/util/util_constants.h"
NaClBrokerHost::NaClBrokerHost(
ResourceDispatcherHost* resource_dispatcher_host)
@@ -33,13 +36,21 @@
if (!CreateChannel())
return false;
- // Create the path to the nacl broker/loader executable.
- FilePath exe_path = GetChildPath(false);
- if (exe_path.empty())
+ TCHAR path[MAX_PATH];
+ HMODULE chrome_dll_handle = GetModuleHandle(installer_util::kChromeDll);
+ if (chrome_dll_handle == NULL)
return false;
- FilePath nacl_path = exe_path.DirName().Append(chrome::kNaClAppName);
- CommandLine* cmd_line = new CommandLine(nacl_path);
+ DWORD res = GetModuleFileName(chrome_dll_handle, path, MAX_PATH);
+ if (0 == res)
+ return false;
+
+ if (!PathRemoveFileSpec(path) || !PathAppend(path, chrome::kNaClAppName))
+ return false;
+
+ CommandLine* cmd_line = new CommandLine(CommandLine::ARGUMENTS_ONLY);
+ cmd_line->ParseFromString(path);
+
nacl::CopyNaClCommandLineArguments(cmd_line);
cmd_line->AppendSwitchWithValue(switches::kProcessType,
http://codereview.chromium.org/668130/diff/5/6#newcode53
chrome/browser/nacl_host/nacl_broker_host.cc:53:
looks like this code is called in chrome.dll? you can use
PathService::Get(base::FILE_MODULE, &module_path)
> http://codereview.chromium.org/668130/diff/5/6#newcode53
> chrome/browser/nacl_host/nacl_broker_host.cc:53:
> looks like this code is called in chrome.dll? you can use
> PathService::Get(base::FILE_MODULE, &module_path)
Done. Thanks for the tip.