summaryrefslogtreecommitdiffstats
path: root/chrome/browser/metrics
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/browser/metrics')
-rw-r--r--chrome/browser/metrics/metrics_log.cc11
-rw-r--r--chrome/browser/metrics/metrics_log.h8
2 files changed, 16 insertions, 3 deletions
diff --git a/chrome/browser/metrics/metrics_log.cc b/chrome/browser/metrics/metrics_log.cc
index a55fc4a..46a197c 100644
--- a/chrome/browser/metrics/metrics_log.cc
+++ b/chrome/browser/metrics/metrics_log.cc
@@ -29,6 +29,9 @@ using base::TimeDelta;
extern "C" IMAGE_DOS_HEADER __ImageBase;
#endif
+// static
+std::string MetricsLog::version_extension_;
+
// libxml take xmlChar*, which is unsigned char*
inline const unsigned char* UnsignedChar(const char* input) {
return reinterpret_cast<const unsigned char*>(input);
@@ -76,10 +79,10 @@ void MetricsLog::CloseLog() {
locked_ = true;
int result = xmlTextWriterEndDocument(writer_);
- DCHECK(result >= 0);
+ DCHECK_GE(result, 0);
result = xmlTextWriterFlush(writer_);
- DCHECK(result >= 0);
+ DCHECK_GE(result, 0);
}
int MetricsLog::GetEncodedLogSize() {
@@ -297,6 +300,8 @@ std::string MetricsLog::GetVersionString() {
FileVersionInfo::CreateFileVersionInfoForCurrentModule());
if (version_info.get()) {
std::string version = WideToUTF8(version_info->product_version());
+ if (!version_extension_.empty())
+ version += version_extension_;
if (!version_info->is_official_build())
version.append("-devel");
return version;
@@ -683,7 +688,7 @@ void MetricsLog::RecordOmniboxOpenedURL(const AutocompleteLog& log) {
void MetricsLog::RecordHistogramDelta(const Histogram& histogram,
const Histogram::SampleSet& snapshot) {
DCHECK(!locked_);
- DCHECK(0 != snapshot.TotalCount());
+ DCHECK_NE(0, snapshot.TotalCount());
snapshot.CheckSize(histogram);
// We will ignore the MAX_INT/infinite value in the last element of range[].
diff --git a/chrome/browser/metrics/metrics_log.h b/chrome/browser/metrics/metrics_log.h
index bcdd4f5..c8e7691 100644
--- a/chrome/browser/metrics/metrics_log.h
+++ b/chrome/browser/metrics/metrics_log.h
@@ -106,6 +106,11 @@ class MetricsLog {
// Get the current version of the application as a string.
static std::string GetVersionString();
+ // Use |extension| in all uploaded appversions in addition to the standard
+ // version string.
+ static void set_version_extension(const std::string& extension) {
+ version_extension_ = extension;
+ }
protected:
// Returns a string containing the current time.
// Virtual so that it can be overridden for testing.
@@ -184,6 +189,9 @@ class MetricsLog {
void WriteProfileMetrics(const std::wstring& key,
const DictionaryValue& profile_metrics);
+ // An extension that is appended to the appversion in each log.
+ static std::string version_extension_;
+
base::Time start_time_;
base::Time end_time_;