| 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 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 153 // saved for re-transmission. These duplicates could be filtered out server | 153 // saved for re-transmission. These duplicates could be filtered out server |
| 154 // side, but are not expected to be a significant problem. | 154 // side, but are not expected to be a significant problem. |
| 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/guid.h" |
| 163 #include "base/md5.h" | 164 #include "base/md5.h" |
| 164 #include "base/metrics/histogram.h" | 165 #include "base/metrics/histogram.h" |
| 165 #include "base/string_number_conversions.h" | 166 #include "base/string_number_conversions.h" |
| 166 #include "base/thread.h" | 167 #include "base/thread.h" |
| 167 #include "base/utf_string_conversions.h" | 168 #include "base/utf_string_conversions.h" |
| 168 #include "base/values.h" | 169 #include "base/values.h" |
| 169 #include "chrome/browser/bookmarks/bookmark_model.h" | 170 #include "chrome/browser/bookmarks/bookmark_model.h" |
| 170 #include "chrome/browser/browser_list.h" | 171 #include "chrome/browser/browser_list.h" |
| 171 #include "chrome/browser/browser_process.h" | 172 #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/profiles/profile.h" | 178 #include "chrome/browser/profiles/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 620 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 803 const std::string& hardware_class, | 803 const std::string& hardware_class, |
| 804 const std::vector<WebPluginInfo>& plugins) { | 804 const std::vector<WebPluginInfo>& plugins) { |
| 805 DCHECK(state_ == INIT_TASK_SCHEDULED); | 805 DCHECK(state_ == INIT_TASK_SCHEDULED); |
| 806 hardware_class_ = hardware_class; | 806 hardware_class_ = hardware_class; |
| 807 plugins_ = plugins; | 807 plugins_ = plugins; |
| 808 if (state_ == INIT_TASK_SCHEDULED) | 808 if (state_ == INIT_TASK_SCHEDULED) |
| 809 state_ = INIT_TASK_DONE; | 809 state_ = INIT_TASK_DONE; |
| 810 } | 810 } |
| 811 | 811 |
| 812 std::string MetricsService::GenerateClientID() { | 812 std::string MetricsService::GenerateClientID() { |
| 813 return guid::GenerateGUID(); | 813 return base::GenerateGUID(); |
| 814 } | 814 } |
| 815 | 815 |
| 816 //------------------------------------------------------------------------------ | 816 //------------------------------------------------------------------------------ |
| 817 // State save methods | 817 // State save methods |
| 818 | 818 |
| 819 void MetricsService::ScheduleNextStateSave() { | 819 void MetricsService::ScheduleNextStateSave() { |
| 820 state_saver_factory_.RevokeAll(); | 820 state_saver_factory_.RevokeAll(); |
| 821 | 821 |
| 822 MessageLoop::current()->PostDelayedTask(FROM_HERE, | 822 MessageLoop::current()->PostDelayedTask(FROM_HERE, |
| 823 state_saver_factory_.NewRunnableMethod(&MetricsService::SaveLocalState), | 823 state_saver_factory_.NewRunnableMethod(&MetricsService::SaveLocalState), |
| (...skipping 1084 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1908 thread_id = PlatformThread::CurrentId(); | 1908 thread_id = PlatformThread::CurrentId(); |
| 1909 return PlatformThread::CurrentId() == thread_id; | 1909 return PlatformThread::CurrentId() == thread_id; |
| 1910 } | 1910 } |
| 1911 | 1911 |
| 1912 #if defined(OS_CHROMEOS) | 1912 #if defined(OS_CHROMEOS) |
| 1913 void MetricsService::StartExternalMetrics() { | 1913 void MetricsService::StartExternalMetrics() { |
| 1914 external_metrics_ = new chromeos::ExternalMetrics; | 1914 external_metrics_ = new chromeos::ExternalMetrics; |
| 1915 external_metrics_->Start(); | 1915 external_metrics_->Start(); |
| 1916 } | 1916 } |
| 1917 #endif | 1917 #endif |
| OLD | NEW |