summaryrefslogtreecommitdiffstats
path: root/net/base/net_errors.cc
diff options
context:
space:
mode:
Diffstat (limited to 'net/base/net_errors.cc')
-rw-r--r--net/base/net_errors.cc20
1 files changed, 19 insertions, 1 deletions
diff --git a/net/base/net_errors.cc b/net/base/net_errors.cc
index 6c0e09c..623c071 100644
--- a/net/base/net_errors.cc
+++ b/net/base/net_errors.cc
@@ -1,12 +1,25 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "net/base/net_errors.h"
#include "base/basictypes.h"
+#include "base/metrics/histogram.h"
#include "base/stringize_macros.h"
+namespace {
+
+// Get all valid error codes into an array as positive numbers, for use in the
+// |GetAllErrorCodesForUma| function below.
+#define NET_ERROR(label, value) -(value),
+const int kAllErrorCodes[] = {
+#include "net/base/net_error_list.h"
+};
+#undef NET_ERROR
+
+} // namespace
+
namespace net {
const char kErrorDomain[] = "net";
@@ -26,4 +39,9 @@ const char* ErrorToString(int error) {
}
}
+std::vector<int> GetAllErrorCodesForUma() {
+ return base::CustomHistogram::ArrayToCustomRanges(
+ kAllErrorCodes, arraysize(kAllErrorCodes));
+}
+
} // namespace net