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 //------------------------------------------------------------------------------ | 5 //------------------------------------------------------------------------------ |
| 6 // Description of the life cycle of a instance of MetricsService. | 6 // Description of the life cycle of a instance of MetricsService. |
| 7 // | 7 // |
| 8 // OVERVIEW | 8 // OVERVIEW |
| 9 // | 9 // |
| 10 // A MetricsService instance is typically created at application startup. It is | 10 // A MetricsService instance is typically created at application startup. It is |
| (...skipping 779 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 790 | 790 |
| 791 void MetricsService::RecordBreakpadHasDebugger(bool has_debugger) { | 791 void MetricsService::RecordBreakpadHasDebugger(bool has_debugger) { |
| 792 if (!has_debugger) | 792 if (!has_debugger) |
| 793 IncrementPrefValue(prefs::kStabilityDebuggerNotPresent); | 793 IncrementPrefValue(prefs::kStabilityDebuggerNotPresent); |
| 794 else | 794 else |
| 795 IncrementPrefValue(prefs::kStabilityDebuggerPresent); | 795 IncrementPrefValue(prefs::kStabilityDebuggerPresent); |
| 796 } | 796 } |
| 797 | 797 |
| 798 #if defined(OS_WIN) | 798 #if defined(OS_WIN) |
| 799 void MetricsService::CountBrowserCrashDumpAttempts() { | 799 void MetricsService::CountBrowserCrashDumpAttempts() { |
| 800 base::string16 key_str(chrome::kBrowserCrashDumpAttemptsRegistryPath); | |
| 801 key_str += L"\\"; | |
| 802 key_str += UTF8ToWide(chrome::kChromeVersion); | |
| 803 | |
| 804 base::win::RegKey regkey; | 800 base::win::RegKey regkey; |
| 805 if (regkey.Open(HKEY_CURRENT_USER, | 801 if (regkey.Open(HKEY_CURRENT_USER, |
| 806 key_str.c_str(), | 802 chrome::kBrowserCrashDumpAttemptsRegistryPath, |
| 807 KEY_ALL_ACCESS) != ERROR_SUCCESS) { | 803 KEY_ALL_ACCESS) != ERROR_SUCCESS) { |
| 808 return; | 804 return; |
| 809 } | 805 } |
| 810 | 806 |
| 807 base::string16 chrome_version(base::ASCIIToUTF16(chrome::kChromeVersion)); | |
| 808 | |
| 811 base::string16 temp_name; | 809 base::string16 temp_name; |
| 812 DWORD temp_value = 0; | 810 DWORD temp_value = 0; |
| 813 int crash_dump_attempts = 0; | 811 int crash_dump_attempts = 0; |
| 814 for (int i = regkey.GetValueCount() - 1; i >= 0; --i) { | 812 for (int i = regkey.GetValueCount() - 1; i >= 0; --i) { |
| 815 if (regkey.GetValueNameAt(i, &temp_name) == ERROR_SUCCESS && | 813 if (regkey.GetValueNameAt(i, &temp_name) == ERROR_SUCCESS && |
|
grt (UTC plus 2)
2013/09/06 15:53:23
i don't think that this will work the way you hope
Roger McFarlane (Chromium)
2013/09/10 19:43:44
I've done as you suggest per the walkthrough and d
| |
| 814 StartsWith(temp_name, chrome_version, false) && | |
|
grt (UTC plus 2)
2013/09/06 15:53:23
how about also deleting the values for older versi
Roger McFarlane (Chromium)
2013/09/10 19:43:44
Hmm...
That would be wonky in multi-install, whic
| |
| 816 regkey.ReadValueDW(temp_name.c_str(), &temp_value) == ERROR_SUCCESS) { | 815 regkey.ReadValueDW(temp_name.c_str(), &temp_value) == ERROR_SUCCESS) { |
| 817 regkey.DeleteValue(temp_name.c_str()); | 816 regkey.DeleteValue(temp_name.c_str()); |
| 818 if (temp_value != 0) | 817 crash_dump_attempts += temp_value; |
| 819 ++crash_dump_attempts; | |
| 820 } | 818 } |
| 821 } | 819 } |
| 822 UMA_HISTOGRAM_COUNTS("Chrome.BrowserCrashDumpAttempts", crash_dump_attempts); | 820 UMA_HISTOGRAM_COUNTS("Chrome.BrowserCrashDumpAttempts", crash_dump_attempts); |
| 823 } | 821 } |
| 824 #endif // defined(OS_WIN) | 822 #endif // defined(OS_WIN) |
| 825 | 823 |
| 826 //------------------------------------------------------------------------------ | 824 //------------------------------------------------------------------------------ |
| 827 // private methods | 825 // private methods |
| 828 //------------------------------------------------------------------------------ | 826 //------------------------------------------------------------------------------ |
| 829 | 827 |
| (...skipping 949 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1779 if (local_state) { | 1777 if (local_state) { |
| 1780 const PrefService::Preference* uma_pref = | 1778 const PrefService::Preference* uma_pref = |
| 1781 local_state->FindPreference(prefs::kMetricsReportingEnabled); | 1779 local_state->FindPreference(prefs::kMetricsReportingEnabled); |
| 1782 if (uma_pref) { | 1780 if (uma_pref) { |
| 1783 bool success = uma_pref->GetValue()->GetAsBoolean(&result); | 1781 bool success = uma_pref->GetValue()->GetAsBoolean(&result); |
| 1784 DCHECK(success); | 1782 DCHECK(success); |
| 1785 } | 1783 } |
| 1786 } | 1784 } |
| 1787 return result; | 1785 return result; |
| 1788 } | 1786 } |
| OLD | NEW |