OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 | |
6 | |
7 //------------------------------------------------------------------------------ | 5 //------------------------------------------------------------------------------ |
8 // Description of the life cycle of a instance of MetricsService. | 6 // Description of the life cycle of a instance of MetricsService. |
9 // | 7 // |
10 // OVERVIEW | 8 // OVERVIEW |
11 // | 9 // |
12 // A MetricsService instance is typically created at application startup. It | 10 // A MetricsService instance is typically created at application startup. It |
13 // is the central controller for the acquisition of log data, and the automatic | 11 // is the central controller for the acquisition of log data, and the automatic |
14 // transmission of that log data to an external server. Its major job is to | 12 // transmission of that log data to an external server. Its major job is to |
15 // manage logs, grouping them for transmission, and transmitting them. As part | 13 // manage logs, grouping them for transmission, and transmitting them. As part |
16 // of its grouping, MS finalizes logs by including some just-in-time gathered | 14 // of its grouping, MS finalizes logs by including some just-in-time gathered |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
157 //------------------------------------------------------------------------------ | 155 //------------------------------------------------------------------------------ |
158 | 156 |
159 #include "chrome/browser/metrics/metrics_service.h" | 157 #include "chrome/browser/metrics/metrics_service.h" |
160 | 158 |
161 #include "base/base64.h" | 159 #include "base/base64.h" |
162 #include "base/command_line.h" | 160 #include "base/command_line.h" |
163 #include "base/md5.h" | 161 #include "base/md5.h" |
164 #include "base/metrics/histogram.h" | 162 #include "base/metrics/histogram.h" |
165 #include "base/string_number_conversions.h" | 163 #include "base/string_number_conversions.h" |
166 #include "base/thread.h" | 164 #include "base/thread.h" |
| 165 #include "base/threading/platform_thread.h" |
167 #include "base/utf_string_conversions.h" | 166 #include "base/utf_string_conversions.h" |
168 #include "base/values.h" | 167 #include "base/values.h" |
169 #include "chrome/browser/bookmarks/bookmark_model.h" | 168 #include "chrome/browser/bookmarks/bookmark_model.h" |
170 #include "chrome/browser/browser_list.h" | 169 #include "chrome/browser/browser_list.h" |
171 #include "chrome/browser/browser_process.h" | 170 #include "chrome/browser/browser_process.h" |
172 #include "chrome/browser/load_notification_details.h" | 171 #include "chrome/browser/load_notification_details.h" |
173 #include "chrome/browser/memory_details.h" | 172 #include "chrome/browser/memory_details.h" |
174 #include "chrome/browser/metrics/histogram_synchronizer.h" | 173 #include "chrome/browser/metrics/histogram_synchronizer.h" |
175 #include "chrome/browser/metrics/metrics_log.h" | 174 #include "chrome/browser/metrics/metrics_log.h" |
176 #include "chrome/browser/prefs/pref_service.h" | 175 #include "chrome/browser/prefs/pref_service.h" |
(...skipping 1720 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1897 RecordCurrentState(pref); | 1896 RecordCurrentState(pref); |
1898 } | 1897 } |
1899 | 1898 |
1900 void MetricsService::RecordCurrentState(PrefService* pref) { | 1899 void MetricsService::RecordCurrentState(PrefService* pref) { |
1901 pref->SetInt64(prefs::kStabilityLastTimestampSec, Time::Now().ToTimeT()); | 1900 pref->SetInt64(prefs::kStabilityLastTimestampSec, Time::Now().ToTimeT()); |
1902 | 1901 |
1903 RecordPluginChanges(pref); | 1902 RecordPluginChanges(pref); |
1904 } | 1903 } |
1905 | 1904 |
1906 static bool IsSingleThreaded() { | 1905 static bool IsSingleThreaded() { |
1907 static PlatformThreadId thread_id = 0; | 1906 static base::PlatformThreadId thread_id = 0; |
1908 if (!thread_id) | 1907 if (!thread_id) |
1909 thread_id = PlatformThread::CurrentId(); | 1908 thread_id = base::PlatformThread::CurrentId(); |
1910 return PlatformThread::CurrentId() == thread_id; | 1909 return base::PlatformThread::CurrentId() == thread_id; |
1911 } | 1910 } |
1912 | 1911 |
1913 #if defined(OS_CHROMEOS) | 1912 #if defined(OS_CHROMEOS) |
1914 void MetricsService::StartExternalMetrics() { | 1913 void MetricsService::StartExternalMetrics() { |
1915 external_metrics_ = new chromeos::ExternalMetrics; | 1914 external_metrics_ = new chromeos::ExternalMetrics; |
1916 external_metrics_->Start(); | 1915 external_metrics_->Start(); |
1917 } | 1916 } |
1918 #endif | 1917 #endif |
OLD | NEW |