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 1177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1188 // first, we cache that response until the protobuf upload's response also | 1188 // first, we cache that response until the protobuf upload's response also |
1189 // arrives. | 1189 // arrives. |
1190 // | 1190 // |
1191 // Note that if the XML upload succeeds but the protobuf upload fails, we will | 1191 // Note that if the XML upload succeeds but the protobuf upload fails, we will |
1192 // not retry the protobuf upload. If the XML upload fails while the protobuf | 1192 // not retry the protobuf upload. If the XML upload fails while the protobuf |
1193 // upload succeeds, we will still avoid re-uploading the protobuf data because | 1193 // upload succeeds, we will still avoid re-uploading the protobuf data because |
1194 // we "zap" the data after the first upload attempt. This means that we might | 1194 // we "zap" the data after the first upload attempt. This means that we might |
1195 // lose protobuf uploads when XML ones succeed; but we will never duplicate any | 1195 // lose protobuf uploads when XML ones succeed; but we will never duplicate any |
1196 // protobuf uploads. Protobuf failures should be rare enough to where this | 1196 // protobuf uploads. Protobuf failures should be rare enough to where this |
1197 // should be ok while we have the two pipelines running in parallel. | 1197 // should be ok while we have the two pipelines running in parallel. |
1198 void MetricsService::OnURLFetchComplete(const content::URLFetcher* source) { | 1198 void MetricsService::OnURLFetchComplete(const net::URLFetcher* source) { |
1199 DCHECK(waiting_for_asynchronus_reporting_step_); | 1199 DCHECK(waiting_for_asynchronus_reporting_step_); |
1200 | 1200 |
1201 // We're not allowed to re-use the existing |URLFetcher|s, so free them here. | 1201 // We're not allowed to re-use the existing |URLFetcher|s, so free them here. |
1202 scoped_ptr<content::URLFetcher> s; | 1202 scoped_ptr<content::URLFetcher> s; |
1203 if (source == current_fetch_xml_.get()) { | 1203 if (source == current_fetch_xml_.get()) { |
1204 s.reset(current_fetch_xml_.release()); | 1204 s.reset(current_fetch_xml_.release()); |
1205 | 1205 |
1206 // Cache the XML responses, in case we still need to wait for the protobuf | 1206 // Cache the XML responses, in case we still need to wait for the protobuf |
1207 // response. | 1207 // response. |
1208 response_code_ = source->GetResponseCode(); | 1208 response_code_ = source->GetResponseCode(); |
(...skipping 485 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1694 if (local_state) { | 1694 if (local_state) { |
1695 const PrefService::Preference* uma_pref = | 1695 const PrefService::Preference* uma_pref = |
1696 local_state->FindPreference(prefs::kMetricsReportingEnabled); | 1696 local_state->FindPreference(prefs::kMetricsReportingEnabled); |
1697 if (uma_pref) { | 1697 if (uma_pref) { |
1698 bool success = uma_pref->GetValue()->GetAsBoolean(&result); | 1698 bool success = uma_pref->GetValue()->GetAsBoolean(&result); |
1699 DCHECK(success); | 1699 DCHECK(success); |
1700 } | 1700 } |
1701 } | 1701 } |
1702 return result; | 1702 return result; |
1703 } | 1703 } |
OLD | NEW |