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

Side by Side Diff: chrome_frame/crash_reporting/crash_metrics.cc

Issue 8344004: base/win: Add documentation to RegKey::Read/Write functions. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix indentation Created 9 years, 2 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
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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_frame/crash_reporting/crash_metrics.h" 5 #include "chrome_frame/crash_reporting/crash_metrics.h"
6 6
7 #include "base/metrics/histogram.h" 7 #include "base/metrics/histogram.h"
8 #include "base/win/registry.h" 8 #include "base/win/registry.h"
9 #include "chrome_frame/utils.h" 9 #include "chrome_frame/utils.h"
10 10
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 return false; 47 return false;
48 } 48 }
49 49
50 int CrashMetricsReporter::GetMetric(Metric metric) { 50 int CrashMetricsReporter::GetMetric(Metric metric) {
51 DCHECK(metric >= NAVIGATION_COUNT && metric <= LAST_METRIC); 51 DCHECK(metric >= NAVIGATION_COUNT && metric <= LAST_METRIC);
52 52
53 int ret = 0; 53 int ret = 0;
54 base::win::RegKey metric_key; 54 base::win::RegKey metric_key;
55 if (metric_key.Open(HKEY_CURRENT_USER, kChromeFrameMetricsKey, 55 if (metric_key.Open(HKEY_CURRENT_USER, kChromeFrameMetricsKey,
56 KEY_QUERY_VALUE) == ERROR_SUCCESS) { 56 KEY_QUERY_VALUE) == ERROR_SUCCESS) {
57 metric_key.ReadValueDW(g_metric_names[metric], 57 metric_key.ReadValue(g_metric_names[metric],
58 reinterpret_cast<DWORD*>(&ret)); 58 reinterpret_cast<DWORD*>(&ret));
59 } 59 }
60 60
61 return ret; 61 return ret;
62 } 62 }
63 63
64 int CrashMetricsReporter::IncrementMetric(Metric metric) { 64 int CrashMetricsReporter::IncrementMetric(Metric metric) {
65 DCHECK(metric >= NAVIGATION_COUNT && metric <= LAST_METRIC); 65 DCHECK(metric >= NAVIGATION_COUNT && metric <= LAST_METRIC);
66 int metric_value = GetMetric(metric); 66 int metric_value = GetMetric(metric);
67 metric_value++; 67 metric_value++;
68 SetMetric(metric, metric_value); 68 SetMetric(metric, metric_value);
(...skipping 19 matching lines...) Expand all
88 UMA_HISTOGRAM_COUNTS("ChromeFrame.HostCrashCount", crash_count); 88 UMA_HISTOGRAM_COUNTS("ChromeFrame.HostCrashCount", crash_count);
89 SetMetric(CRASH_COUNT, 0); 89 SetMetric(CRASH_COUNT, 0);
90 } 90 }
91 91
92 int channel_error_count = GetMetric(CHANNEL_ERROR_COUNT); 92 int channel_error_count = GetMetric(CHANNEL_ERROR_COUNT);
93 if (channel_error_count > 0) { 93 if (channel_error_count > 0) {
94 UMA_HISTOGRAM_COUNTS("ChromeFrame.ChannelErrorCount", channel_error_count); 94 UMA_HISTOGRAM_COUNTS("ChromeFrame.ChannelErrorCount", channel_error_count);
95 SetMetric(CHANNEL_ERROR_COUNT, 0); 95 SetMetric(CHANNEL_ERROR_COUNT, 0);
96 } 96 }
97 } 97 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698