Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 "chrome/app/main_dll_loader_win.h" | 5 #include "chrome/app/main_dll_loader_win.h" |
| 6 | 6 |
| 7 #include <windows.h> // NOLINT | 7 #include <windows.h> // NOLINT |
| 8 #include <shlwapi.h> // NOLINT | 8 #include <shlwapi.h> // NOLINT |
| 9 #include <stddef.h> | 9 #include <stddef.h> |
| 10 #include <userenv.h> // NOLINT | 10 #include <userenv.h> // NOLINT |
| (...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 196 int OnBeforeExit(int return_code, const base::FilePath& dll_path) override; | 196 int OnBeforeExit(int return_code, const base::FilePath& dll_path) override; |
| 197 | 197 |
| 198 private: | 198 private: |
| 199 std::unique_ptr<ChromeWatcherClient> chrome_watcher_client_; | 199 std::unique_ptr<ChromeWatcherClient> chrome_watcher_client_; |
| 200 }; | 200 }; |
| 201 | 201 |
| 202 void ChromeDllLoader::OnBeforeLaunch(const std::string& process_type, | 202 void ChromeDllLoader::OnBeforeLaunch(const std::string& process_type, |
| 203 const base::FilePath& dll_path) { | 203 const base::FilePath& dll_path) { |
| 204 if (process_type.empty()) { | 204 if (process_type.empty()) { |
| 205 RecordDidRun(dll_path); | 205 RecordDidRun(dll_path); |
| 206 | |
| 207 // Get the function that determines whether uploads are enabled. | |
| 208 typedef bool (*GetUploadsEnabledFunction)(void); | |
| 209 static GetUploadsEnabledFunction get_uploads_enabled = nullptr; | |
|
Sigurður Ásgeirsson
2016/09/01 15:30:36
You may want to check this with chrome-metrics fol
Alexei Svitkine (slow)
2016/09/01 15:40:26
Agreed. If you're just doing this to "save extra w
manzagop (departed)
2016/09/01 16:02:49
Done.
| |
| 210 if (!get_uploads_enabled) { | |
| 211 get_uploads_enabled = | |
| 212 reinterpret_cast<GetUploadsEnabledFunction>(GetProcAddress( | |
| 213 GetModuleHandle(chrome::kChromeElfDllName), "GetUploadsEnabled")); | |
| 214 CHECK(get_uploads_enabled); | |
| 215 } | |
| 216 | |
| 217 // Launch the watcher process if stats collection consent has been granted. | |
| 218 if (get_uploads_enabled()) { | |
| 219 base::FilePath exe_path; | |
| 220 if (PathService::Get(base::FILE_EXE, &exe_path)) { | |
| 221 chrome_watcher_client_.reset(new ChromeWatcherClient( | |
| 222 base::Bind(&GenerateChromeWatcherCommandLine, exe_path))); | |
| 223 chrome_watcher_client_->LaunchWatcher(); | |
| 224 } | |
| 225 } | |
| 206 } else { | 226 } else { |
| 207 // Set non-browser processes up to be killed by the system after the browser | 227 // Set non-browser processes up to be killed by the system after the browser |
| 208 // goes away. The browser uses the default shutdown order, which is 0x280. | 228 // goes away. The browser uses the default shutdown order, which is 0x280. |
| 209 // Note that lower numbers here denote "kill later" and higher numbers mean | 229 // Note that lower numbers here denote "kill later" and higher numbers mean |
| 210 // "kill sooner". | 230 // "kill sooner". |
| 211 // This gets rid of most of those unsighly sad tabs on logout and shutdown. | 231 // This gets rid of most of those unsighly sad tabs on logout and shutdown. |
| 212 ::SetProcessShutdownParameters(0x280 - 1, SHUTDOWN_NORETRY); | 232 ::SetProcessShutdownParameters(0x280 - 1, SHUTDOWN_NORETRY); |
| 213 } | 233 } |
| 214 } | 234 } |
| 215 | 235 |
| (...skipping 22 matching lines...) Expand all Loading... | |
| 238 } | 258 } |
| 239 }; | 259 }; |
| 240 | 260 |
| 241 MainDllLoader* MakeMainDllLoader() { | 261 MainDllLoader* MakeMainDllLoader() { |
| 242 #if defined(GOOGLE_CHROME_BUILD) | 262 #if defined(GOOGLE_CHROME_BUILD) |
| 243 return new ChromeDllLoader(); | 263 return new ChromeDllLoader(); |
| 244 #else | 264 #else |
| 245 return new ChromiumDllLoader(); | 265 return new ChromiumDllLoader(); |
| 246 #endif | 266 #endif |
| 247 } | 267 } |
| OLD | NEW |