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 | 5 |
6 | 6 |
7 //------------------------------------------------------------------------------ | 7 //------------------------------------------------------------------------------ |
8 // Description of the life cycle of a instance of MetricsService. | 8 // Description of the life cycle of a instance of MetricsService. |
9 // | 9 // |
10 // OVERVIEW | 10 // OVERVIEW |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
155 // | 155 // |
156 // | 156 // |
157 //------------------------------------------------------------------------------ | 157 //------------------------------------------------------------------------------ |
158 | 158 |
159 #include "chrome/browser/metrics/metrics_service.h" | 159 #include "chrome/browser/metrics/metrics_service.h" |
160 | 160 |
161 #include "base/base64.h" | 161 #include "base/base64.h" |
162 #include "base/command_line.h" | 162 #include "base/command_line.h" |
163 #include "base/md5.h" | 163 #include "base/md5.h" |
164 #include "base/metrics/histogram.h" | 164 #include "base/metrics/histogram.h" |
165 #include "base/rand_util.h" | |
166 #include "base/string_number_conversions.h" | 165 #include "base/string_number_conversions.h" |
167 #include "base/thread.h" | 166 #include "base/thread.h" |
168 #include "base/utf_string_conversions.h" | 167 #include "base/utf_string_conversions.h" |
169 #include "base/values.h" | 168 #include "base/values.h" |
170 #include "chrome/browser/bookmarks/bookmark_model.h" | 169 #include "chrome/browser/bookmarks/bookmark_model.h" |
171 #include "chrome/browser/browser_list.h" | 170 #include "chrome/browser/browser_list.h" |
172 #include "chrome/browser/browser_process.h" | 171 #include "chrome/browser/browser_process.h" |
| 172 #include "chrome/browser/guid.h" |
173 #include "chrome/browser/load_notification_details.h" | 173 #include "chrome/browser/load_notification_details.h" |
174 #include "chrome/browser/memory_details.h" | 174 #include "chrome/browser/memory_details.h" |
175 #include "chrome/browser/metrics/histogram_synchronizer.h" | 175 #include "chrome/browser/metrics/histogram_synchronizer.h" |
176 #include "chrome/browser/metrics/metrics_log.h" | 176 #include "chrome/browser/metrics/metrics_log.h" |
177 #include "chrome/browser/prefs/pref_service.h" | 177 #include "chrome/browser/prefs/pref_service.h" |
178 #include "chrome/browser/profile.h" | 178 #include "chrome/browser/profile.h" |
179 #include "chrome/browser/renderer_host/render_process_host.h" | 179 #include "chrome/browser/renderer_host/render_process_host.h" |
180 #include "chrome/browser/search_engines/template_url_model.h" | 180 #include "chrome/browser/search_engines/template_url_model.h" |
181 #include "chrome/common/child_process_info.h" | 181 #include "chrome/common/child_process_info.h" |
182 #include "chrome/common/child_process_logging.h" | 182 #include "chrome/common/child_process_logging.h" |
(...skipping 618 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
801 const std::string& hardware_class, | 801 const std::string& hardware_class, |
802 const std::vector<WebPluginInfo>& plugins) { | 802 const std::vector<WebPluginInfo>& plugins) { |
803 DCHECK(state_ == INIT_TASK_SCHEDULED); | 803 DCHECK(state_ == INIT_TASK_SCHEDULED); |
804 hardware_class_ = hardware_class; | 804 hardware_class_ = hardware_class; |
805 plugins_ = plugins; | 805 plugins_ = plugins; |
806 if (state_ == INIT_TASK_SCHEDULED) | 806 if (state_ == INIT_TASK_SCHEDULED) |
807 state_ = INIT_TASK_DONE; | 807 state_ = INIT_TASK_DONE; |
808 } | 808 } |
809 | 809 |
810 std::string MetricsService::GenerateClientID() { | 810 std::string MetricsService::GenerateClientID() { |
811 return base::GenerateGUID(); | 811 return guid::GenerateGUID(); |
812 } | 812 } |
813 | 813 |
814 //------------------------------------------------------------------------------ | 814 //------------------------------------------------------------------------------ |
815 // State save methods | 815 // State save methods |
816 | 816 |
817 void MetricsService::ScheduleNextStateSave() { | 817 void MetricsService::ScheduleNextStateSave() { |
818 state_saver_factory_.RevokeAll(); | 818 state_saver_factory_.RevokeAll(); |
819 | 819 |
820 MessageLoop::current()->PostDelayedTask(FROM_HERE, | 820 MessageLoop::current()->PostDelayedTask(FROM_HERE, |
821 state_saver_factory_.NewRunnableMethod(&MetricsService::SaveLocalState), | 821 state_saver_factory_.NewRunnableMethod(&MetricsService::SaveLocalState), |
(...skipping 1084 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1906 thread_id = PlatformThread::CurrentId(); | 1906 thread_id = PlatformThread::CurrentId(); |
1907 return PlatformThread::CurrentId() == thread_id; | 1907 return PlatformThread::CurrentId() == thread_id; |
1908 } | 1908 } |
1909 | 1909 |
1910 #if defined(OS_CHROMEOS) | 1910 #if defined(OS_CHROMEOS) |
1911 void MetricsService::StartExternalMetrics() { | 1911 void MetricsService::StartExternalMetrics() { |
1912 external_metrics_ = new chromeos::ExternalMetrics; | 1912 external_metrics_ = new chromeos::ExternalMetrics; |
1913 external_metrics_->Start(); | 1913 external_metrics_->Start(); |
1914 } | 1914 } |
1915 #endif | 1915 #endif |
OLD | NEW |