| 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 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 288 }; | 288 }; |
| 289 | 289 |
| 290 // Handles asynchronous fetching of memory details. | 290 // Handles asynchronous fetching of memory details. |
| 291 // Will run the provided task after finished. | 291 // Will run the provided task after finished. |
| 292 class MetricsMemoryDetails : public MemoryDetails { | 292 class MetricsMemoryDetails : public MemoryDetails { |
| 293 public: | 293 public: |
| 294 explicit MetricsMemoryDetails(const base::Closure& callback) | 294 explicit MetricsMemoryDetails(const base::Closure& callback) |
| 295 : callback_(callback) {} | 295 : callback_(callback) {} |
| 296 | 296 |
| 297 virtual void OnDetailsAvailable() { | 297 virtual void OnDetailsAvailable() { |
| 298 UpdateHistograms(); |
| 298 MessageLoop::current()->PostTask(FROM_HERE, callback_); | 299 MessageLoop::current()->PostTask(FROM_HERE, callback_); |
| 299 } | 300 } |
| 300 | 301 |
| 301 private: | 302 private: |
| 302 ~MetricsMemoryDetails() {} | 303 ~MetricsMemoryDetails() {} |
| 303 | 304 |
| 304 base::Closure callback_; | 305 base::Closure callback_; |
| 305 DISALLOW_COPY_AND_ASSIGN(MetricsMemoryDetails); | 306 DISALLOW_COPY_AND_ASSIGN(MetricsMemoryDetails); |
| 306 }; | 307 }; |
| 307 | 308 |
| (...skipping 1362 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1670 if (local_state) { | 1671 if (local_state) { |
| 1671 const PrefService::Preference* uma_pref = | 1672 const PrefService::Preference* uma_pref = |
| 1672 local_state->FindPreference(prefs::kMetricsReportingEnabled); | 1673 local_state->FindPreference(prefs::kMetricsReportingEnabled); |
| 1673 if (uma_pref) { | 1674 if (uma_pref) { |
| 1674 bool success = uma_pref->GetValue()->GetAsBoolean(&result); | 1675 bool success = uma_pref->GetValue()->GetAsBoolean(&result); |
| 1675 DCHECK(success); | 1676 DCHECK(success); |
| 1676 } | 1677 } |
| 1677 } | 1678 } |
| 1678 return result; | 1679 return result; |
| 1679 } | 1680 } |
| OLD | NEW |