Index: net/base/file_stream_metrics.cc |
diff --git a/net/base/file_stream_metrics.cc b/net/base/file_stream_metrics.cc |
index 7ffa96d66d6a6c1131f2a8aa5f1b325cfe0347ab..4dc0576325f3a312704d787ac85bfc80baa14986 100644 |
--- a/net/base/file_stream_metrics.cc |
+++ b/net/base/file_stream_metrics.cc |
@@ -1,9 +1,10 @@ |
-// Copyright (c) 2011 The Chromium Authors. All rights reserved. |
+// Copyright (c) 2012 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/file_stream_metrics.h" |
+#include "base/basictypes.h" |
#include "base/logging.h" |
#include "base/metrics/histogram.h" |
@@ -11,6 +12,20 @@ namespace net { |
namespace { |
+const char* FileErrorSourceStrings[] = { |
+ "OPEN", |
+ "WRITE", |
+ "READ", |
+ "SEEK", |
+ "FLUSH", |
+ "SET_EOF", |
+ "GET_SIZE" |
+}; |
+ |
+COMPILE_ASSERT(ARRAYSIZE_UNSAFE(FileErrorSourceStrings) == |
+ FILE_ERROR_SOURCE_COUNT, |
+ file_error_source_enum_has_changed); |
+ |
void RecordFileErrorTypeCount(FileErrorSource source) { |
UMA_HISTOGRAM_ENUMERATION( |
"Net.FileErrorType_Counts", source, FILE_ERROR_SOURCE_COUNT); |
@@ -78,4 +93,9 @@ void RecordFileError(int error, FileErrorSource source, bool record) { |
} |
} |
+const char* GetFileErrorSourceName(FileErrorSource source) { |
+ DCHECK_NE(FILE_ERROR_SOURCE_COUNT, source); |
+ return FileErrorSourceStrings[source]; |
+} |
+ |
} // namespace net |