Chromium Code Reviews| Index: chrome/app/chrome_crash_reporter_client_win.cc |
| diff --git a/chrome/app/chrome_crash_reporter_client_win.cc b/chrome/app/chrome_crash_reporter_client_win.cc |
| index 139a0ed4f3ee7970d9c2127b95a799a9ba6411be..99c3394842f411c45deb05df7a61708b3f9fe07a 100644 |
| --- a/chrome/app/chrome_crash_reporter_client_win.cc |
| +++ b/chrome/app/chrome_crash_reporter_client_win.cc |
| @@ -261,9 +261,27 @@ void ChromeCrashReporterClient::GetProductNameAndVersion( |
| assert(version); |
| assert(special_build); |
| assert(channel_name); |
| + DCHECK(!exe_path.empty()); // The empty string is not a valid path. |
| - install_static::GetExecutableVersionDetails( |
| - exe_path, product_name, version, special_build, channel_name); |
| + // Defend against unexpected use of function with varying |exe_path|. |
| + if (!exe_path_.empty()) { |
| + DCHECK_EQ(exe_path_, exe_path); |
| + 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
|
| + exe_path_.clear(); // Clear the cache. |
| + } |
| + |
| + // Populate the cache. |
| + if (exe_path_.empty()) { |
| + exe_path_ = exe_path; |
| + install_static::GetExecutableVersionDetails( |
| + exe_path_, &product_name_, &version_, &special_build_, &channel_name_); |
| + } |
| + |
| + // Serve from the cache. |
| + *product_name = product_name_; |
| + *version = version_; |
| + *special_build = special_build_; |
| + *channel_name = channel_name_; |
| } |
| bool ChromeCrashReporterClient::ShouldShowRestartDialog(base::string16* title, |