| 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 405 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 416 content::ProcessType process_type; | 416 content::ProcessType process_type; |
| 417 }; | 417 }; |
| 418 | 418 |
| 419 // Handles asynchronous fetching of memory details. | 419 // Handles asynchronous fetching of memory details. |
| 420 // Will run the provided task after finished. | 420 // Will run the provided task after finished. |
| 421 class MetricsMemoryDetails : public MemoryDetails { | 421 class MetricsMemoryDetails : public MemoryDetails { |
| 422 public: | 422 public: |
| 423 explicit MetricsMemoryDetails(const base::Closure& callback) | 423 explicit MetricsMemoryDetails(const base::Closure& callback) |
| 424 : callback_(callback) {} | 424 : callback_(callback) {} |
| 425 | 425 |
| 426 virtual void OnDetailsAvailable() { | 426 virtual void OnDetailsAvailable() OVERRIDE { |
| 427 MessageLoop::current()->PostTask(FROM_HERE, callback_); | 427 MessageLoop::current()->PostTask(FROM_HERE, callback_); |
| 428 } | 428 } |
| 429 | 429 |
| 430 private: | 430 private: |
| 431 ~MetricsMemoryDetails() {} | 431 virtual ~MetricsMemoryDetails() {} |
| 432 | 432 |
| 433 base::Closure callback_; | 433 base::Closure callback_; |
| 434 DISALLOW_COPY_AND_ASSIGN(MetricsMemoryDetails); | 434 DISALLOW_COPY_AND_ASSIGN(MetricsMemoryDetails); |
| 435 }; | 435 }; |
| 436 | 436 |
| 437 // static | 437 // static |
| 438 void MetricsService::RegisterPrefs(PrefRegistrySimple* registry) { | 438 void MetricsService::RegisterPrefs(PrefRegistrySimple* registry) { |
| 439 DCHECK(IsSingleThreaded()); | 439 DCHECK(IsSingleThreaded()); |
| 440 registry->RegisterStringPref(prefs::kMetricsClientID, ""); | 440 registry->RegisterStringPref(prefs::kMetricsClientID, ""); |
| 441 registry->RegisterIntegerPref(prefs::kMetricsLowEntropySource, | 441 registry->RegisterIntegerPref(prefs::kMetricsLowEntropySource, |
| (...skipping 1498 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1940 if (local_state) { | 1940 if (local_state) { |
| 1941 const PrefService::Preference* uma_pref = | 1941 const PrefService::Preference* uma_pref = |
| 1942 local_state->FindPreference(prefs::kMetricsReportingEnabled); | 1942 local_state->FindPreference(prefs::kMetricsReportingEnabled); |
| 1943 if (uma_pref) { | 1943 if (uma_pref) { |
| 1944 bool success = uma_pref->GetValue()->GetAsBoolean(&result); | 1944 bool success = uma_pref->GetValue()->GetAsBoolean(&result); |
| 1945 DCHECK(success); | 1945 DCHECK(success); |
| 1946 } | 1946 } |
| 1947 } | 1947 } |
| 1948 return result; | 1948 return result; |
| 1949 } | 1949 } |
| OLD | NEW |