Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(83)

Side by Side Diff: chrome/browser/metrics/metrics_service.cc

Issue 9597005: Revert 124890 - Convert uses of int ms to TimeDelta in chrome/browser and net. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 816 matching lines...) Expand 10 before | Expand all | Expand 10 after
827 // Schedules a task on the file thread for execution of slower 827 // Schedules a task on the file thread for execution of slower
828 // initialization steps (such as plugin list generation) necessary 828 // initialization steps (such as plugin list generation) necessary
829 // for sending the initial log. This avoids blocking the main UI 829 // for sending the initial log. This avoids blocking the main UI
830 // thread. 830 // thread.
831 BrowserThread::PostDelayedTask( 831 BrowserThread::PostDelayedTask(
832 BrowserThread::FILE, 832 BrowserThread::FILE,
833 FROM_HERE, 833 FROM_HERE,
834 base::Bind(&MetricsService::InitTaskGetHardwareClass, 834 base::Bind(&MetricsService::InitTaskGetHardwareClass,
835 self_ptr_factory_.GetWeakPtr(), 835 self_ptr_factory_.GetWeakPtr(),
836 MessageLoop::current()->message_loop_proxy()), 836 MessageLoop::current()->message_loop_proxy()),
837 base::TimeDelta::FromSeconds(kInitializationDelaySeconds)); 837 kInitializationDelaySeconds);
838 } 838 }
839 } 839 }
840 840
841 void MetricsService::StopRecording() { 841 void MetricsService::StopRecording() {
842 if (!log_manager_.current_log()) 842 if (!log_manager_.current_log())
843 return; 843 return;
844 844
845 // TODO(jar): Integrate bounds on log recording more consistently, so that we 845 // TODO(jar): Integrate bounds on log recording more consistently, so that we
846 // can stop recording logs that are too big much sooner. 846 // can stop recording logs that are too big much sooner.
847 if (log_manager_.current_log()->num_events() > kEventLimit) { 847 if (log_manager_.current_log()->num_events() > kEventLimit) {
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
936 &MetricsService::OnHistogramSynchronizationDone, 936 &MetricsService::OnHistogramSynchronizationDone,
937 self_ptr_factory_.GetWeakPtr()); 937 self_ptr_factory_.GetWeakPtr());
938 938
939 base::StatisticsRecorder::CollectHistogramStats("Browser"); 939 base::StatisticsRecorder::CollectHistogramStats("Browser");
940 940
941 // Set up the callback to task to call after we receive histograms from all 941 // Set up the callback to task to call after we receive histograms from all
942 // renderer processes. Wait time specifies how long to wait before absolutely 942 // renderer processes. Wait time specifies how long to wait before absolutely
943 // calling us back on the task. 943 // calling us back on the task.
944 HistogramSynchronizer::FetchRendererHistogramsAsynchronously( 944 HistogramSynchronizer::FetchRendererHistogramsAsynchronously(
945 MessageLoop::current(), callback, 945 MessageLoop::current(), callback,
946 base::TimeDelta::FromMilliseconds(kMaxHistogramGatheringWaitDuration)); 946 kMaxHistogramGatheringWaitDuration);
947 } 947 }
948 948
949 void MetricsService::OnHistogramSynchronizationDone() { 949 void MetricsService::OnHistogramSynchronizationDone() {
950 DCHECK(IsSingleThreaded()); 950 DCHECK(IsSingleThreaded());
951 // This function should only be called as the callback from an ansynchronous 951 // This function should only be called as the callback from an ansynchronous
952 // step. 952 // step.
953 DCHECK(waiting_for_asynchronus_reporting_step_); 953 DCHECK(waiting_for_asynchronus_reporting_step_);
954 954
955 waiting_for_asynchronus_reporting_step_ = false; 955 waiting_for_asynchronus_reporting_step_ = false;
956 OnFinalLogInfoCollectionDone(); 956 OnFinalLogInfoCollectionDone();
(...skipping 701 matching lines...) Expand 10 before | Expand all | Expand 10 after
1658 if (local_state) { 1658 if (local_state) {
1659 const PrefService::Preference* uma_pref = 1659 const PrefService::Preference* uma_pref =
1660 local_state->FindPreference(prefs::kMetricsReportingEnabled); 1660 local_state->FindPreference(prefs::kMetricsReportingEnabled);
1661 if (uma_pref) { 1661 if (uma_pref) {
1662 bool success = uma_pref->GetValue()->GetAsBoolean(&result); 1662 bool success = uma_pref->GetValue()->GetAsBoolean(&result);
1663 DCHECK(success); 1663 DCHECK(success);
1664 } 1664 }
1665 } 1665 }
1666 return result; 1666 return result;
1667 } 1667 }
OLDNEW
« no previous file with comments | « chrome/browser/metrics/histogram_synchronizer.cc ('k') | chrome/browser/metrics/tracking_synchronizer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698