| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 //------------------------------------------------------------------------------ | 5 //------------------------------------------------------------------------------ |
| 6 // Description of the life cycle of a instance of MetricsService. | 6 // Description of the life cycle of a instance of MetricsService. |
| 7 // | 7 // |
| 8 // OVERVIEW | 8 // OVERVIEW |
| 9 // | 9 // |
| 10 // A MetricsService instance is typically created at application startup. It | 10 // A MetricsService instance is typically created at application startup. It |
| (...skipping 1244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1255 // we "zap" the data after the first upload attempt. This means that we might | 1255 // we "zap" the data after the first upload attempt. This means that we might |
| 1256 // lose protobuf uploads when XML ones succeed; but we will never duplicate any | 1256 // lose protobuf uploads when XML ones succeed; but we will never duplicate any |
| 1257 // protobuf uploads. Protobuf failures should be rare enough to where this | 1257 // protobuf uploads. Protobuf failures should be rare enough to where this |
| 1258 // should be ok while we have the two pipelines running in parallel. | 1258 // should be ok while we have the two pipelines running in parallel. |
| 1259 void MetricsService::OnURLFetchComplete(const net::URLFetcher* source) { | 1259 void MetricsService::OnURLFetchComplete(const net::URLFetcher* source) { |
| 1260 DCHECK(waiting_for_asynchronus_reporting_step_); | 1260 DCHECK(waiting_for_asynchronus_reporting_step_); |
| 1261 | 1261 |
| 1262 // We're not allowed to re-use the existing |URLFetcher|s, so free them here. | 1262 // We're not allowed to re-use the existing |URLFetcher|s, so free them here. |
| 1263 // Note however that |source| is aliased to one of these, so we should be | 1263 // Note however that |source| is aliased to one of these, so we should be |
| 1264 // careful not to delete it too early. | 1264 // careful not to delete it too early. |
| 1265 scoped_ptr<content::URLFetcher> s; | 1265 scoped_ptr<net::URLFetcher> s; |
| 1266 if (source == current_fetch_xml_.get()) { | 1266 if (source == current_fetch_xml_.get()) { |
| 1267 s.reset(current_fetch_xml_.release()); | 1267 s.reset(current_fetch_xml_.release()); |
| 1268 | 1268 |
| 1269 // Cache the XML responses, in case we still need to wait for the protobuf | 1269 // Cache the XML responses, in case we still need to wait for the protobuf |
| 1270 // response. | 1270 // response. |
| 1271 response_code_ = source->GetResponseCode(); | 1271 response_code_ = source->GetResponseCode(); |
| 1272 response_status_ = StatusToString(source->GetStatus()); | 1272 response_status_ = StatusToString(source->GetStatus()); |
| 1273 source->GetResponseAsString(&response_data_); | 1273 source->GetResponseAsString(&response_data_); |
| 1274 | 1274 |
| 1275 // Log a histogram to track response success vs. failure rates. | 1275 // Log a histogram to track response success vs. failure rates. |
| (...skipping 490 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1766 if (local_state) { | 1766 if (local_state) { |
| 1767 const PrefService::Preference* uma_pref = | 1767 const PrefService::Preference* uma_pref = |
| 1768 local_state->FindPreference(prefs::kMetricsReportingEnabled); | 1768 local_state->FindPreference(prefs::kMetricsReportingEnabled); |
| 1769 if (uma_pref) { | 1769 if (uma_pref) { |
| 1770 bool success = uma_pref->GetValue()->GetAsBoolean(&result); | 1770 bool success = uma_pref->GetValue()->GetAsBoolean(&result); |
| 1771 DCHECK(success); | 1771 DCHECK(success); |
| 1772 } | 1772 } |
| 1773 } | 1773 } |
| 1774 return result; | 1774 return result; |
| 1775 } | 1775 } |
| OLD | NEW |