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

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

Issue 19697015: Move dependency on env_vars.h to breakpad client (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: updates 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_exe_main_win.cc ('k') | components/breakpad/breakpad_client.h » ('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"
11 #include "base/file_version_info.h" 11 #include "base/file_version_info.h"
12 #include "base/lazy_instance.h"
13 #include "base/logging.h" 12 #include "base/logging.h"
14 #include "base/memory/scoped_ptr.h" 13 #include "base/memory/scoped_ptr.h"
15 #include "base/strings/string16.h" 14 #include "base/strings/string16.h"
16 #include "base/strings/string_util.h" 15 #include "base/strings/string_util.h"
17 #include "base/strings/stringprintf.h" 16 #include "base/strings/stringprintf.h"
18 #include "base/strings/utf_string_conversions.h" 17 #include "base/strings/utf_string_conversions.h"
19 #include "base/version.h" 18 #include "base/version.h"
20 #include "base/win/windows_version.h" 19 #include "base/win/windows_version.h"
21 #include "chrome/app/breakpad_win.h" 20 #include "chrome/app/breakpad_win.h"
22 #include "chrome/app/chrome_breakpad_client.h"
23 #include "chrome/app/client_util.h" 21 #include "chrome/app/client_util.h"
24 #include "chrome/app/image_pre_reader_win.h" 22 #include "chrome/app/image_pre_reader_win.h"
25 #include "chrome/common/chrome_constants.h" 23 #include "chrome/common/chrome_constants.h"
26 #include "chrome/common/chrome_result_codes.h" 24 #include "chrome/common/chrome_result_codes.h"
27 #include "chrome/common/chrome_switches.h" 25 #include "chrome/common/chrome_switches.h"
28 #include "chrome/common/env_vars.h" 26 #include "chrome/common/env_vars.h"
29 #include "chrome/installer/util/browser_distribution.h" 27 #include "chrome/installer/util/browser_distribution.h"
30 #include "chrome/installer/util/channel_info.h" 28 #include "chrome/installer/util/channel_info.h"
31 #include "chrome/installer/util/google_update_constants.h" 29 #include "chrome/installer/util/google_update_constants.h"
32 #include "chrome/installer/util/google_update_settings.h" 30 #include "chrome/installer/util/google_update_settings.h"
33 #include "chrome/installer/util/install_util.h" 31 #include "chrome/installer/util/install_util.h"
34 #include "chrome/installer/util/util_constants.h" 32 #include "chrome/installer/util/util_constants.h"
35 #include "components/breakpad/breakpad_client.h"
36 33
37 namespace { 34 namespace {
38 // The entry point signature of chrome.dll. 35 // The entry point signature of chrome.dll.
39 typedef int (*DLL_MAIN)(HINSTANCE, sandbox::SandboxInterfaceInfo*); 36 typedef int (*DLL_MAIN)(HINSTANCE, sandbox::SandboxInterfaceInfo*);
40 37
41 typedef void (*RelaunchChromeBrowserWithNewCommandLineIfNeededFunc)(); 38 typedef void (*RelaunchChromeBrowserWithNewCommandLineIfNeededFunc)();
42 39
43 base::LazyInstance<chrome::ChromeBreakpadClient>::Leaky
44 g_chrome_breakpad_client = LAZY_INSTANCE_INITIALIZER;
45
46 // Expects that |dir| has a trailing backslash. |dir| is modified so it 40 // Expects that |dir| has a trailing backslash. |dir| is modified so it
47 // contains the full path that was tried. Caller must check for the return 41 // contains the full path that was tried. Caller must check for the return
48 // value not being null to determine if this path contains a valid dll. 42 // value not being null to determine if this path contains a valid dll.
49 HMODULE LoadChromeWithDirectory(string16* dir) { 43 HMODULE LoadChromeWithDirectory(string16* dir) {
50 ::SetCurrentDirectoryW(dir->c_str()); 44 ::SetCurrentDirectoryW(dir->c_str());
51 dir->append(installer::kChromeDll); 45 dir->append(installer::kChromeDll);
52 46
53 #if !defined(WIN_DISABLE_PREREAD) 47 #if !defined(WIN_DISABLE_PREREAD)
54 // On Win7 with Syzygy, pre-read is a win. There've very little difference 48 // On Win7 with Syzygy, pre-read is a win. There've very little difference
55 // between 25% and 100%. For cold starts, with or without prefetch 25% 49 // between 25% and 100%. For cold starts, with or without prefetch 25%
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 dll_ = Load(&version, &file); 161 dll_ = Load(&version, &file);
168 if (!dll_) 162 if (!dll_)
169 return chrome::RESULT_CODE_MISSING_DATA; 163 return chrome::RESULT_CODE_MISSING_DATA;
170 164
171 scoped_ptr<base::Environment> env(base::Environment::Create()); 165 scoped_ptr<base::Environment> env(base::Environment::Create());
172 env->SetVar(chrome::kChromeVersionEnvVar, WideToUTF8(version)); 166 env->SetVar(chrome::kChromeVersionEnvVar, WideToUTF8(version));
173 // TODO(erikwright): Remove this when http://crbug.com/174953 is fixed and 167 // TODO(erikwright): Remove this when http://crbug.com/174953 is fixed and
174 // widely deployed. 168 // widely deployed.
175 env->UnSetVar(env_vars::kGoogleUpdateIsMachineEnvVar); 169 env->UnSetVar(env_vars::kGoogleUpdateIsMachineEnvVar);
176 170
177 breakpad::SetBreakpadClient(g_chrome_breakpad_client.Pointer());
178 InitCrashReporter(); 171 InitCrashReporter();
179 OnBeforeLaunch(file); 172 OnBeforeLaunch(file);
180 173
181 DLL_MAIN entry_point = 174 DLL_MAIN entry_point =
182 reinterpret_cast<DLL_MAIN>(::GetProcAddress(dll_, "ChromeMain")); 175 reinterpret_cast<DLL_MAIN>(::GetProcAddress(dll_, "ChromeMain"));
183 if (!entry_point) 176 if (!entry_point)
184 return chrome::RESULT_CODE_BAD_PROCESS_TYPE; 177 return chrome::RESULT_CODE_BAD_PROCESS_TYPE;
185 178
186 int rc = entry_point(instance, sbox_info); 179 int rc = entry_point(instance, sbox_info);
187 return OnBeforeExit(rc, file); 180 return OnBeforeExit(rc, file);
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
236 } 229 }
237 }; 230 };
238 231
239 MainDllLoader* MakeMainDllLoader() { 232 MainDllLoader* MakeMainDllLoader() {
240 #if defined(GOOGLE_CHROME_BUILD) 233 #if defined(GOOGLE_CHROME_BUILD)
241 return new ChromeDllLoader(); 234 return new ChromeDllLoader();
242 #else 235 #else
243 return new ChromiumDllLoader(); 236 return new ChromiumDllLoader();
244 #endif 237 #endif
245 } 238 }
OLDNEW
« no previous file with comments | « chrome/app/chrome_exe_main_win.cc ('k') | components/breakpad/breakpad_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698