| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 1054 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1065 default: | 1065 default: |
| 1066 NOTREACHED(); | 1066 NOTREACHED(); |
| 1067 return "Unknown"; | 1067 return "Unknown"; |
| 1068 } | 1068 } |
| 1069 } | 1069 } |
| 1070 | 1070 |
| 1071 void MetricsService::OnURLFetchComplete(const content::URLFetcher* source) { | 1071 void MetricsService::OnURLFetchComplete(const content::URLFetcher* source) { |
| 1072 DCHECK(waiting_for_asynchronus_reporting_step_); | 1072 DCHECK(waiting_for_asynchronus_reporting_step_); |
| 1073 waiting_for_asynchronus_reporting_step_ = false; | 1073 waiting_for_asynchronus_reporting_step_ = false; |
| 1074 DCHECK(current_fetch_.get()); | 1074 DCHECK(current_fetch_.get()); |
| 1075 current_fetch_.reset(NULL); // We're not allowed to re-use it. | 1075 // We're not allowed to re-use it. Delete it on function exit since we use it. |
| 1076 scoped_ptr<content::URLFetcher> s(current_fetch_.release()); |
| 1076 | 1077 |
| 1077 // Confirm send so that we can move on. | 1078 // Confirm send so that we can move on. |
| 1078 VLOG(1) << "METRICS RESPONSE CODE: " << source->GetResponseCode() | 1079 VLOG(1) << "METRICS RESPONSE CODE: " << source->GetResponseCode() |
| 1079 << " status=" << StatusToString(source->GetStatus()); | 1080 << " status=" << StatusToString(source->GetStatus()); |
| 1080 | 1081 |
| 1081 bool upload_succeeded = source->GetResponseCode() == 200; | 1082 bool upload_succeeded = source->GetResponseCode() == 200; |
| 1082 | 1083 |
| 1083 // Provide boolean for error recovery (allow us to ignore response_code). | 1084 // Provide boolean for error recovery (allow us to ignore response_code). |
| 1084 bool discard_log = false; | 1085 bool discard_log = false; |
| 1085 | 1086 |
| (...skipping 455 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1541 if (local_state) { | 1542 if (local_state) { |
| 1542 const PrefService::Preference* uma_pref = | 1543 const PrefService::Preference* uma_pref = |
| 1543 local_state->FindPreference(prefs::kMetricsReportingEnabled); | 1544 local_state->FindPreference(prefs::kMetricsReportingEnabled); |
| 1544 if (uma_pref) { | 1545 if (uma_pref) { |
| 1545 bool success = uma_pref->GetValue()->GetAsBoolean(&result); | 1546 bool success = uma_pref->GetValue()->GetAsBoolean(&result); |
| 1546 DCHECK(success); | 1547 DCHECK(success); |
| 1547 } | 1548 } |
| 1548 } | 1549 } |
| 1549 return result; | 1550 return result; |
| 1550 } | 1551 } |
| OLD | NEW |