| OLD | NEW | 
|     1 // Copyright 2014 The Chromium Authors. All rights reserved. |     1 // Copyright 2014 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 is |    10 // A MetricsService instance is typically created at application startup.  It is | 
| (...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|   419   base::AddActionCallback(action_callback_); |   419   base::AddActionCallback(action_callback_); | 
|   420 } |   420 } | 
|   421  |   421  | 
|   422 void MetricsService::DisableRecording() { |   422 void MetricsService::DisableRecording() { | 
|   423   DCHECK(IsSingleThreaded()); |   423   DCHECK(IsSingleThreaded()); | 
|   424  |   424  | 
|   425   if (!recording_active_) |   425   if (!recording_active_) | 
|   426     return; |   426     return; | 
|   427   recording_active_ = false; |   427   recording_active_ = false; | 
|   428  |   428  | 
 |   429   client_->OnRecordingDisabled(); | 
 |   430  | 
|   429   base::RemoveActionCallback(action_callback_); |   431   base::RemoveActionCallback(action_callback_); | 
|   430  |   432  | 
|   431   for (size_t i = 0; i < metrics_providers_.size(); ++i) |   433   for (size_t i = 0; i < metrics_providers_.size(); ++i) | 
|   432     metrics_providers_[i]->OnRecordingDisabled(); |   434     metrics_providers_[i]->OnRecordingDisabled(); | 
|   433  |   435  | 
|   434   PushPendingLogsToPersistentStorage(); |   436   PushPendingLogsToPersistentStorage(); | 
|   435 } |   437 } | 
|   436  |   438  | 
|   437 bool MetricsService::recording_active() const { |   439 bool MetricsService::recording_active() const { | 
|   438   DCHECK(IsSingleThreaded()); |   440   DCHECK(IsSingleThreaded()); | 
| (...skipping 811 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  1250   local_state_->SetBoolean(path, value); |  1252   local_state_->SetBoolean(path, value); | 
|  1251   RecordCurrentState(local_state_); |  1253   RecordCurrentState(local_state_); | 
|  1252 } |  1254 } | 
|  1253  |  1255  | 
|  1254 void MetricsService::RecordCurrentState(PrefService* pref) { |  1256 void MetricsService::RecordCurrentState(PrefService* pref) { | 
|  1255   pref->SetInt64(prefs::kStabilityLastTimestampSec, |  1257   pref->SetInt64(prefs::kStabilityLastTimestampSec, | 
|  1256                  base::Time::Now().ToTimeT()); |  1258                  base::Time::Now().ToTimeT()); | 
|  1257 } |  1259 } | 
|  1258  |  1260  | 
|  1259 }  // namespace metrics |  1261 }  // namespace metrics | 
| OLD | NEW |