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

Side by Side Diff: chrome/app/client_util.cc

Issue 2833023: Fix nacl build (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 10 years, 6 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) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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 <windows.h> 5 #include <windows.h>
6 #include <shlwapi.h> 6 #include <shlwapi.h>
7 7
8 #include "chrome/app/breakpad_win.h" 8 #include "chrome/app/breakpad_win.h"
9 #include "chrome/app/client_util.h" 9 #include "chrome/app/client_util.h"
10 #include "chrome/common/chrome_switches.h" 10 #include "chrome/common/chrome_switches.h"
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 83
84 bool IsRunningHeadless() { 84 bool IsRunningHeadless() {
85 return (0 != ::GetEnvironmentVariableW(L"CHROME_HEADLESS", NULL, 0)); 85 return (0 != ::GetEnvironmentVariableW(L"CHROME_HEADLESS", NULL, 0));
86 } 86 }
87 87
88 // Expects that |dir| has a trailing backslash. |dir| is modified so it 88 // Expects that |dir| has a trailing backslash. |dir| is modified so it
89 // contains the full path that was tried. Caller must check for the return 89 // contains the full path that was tried. Caller must check for the return
90 // value not being null to dermine if this path contains a valid dll. 90 // value not being null to dermine if this path contains a valid dll.
91 HMODULE LoadChromeWithDirectory(std::wstring* dir) { 91 HMODULE LoadChromeWithDirectory(std::wstring* dir) {
92 ::SetCurrentDirectoryW(dir->c_str()); 92 ::SetCurrentDirectoryW(dir->c_str());
93 const CommandLine& cmd_line = *CommandLine::ForCurrentProcess();
93 #ifdef _WIN64 94 #ifdef _WIN64
94 const CommandLine& cmd_line = *CommandLine::ForCurrentProcess();
95 if ((cmd_line.GetSwitchValueASCII(switches::kProcessType) == 95 if ((cmd_line.GetSwitchValueASCII(switches::kProcessType) ==
96 switches::kNaClBrokerProcess) || 96 switches::kNaClBrokerProcess) ||
97 (cmd_line.GetSwitchValueASCII(switches::kProcessType) == 97 (cmd_line.GetSwitchValueASCII(switches::kProcessType) ==
98 switches::kNaClLoaderProcess)) { 98 switches::kNaClLoaderProcess)) {
99 // Load the 64-bit DLL when running in a 64-bit process. 99 // Load the 64-bit DLL when running in a 64-bit process.
100 dir->append(installer_util::kChromeNaCl64Dll); 100 dir->append(installer_util::kChromeNaCl64Dll);
101 } else { 101 } else {
102 // Only NaCl broker and loader can be launched as Win64 processes. 102 // Only NaCl broker and loader can be launched as Win64 processes.
103 NOTREACHED(); 103 NOTREACHED();
104 return NULL; 104 return NULL;
105 } 105 }
106 #else 106 #else
107 dir->append(installer_util::kChromeDll); 107 dir->append(installer_util::kChromeDll);
108 #endif 108 #endif
109 109
110 // Experimental pre-reading optimization 110 // Experimental pre-reading optimization
111 // The idea is to pre read significant portion of chrome.dll in advance 111 // The idea is to pre read significant portion of chrome.dll in advance
112 // so that subsequent hard page faults are avoided. 112 // so that subsequent hard page faults are avoided.
113 DWORD pre_read_size_mb = 0; 113 DWORD pre_read_size_mb = 0;
114 const CommandLine& cmd_line = *CommandLine::ForCurrentProcess();
115 if (!cmd_line.HasSwitch(switches::kProcessType) && 114 if (!cmd_line.HasSwitch(switches::kProcessType) &&
116 (IsRunningHeadless() || InstallUtil::IsChromeFrameProcess())) { 115 (IsRunningHeadless() || InstallUtil::IsChromeFrameProcess())) {
117 HKEY key = NULL; 116 HKEY key = NULL;
118 if (::RegOpenKeyEx(HKEY_CURRENT_USER, L"Software\\Google\\ChromeFrame", 117 if (::RegOpenKeyEx(HKEY_CURRENT_USER, L"Software\\Google\\ChromeFrame",
119 0, KEY_QUERY_VALUE, &key) == ERROR_SUCCESS) { 118 0, KEY_QUERY_VALUE, &key) == ERROR_SUCCESS) {
120 DWORD unused = sizeof(pre_read_size_mb); 119 DWORD unused = sizeof(pre_read_size_mb);
121 RegQueryValueEx(key, L"PreRead", NULL, NULL, 120 RegQueryValueEx(key, L"PreRead", NULL, NULL,
122 reinterpret_cast<LPBYTE>(&pre_read_size_mb), &unused); 121 reinterpret_cast<LPBYTE>(&pre_read_size_mb), &unused);
123 RegCloseKey(key); 122 RegCloseKey(key);
124 key = NULL; 123 key = NULL;
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
309 } 308 }
310 }; 309 };
311 310
312 MainDllLoader* MakeMainDllLoader() { 311 MainDllLoader* MakeMainDllLoader() {
313 #if defined(GOOGLE_CHROME_BUILD) 312 #if defined(GOOGLE_CHROME_BUILD)
314 return new ChromeDllLoader(); 313 return new ChromeDllLoader();
315 #else 314 #else
316 return new ChromiumDllLoader(); 315 return new ChromiumDllLoader();
317 #endif 316 #endif
318 } 317 }
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