Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 // TODO(ananta/scottmg) | 5 // TODO(ananta/scottmg) |
| 6 // Add test coverage for Crashpad. | 6 // Add test coverage for Crashpad. |
| 7 #include "chrome/app/chrome_crash_reporter_client_win.h" | 7 #include "chrome/app/chrome_crash_reporter_client_win.h" |
| 8 | 8 |
| 9 #include <assert.h> | 9 #include <assert.h> |
| 10 #include <windows.h> | 10 #include <windows.h> |
| (...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 254 void ChromeCrashReporterClient::GetProductNameAndVersion( | 254 void ChromeCrashReporterClient::GetProductNameAndVersion( |
| 255 const base::string16& exe_path, | 255 const base::string16& exe_path, |
| 256 base::string16* product_name, | 256 base::string16* product_name, |
| 257 base::string16* version, | 257 base::string16* version, |
| 258 base::string16* special_build, | 258 base::string16* special_build, |
| 259 base::string16* channel_name) { | 259 base::string16* channel_name) { |
| 260 assert(product_name); | 260 assert(product_name); |
| 261 assert(version); | 261 assert(version); |
| 262 assert(special_build); | 262 assert(special_build); |
| 263 assert(channel_name); | 263 assert(channel_name); |
| 264 DCHECK(!exe_path.empty()); // The empty string is not a valid path. | |
| 264 | 265 |
| 265 install_static::GetExecutableVersionDetails( | 266 // Defend against unexpected use of function with varying |exe_path|. |
| 266 exe_path, product_name, version, special_build, channel_name); | 267 if (!exe_path_.empty()) { |
| 268 DCHECK_EQ(exe_path_, exe_path); | |
| 269 if (exe_path_ != exe_path) | |
|
grt (UTC plus 2)
2016/09/26 18:59:06
don't DCHECK and then handle the DCHECKed case as
manzagop (departed)
2016/09/27 19:37:52
Thanks for the pointer!
Due to the changes, comme
| |
| 270 exe_path_.clear(); // Clear the cache. | |
| 271 } | |
| 272 | |
| 273 // Populate the cache. | |
| 274 if (exe_path_.empty()) { | |
| 275 exe_path_ = exe_path; | |
| 276 install_static::GetExecutableVersionDetails( | |
| 277 exe_path_, &product_name_, &version_, &special_build_, &channel_name_); | |
| 278 } | |
| 279 | |
| 280 // Serve from the cache. | |
| 281 *product_name = product_name_; | |
| 282 *version = version_; | |
| 283 *special_build = special_build_; | |
| 284 *channel_name = channel_name_; | |
| 267 } | 285 } |
| 268 | 286 |
| 269 bool ChromeCrashReporterClient::ShouldShowRestartDialog(base::string16* title, | 287 bool ChromeCrashReporterClient::ShouldShowRestartDialog(base::string16* title, |
| 270 base::string16* message, | 288 base::string16* message, |
| 271 bool* is_rtl_locale) { | 289 bool* is_rtl_locale) { |
| 272 if (!install_static::HasEnvironmentVariable16( | 290 if (!install_static::HasEnvironmentVariable16( |
| 273 install_static::kShowRestart) || | 291 install_static::kShowRestart) || |
| 274 !install_static::HasEnvironmentVariable16( | 292 !install_static::HasEnvironmentVariable16( |
| 275 install_static::kRestartInfo)) { | 293 install_static::kRestartInfo)) { |
| 276 return false; | 294 return false; |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 381 bool ChromeCrashReporterClient::GetCollectStatsInSample() { | 399 bool ChromeCrashReporterClient::GetCollectStatsInSample() { |
| 382 return install_static::GetCollectStatsInSample(); | 400 return install_static::GetCollectStatsInSample(); |
| 383 } | 401 } |
| 384 | 402 |
| 385 bool ChromeCrashReporterClient::EnableBreakpadForProcess( | 403 bool ChromeCrashReporterClient::EnableBreakpadForProcess( |
| 386 const std::string& process_type) { | 404 const std::string& process_type) { |
| 387 return process_type == install_static::kRendererProcess || | 405 return process_type == install_static::kRendererProcess || |
| 388 process_type == install_static::kPpapiPluginProcess || | 406 process_type == install_static::kPpapiPluginProcess || |
| 389 process_type == install_static::kGpuProcess; | 407 process_type == install_static::kGpuProcess; |
| 390 } | 408 } |
| OLD | NEW |