summaryrefslogtreecommitdiffstats
path: root/chrome/browser/metrics
diff options
context:
space:
mode:
authorthakis@chromium.org <thakis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-11-16 00:12:42 +0000
committerthakis@chromium.org <thakis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-11-16 00:12:42 +0000
commit054c80163856843954da96c1f05fec158a40c2c4 (patch)
tree2762b746fe7462db73d1e3910ea5da563b130840 /chrome/browser/metrics
parentb1719466a057a1f4bbab43934aeb9e8df5dc59a4 (diff)
downloadchromium_src-054c80163856843954da96c1f05fec158a40c2c4.zip
chromium_src-054c80163856843954da96c1f05fec158a40c2c4.tar.gz
chromium_src-054c80163856843954da96c1f05fec158a40c2c4.tar.bz2
chrome: Remove 10 exit time destructors and 2 static initializers.
version_extension_ in MetricsLogBase was only used in the MetricsLog subclass, so move it to there. BUG=101600,94925 TEST=none Review URL: http://codereview.chromium.org/8468018 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@110219 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/metrics')
-rw-r--r--chrome/browser/metrics/metrics_log.cc19
-rw-r--r--chrome/browser/metrics/metrics_log.h5
2 files changed, 22 insertions, 2 deletions
diff --git a/chrome/browser/metrics/metrics_log.cc b/chrome/browser/metrics/metrics_log.cc
index 4526893..0f5f514 100644
--- a/chrome/browser/metrics/metrics_log.cc
+++ b/chrome/browser/metrics/metrics_log.cc
@@ -9,6 +9,7 @@
#include "base/basictypes.h"
#include "base/file_util.h"
+#include "base/lazy_instance.h"
#include "base/memory/scoped_ptr.h"
#include "base/perftimer.h"
#include "base/string_util.h"
@@ -37,6 +38,10 @@
extern "C" IMAGE_DOS_HEADER __ImageBase;
#endif
+static base::LazyInstance<std::string,
+ base::LeakyLazyInstanceTraits<std::string > >
+ g_version_extension = LAZY_INSTANCE_INITIALIZER;
+
MetricsLog::MetricsLog(const std::string& client_id, int session_id)
: MetricsLogBase(client_id, session_id, MetricsLog::GetVersionString()) {}
@@ -81,8 +86,8 @@ std::string MetricsLog::GetVersionString() {
}
std::string version = version_info.Version();
- if (!version_extension_.empty())
- version += version_extension_;
+ if (!version_extension().empty())
+ version += version_extension();
if (!version_info.IsOfficialBuild())
version.append("-devel");
return version;
@@ -92,6 +97,16 @@ MetricsLog* MetricsLog::AsMetricsLog() {
return this;
}
+// static
+void MetricsLog::set_version_extension(const std::string& extension) {
+ g_version_extension.Get() = extension;
+}
+
+// static
+const std::string& MetricsLog::version_extension() {
+ return g_version_extension.Get();
+}
+
void MetricsLog::RecordIncrementalStabilityElements() {
DCHECK(!locked_);
diff --git a/chrome/browser/metrics/metrics_log.h b/chrome/browser/metrics/metrics_log.h
index 95b1252..0903b14 100644
--- a/chrome/browser/metrics/metrics_log.h
+++ b/chrome/browser/metrics/metrics_log.h
@@ -65,6 +65,11 @@ class MetricsLog : public MetricsLogBase {
virtual MetricsLog* AsMetricsLog();
+ // Use |extension| in all uploaded appversions in addition to the standard
+ // version string.
+ static void set_version_extension(const std::string& extension);
+ static const std::string& version_extension();
+
private:
FRIEND_TEST_ALL_PREFIXES(MetricsLogTest, ChromeOSStabilityData);