diff options
-rw-r--r-- | chrome/browser/metrics/metrics_service.cc | 34 | ||||
-rw-r--r-- | chrome/browser/metrics/metrics_service.h | 11 | ||||
-rw-r--r-- | chrome/common/metrics_helpers.cc | 12 |
3 files changed, 12 insertions, 45 deletions
diff --git a/chrome/browser/metrics/metrics_service.cc b/chrome/browser/metrics/metrics_service.cc index 64fdd67..3e30eab 100644 --- a/chrome/browser/metrics/metrics_service.cc +++ b/chrome/browser/metrics/metrics_service.cc @@ -1154,7 +1154,7 @@ void MetricsService::RecallUnsentLogs() { ListValue* unsent_initial_logs = local_state->GetMutableList( prefs::kMetricsInitialLogs); - for (ListValue::iterator it = unsent_initial_logs->begin(); + for (ListValue::const_iterator it = unsent_initial_logs->begin(); it != unsent_initial_logs->end(); ++it) { std::string log; (*it)->GetAsString(&log); @@ -1163,7 +1163,7 @@ void MetricsService::RecallUnsentLogs() { ListValue* unsent_ongoing_logs = local_state->GetMutableList( prefs::kMetricsOngoingLogs); - for (ListValue::iterator it = unsent_ongoing_logs->begin(); + for (ListValue::const_iterator it = unsent_ongoing_logs->begin(); it != unsent_ongoing_logs->end(); ++it) { std::string log; (*it)->GetAsString(&log); @@ -1185,8 +1185,8 @@ void MetricsService::StoreUnsentLogs() { if (unsent_initial_logs_.size() > kMaxInitialLogsPersisted) start = unsent_initial_logs_.size() - kMaxInitialLogsPersisted; for (size_t i = start; i < unsent_initial_logs_.size(); ++i) - unsent_initial_logs->Append( - Value::CreateStringValue(unsent_initial_logs_[i])); + unsent_initial_logs->Append( + Value::CreateStringValue(unsent_initial_logs_[i])); ListValue* unsent_ongoing_logs = local_state->GetMutableList( prefs::kMetricsOngoingLogs); @@ -1194,8 +1194,9 @@ void MetricsService::StoreUnsentLogs() { start = 0; if (unsent_ongoing_logs_.size() > kMaxOngoingLogsPersisted) start = unsent_ongoing_logs_.size() - kMaxOngoingLogsPersisted; + for (size_t i = start; i < unsent_ongoing_logs_.size(); ++i) - unsent_ongoing_logs->Append( + unsent_ongoing_logs->Append( Value::CreateStringValue(unsent_ongoing_logs_[i])); } @@ -1459,32 +1460,11 @@ void MetricsService::GetSettingsFromUploadNodeRecursive( } server_permits_upload_ = uploadOn; - } - if (path == "/upload/logs") { + } else if (path == "/upload/logs") { xmlChar* log_event_limit_val = xmlGetProp(node, BAD_CAST "event_limit"); if (log_event_limit_val) log_event_limit_ = atoi(reinterpret_cast<char*>(log_event_limit_val)); } - if (name == "histogram") { - xmlChar* type_value = xmlGetProp(node, BAD_CAST "type"); - if (type_value) { - std::string type = (reinterpret_cast<char*>(type_value)); - if (uploadOn) - histograms_to_upload_.insert(type); - else - histograms_to_omit_.insert(type); - } - } - if (name == "log") { - xmlChar* type_value = xmlGetProp(node, BAD_CAST "type"); - if (type_value) { - std::string type = (reinterpret_cast<char*>(type_value)); - if (uploadOn) - logs_to_upload_.insert(type); - else - logs_to_omit_.insert(type); - } - } // Recursive call. If the node is a leaf i.e. if it ends in a "/>", then it // doesn't have children, so node->children is NULL, and this loop doesn't diff --git a/chrome/browser/metrics/metrics_service.h b/chrome/browser/metrics/metrics_service.h index de6b6ba..7e318f0 100644 --- a/chrome/browser/metrics/metrics_service.h +++ b/chrome/browser/metrics/metrics_service.h @@ -379,10 +379,6 @@ class MetricsService : public NotificationObserver, // buffered plugin stability statistics. void RecordCurrentState(PrefService* pref); - // Requests all renderers to send their histograms back for - // collecting stats from renderers. - void CollectRendererHistograms(); - // Logs the initiation of a page load void LogLoadStarted(); @@ -485,13 +481,6 @@ class MetricsService : public NotificationObserver, // response data. int log_event_limit_; - // The types of data that are to be included in the logs and histograms - // according to the UMA response data. - std::set<std::string> logs_to_upload_; - std::set<std::string> logs_to_omit_; - std::set<std::string> histograms_to_upload_; - std::set<std::string> histograms_to_omit_; - // Indicate that a timer for sending the next log has already been queued. bool timer_pending_; diff --git a/chrome/common/metrics_helpers.cc b/chrome/common/metrics_helpers.cc index 68f9083..6008c66 100644 --- a/chrome/common/metrics_helpers.cc +++ b/chrome/common/metrics_helpers.cc @@ -380,8 +380,9 @@ int64 MetricsLogBase::GetBuildTime() { // Internal state is being needlessly exposed, and it would be hard to reuse // this code. If we moved this into the Histogram class, then we could use // the same infrastructure for logging StatsCounters, RatesCounters, etc. -void MetricsLogBase::RecordHistogramDelta(const Histogram& histogram, - const Histogram::SampleSet& snapshot) { +void MetricsLogBase::RecordHistogramDelta( + const Histogram& histogram, + const Histogram::SampleSet& snapshot) { DCHECK(!locked_); DCHECK_NE(0, snapshot.TotalCount()); snapshot.CheckSize(histogram); @@ -469,13 +470,10 @@ void MetricsServiceBase::RecordCurrentHistograms() { StatisticsRecorder::Histograms histograms; StatisticsRecorder::GetHistograms(&histograms); - for (StatisticsRecorder::Histograms::iterator it = histograms.begin(); + for (StatisticsRecorder::Histograms::const_iterator it = histograms.begin(); histograms.end() != it; ++it) { if ((*it)->flags() & Histogram::kUmaTargetedHistogramFlag) - // TODO(petersont): Only record historgrams if they are not precluded by - // the UMA response data. - // Bug http://code.google.com/p/chromium/issues/detail?id=2739. RecordHistogram(**it); } } @@ -500,7 +498,7 @@ void MetricsServiceBase::RecordHistogram(const Histogram& histogram) { snapshot.Subtract(*already_logged); } - // snapshot now contains only a delta to what we've already_logged. + // Snapshot now contains only a delta to what we've already_logged. if (snapshot.TotalCount() > 0) { current_log_->RecordHistogramDelta(histogram, snapshot); |