Chromium Code Reviews| Index: components/metrics/metrics_log_base.cc |
| diff --git a/chrome/common/metrics/metrics_log_base.cc b/components/metrics/metrics_log_base.cc |
| similarity index 78% |
| rename from chrome/common/metrics/metrics_log_base.cc |
| rename to components/metrics/metrics_log_base.cc |
| index 3eb497224bac58a6863d7baf3d6e9fb33f76f76e..ed461c483a798297f9e0f53f3c66f1c3262fd5c7 100644 |
| --- a/chrome/common/metrics/metrics_log_base.cc |
| +++ b/components/metrics/metrics_log_base.cc |
| @@ -2,15 +2,14 @@ |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| -#include "chrome/common/metrics/metrics_log_base.h" |
| +#include "components/metrics/metrics_log_base.h" |
| #include "base/metrics/histogram_base.h" |
| #include "base/metrics/histogram_samples.h" |
| -#include "chrome/common/chrome_version_info.h" |
| -#include "chrome/common/metrics/proto/histogram_event.pb.h" |
| -#include "chrome/common/metrics/proto/system_profile.pb.h" |
| -#include "chrome/common/metrics/proto/user_action_event.pb.h" |
| #include "components/metrics/metrics_hashes.h" |
| +#include "components/metrics/proto/histogram_event.pb.h" |
| +#include "components/metrics/proto/system_profile.pb.h" |
| +#include "components/metrics/proto/user_action_event.pb.h" |
| using base::Histogram; |
| using base::HistogramBase; |
| @@ -22,32 +21,11 @@ using metrics::HistogramEventProto; |
| using metrics::SystemProfileProto; |
| using metrics::UserActionEventProto; |
| +namespace metrics { |
| namespace { |
| // Any id less than 16 bytes is considered to be a testing id. |
| -bool IsTestingID(const std::string& id) { |
| - return id.size() < 16; |
| -} |
| - |
| -SystemProfileProto::Channel AsProtobufChannel( |
| - chrome::VersionInfo::Channel channel) { |
| - switch (channel) { |
| - case chrome::VersionInfo::CHANNEL_UNKNOWN: |
| - return SystemProfileProto::CHANNEL_UNKNOWN; |
| - case chrome::VersionInfo::CHANNEL_CANARY: |
| - return SystemProfileProto::CHANNEL_CANARY; |
| - case chrome::VersionInfo::CHANNEL_DEV: |
| - return SystemProfileProto::CHANNEL_DEV; |
| - case chrome::VersionInfo::CHANNEL_BETA: |
| - return SystemProfileProto::CHANNEL_BETA; |
| - case chrome::VersionInfo::CHANNEL_STABLE: |
| - return SystemProfileProto::CHANNEL_STABLE; |
| - default: |
| - NOTREACHED(); |
| - return SystemProfileProto::CHANNEL_UNKNOWN; |
| - } |
| -} |
| - |
| +bool IsTestingID(const std::string& id) { return id.size() < 16; } |
|
Ilya Sherman
2014/04/15 23:00:40
nit: This should retain its previous formatting.
|
| } // namespace |
| MetricsLogBase::MetricsLogBase(const std::string& client_id, |
| @@ -66,8 +44,6 @@ MetricsLogBase::MetricsLogBase(const std::string& client_id, |
| uma_proto_.set_session_id(session_id); |
| uma_proto_.mutable_system_profile()->set_build_timestamp(GetBuildTime()); |
| uma_proto_.mutable_system_profile()->set_app_version(version_string); |
| - uma_proto_.mutable_system_profile()->set_channel( |
| - AsProtobufChannel(chrome::VersionInfo::GetChannel())); |
| } |
| MetricsLogBase::~MetricsLogBase() {} |
| @@ -136,8 +112,7 @@ void MetricsLogBase::RecordHistogramDelta(const std::string& histogram_name, |
| histogram_proto->set_name_hash(Hash(histogram_name)); |
| histogram_proto->set_sum(snapshot.sum()); |
| - for (scoped_ptr<SampleCountIterator> it = snapshot.Iterator(); |
| - !it->Done(); |
| + for (scoped_ptr<SampleCountIterator> it = snapshot.Iterator(); !it->Done(); |
| it->Next()) { |
| HistogramBase::Sample min; |
| HistogramBase::Sample max; |
| @@ -160,3 +135,4 @@ void MetricsLogBase::RecordHistogramDelta(const std::string& histogram_name, |
| } |
| } |
| } |
| +} // namespace metrics |
|
Ilya Sherman
2014/04/15 23:00:40
nit: There should be a blank line above this. (Pl
|