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

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

Issue 19572013: reland of http://crrev.com/212230 Create top-level separate targets for... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix delegate dispatch and test gyp deps Created 7 years, 5 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 | « chrome/app/chrome_main_delegate.cc ('k') | chrome/chrome.gyp » ('j') | 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 <windows.h> 5 #include <windows.h>
6 #include <shlwapi.h> 6 #include <shlwapi.h>
7 7
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/debug/trace_event.h" 9 #include "base/debug/trace_event.h"
10 #include "base/environment.h" 10 #include "base/environment.h"
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 void RecordDidRun(const string16& dll_path) { 67 void RecordDidRun(const string16& dll_path) {
68 bool system_level = !InstallUtil::IsPerUserInstall(dll_path.c_str()); 68 bool system_level = !InstallUtil::IsPerUserInstall(dll_path.c_str());
69 GoogleUpdateSettings::UpdateDidRunState(true, system_level); 69 GoogleUpdateSettings::UpdateDidRunState(true, system_level);
70 } 70 }
71 71
72 void ClearDidRun(const string16& dll_path) { 72 void ClearDidRun(const string16& dll_path) {
73 bool system_level = !InstallUtil::IsPerUserInstall(dll_path.c_str()); 73 bool system_level = !InstallUtil::IsPerUserInstall(dll_path.c_str());
74 GoogleUpdateSettings::UpdateDidRunState(false, system_level); 74 GoogleUpdateSettings::UpdateDidRunState(false, system_level);
75 } 75 }
76 76
77 #if defined(CHROME_SPLIT_DLL)
78 // Deferred initialization entry point for chrome1.dll.
79 typedef BOOL (__stdcall *DoDeferredCrtInitFunc)(HINSTANCE hinstance);
80
81 bool InitSplitChromeDll(HMODULE mod) {
82 if (!mod)
83 return false;
84 DoDeferredCrtInitFunc init = reinterpret_cast<DoDeferredCrtInitFunc>(
85 ::GetProcAddress(mod, "_DoDeferredCrtInit@4"));
86 return (init(mod) == TRUE);
87 }
88 #endif
89 } // namespace 77 } // namespace
90 78
91 string16 GetExecutablePath() { 79 string16 GetExecutablePath() {
92 wchar_t path[MAX_PATH]; 80 wchar_t path[MAX_PATH];
93 ::GetModuleFileNameW(NULL, path, MAX_PATH); 81 ::GetModuleFileNameW(NULL, path, MAX_PATH);
94 if (!::PathRemoveFileSpecW(path)) 82 if (!::PathRemoveFileSpecW(path))
95 return string16(); 83 return string16();
96 string16 exe_path(path); 84 string16 exe_path(path);
97 return exe_path.append(1, L'\\'); 85 return exe_path.append(1, L'\\');
98 } 86 }
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 out_file->append(*out_version).append(1, L'\\'); 147 out_file->append(*out_version).append(1, L'\\');
160 dll = LoadChromeWithDirectory(out_file); 148 dll = LoadChromeWithDirectory(out_file);
161 if (!dll) { 149 if (!dll) {
162 PLOG(ERROR) << "Failed to load Chrome DLL from " << *out_file; 150 PLOG(ERROR) << "Failed to load Chrome DLL from " << *out_file;
163 return NULL; 151 return NULL;
164 } 152 }
165 } 153 }
166 154
167 DCHECK(dll); 155 DCHECK(dll);
168 156
169 #if defined(CHROME_SPLIT_DLL)
170 // In split dlls mode, we need to manually initialize both DLLs because
171 // the circular dependencies between them make the loader not call the
172 // Dllmain for DLL_PROCESS_ATTACH.
173 InitSplitChromeDll(dll);
174 InitSplitChromeDll(::GetModuleHandleA("chrome1.dll"));
175 #endif
176
177 return dll; 157 return dll;
178 } 158 }
179 159
180 // Launching is a matter of loading the right dll, setting the CHROME_VERSION 160 // Launching is a matter of loading the right dll, setting the CHROME_VERSION
181 // environment variable and just calling the entry point. Derived classes can 161 // environment variable and just calling the entry point. Derived classes can
182 // add custom code in the OnBeforeLaunch callback. 162 // add custom code in the OnBeforeLaunch callback.
183 int MainDllLoader::Launch(HINSTANCE instance, 163 int MainDllLoader::Launch(HINSTANCE instance,
184 sandbox::SandboxInterfaceInfo* sbox_info) { 164 sandbox::SandboxInterfaceInfo* sbox_info) {
185 string16 version; 165 string16 version;
186 string16 file; 166 string16 file;
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
256 } 236 }
257 }; 237 };
258 238
259 MainDllLoader* MakeMainDllLoader() { 239 MainDllLoader* MakeMainDllLoader() {
260 #if defined(GOOGLE_CHROME_BUILD) 240 #if defined(GOOGLE_CHROME_BUILD)
261 return new ChromeDllLoader(); 241 return new ChromeDllLoader();
262 #else 242 #else
263 return new ChromiumDllLoader(); 243 return new ChromiumDllLoader();
264 #endif 244 #endif
265 } 245 }
OLDNEW
« no previous file with comments | « chrome/app/chrome_main_delegate.cc ('k') | chrome/chrome.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698