| 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 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 177 #include "chrome/browser/profiles/profile.h" | 177 #include "chrome/browser/profiles/profile.h" |
| 178 #include "chrome/browser/renderer_host/render_process_host.h" | 178 #include "chrome/browser/renderer_host/render_process_host.h" |
| 179 #include "chrome/browser/search_engines/template_url_model.h" | 179 #include "chrome/browser/search_engines/template_url_model.h" |
| 180 #include "chrome/common/child_process_info.h" | 180 #include "chrome/common/child_process_info.h" |
| 181 #include "chrome/common/child_process_logging.h" | 181 #include "chrome/common/child_process_logging.h" |
| 182 #include "chrome/common/chrome_switches.h" | 182 #include "chrome/common/chrome_switches.h" |
| 183 #include "chrome/common/guid.h" | 183 #include "chrome/common/guid.h" |
| 184 #include "chrome/common/notification_service.h" | 184 #include "chrome/common/notification_service.h" |
| 185 #include "chrome/common/pref_names.h" | 185 #include "chrome/common/pref_names.h" |
| 186 #include "chrome/common/render_messages.h" | 186 #include "chrome/common/render_messages.h" |
| 187 #include "webkit/plugins/npapi/plugin_list.h" | 187 #include "webkit/glue/plugins/plugin_list.h" |
| 188 #include "webkit/plugins/npapi/webplugininfo.h" | 188 #include "webkit/glue/plugins/webplugininfo.h" |
| 189 #include "libxml/xmlwriter.h" | 189 #include "libxml/xmlwriter.h" |
| 190 | 190 |
| 191 // TODO(port): port browser_distribution.h. | 191 // TODO(port): port browser_distribution.h. |
| 192 #if !defined(OS_POSIX) | 192 #if !defined(OS_POSIX) |
| 193 #include "chrome/installer/util/browser_distribution.h" | 193 #include "chrome/installer/util/browser_distribution.h" |
| 194 #endif | 194 #endif |
| 195 | 195 |
| 196 #if defined(OS_CHROMEOS) | 196 #if defined(OS_CHROMEOS) |
| 197 #include "chrome/browser/chromeos/cros/cros_library.h" | 197 #include "chrome/browser/chromeos/cros/cros_library.h" |
| 198 #include "chrome/browser/chromeos/cros/system_library.h" | 198 #include "chrome/browser/chromeos/cros/system_library.h" |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 329 | 329 |
| 330 private: | 330 private: |
| 331 ~MetricsMemoryDetails() {} | 331 ~MetricsMemoryDetails() {} |
| 332 | 332 |
| 333 Task* completion_; | 333 Task* completion_; |
| 334 DISALLOW_COPY_AND_ASSIGN(MetricsMemoryDetails); | 334 DISALLOW_COPY_AND_ASSIGN(MetricsMemoryDetails); |
| 335 }; | 335 }; |
| 336 | 336 |
| 337 class MetricsService::InitTaskComplete : public Task { | 337 class MetricsService::InitTaskComplete : public Task { |
| 338 public: | 338 public: |
| 339 explicit InitTaskComplete( | 339 explicit InitTaskComplete(const std::string& hardware_class, |
| 340 const std::string& hardware_class, | 340 const std::vector<WebPluginInfo>& plugins) |
| 341 const std::vector<webkit::npapi::WebPluginInfo>& plugins) | |
| 342 : hardware_class_(hardware_class), plugins_(plugins) {} | 341 : hardware_class_(hardware_class), plugins_(plugins) {} |
| 343 | 342 |
| 344 virtual void Run() { | 343 virtual void Run() { |
| 345 g_browser_process->metrics_service()->OnInitTaskComplete( | 344 g_browser_process->metrics_service()->OnInitTaskComplete( |
| 346 hardware_class_, plugins_); | 345 hardware_class_, plugins_); |
| 347 } | 346 } |
| 348 | 347 |
| 349 private: | 348 private: |
| 350 std::string hardware_class_; | 349 std::string hardware_class_; |
| 351 std::vector<webkit::npapi::WebPluginInfo> plugins_; | 350 std::vector<WebPluginInfo> plugins_; |
| 352 }; | 351 }; |
| 353 | 352 |
| 354 class MetricsService::InitTask : public Task { | 353 class MetricsService::InitTask : public Task { |
| 355 public: | 354 public: |
| 356 explicit InitTask(MessageLoop* callback_loop) | 355 explicit InitTask(MessageLoop* callback_loop) |
| 357 : callback_loop_(callback_loop) {} | 356 : callback_loop_(callback_loop) {} |
| 358 | 357 |
| 359 virtual void Run() { | 358 virtual void Run() { |
| 360 std::vector<webkit::npapi::WebPluginInfo> plugins; | 359 std::vector<WebPluginInfo> plugins; |
| 361 webkit::npapi::PluginList::Singleton()->GetPlugins(false, &plugins); | 360 NPAPI::PluginList::Singleton()->GetPlugins(false, &plugins); |
| 362 std::string hardware_class; // Empty string by default. | 361 std::string hardware_class; // Empty string by default. |
| 363 #if defined(OS_CHROMEOS) | 362 #if defined(OS_CHROMEOS) |
| 364 chromeos::SystemLibrary* system_library = | 363 chromeos::SystemLibrary* system_library = |
| 365 chromeos::CrosLibrary::Get()->GetSystemLibrary(); | 364 chromeos::CrosLibrary::Get()->GetSystemLibrary(); |
| 366 system_library->GetMachineStatistic("hardware_class", &hardware_class); | 365 system_library->GetMachineStatistic("hardware_class", &hardware_class); |
| 367 #endif // OS_CHROMEOS | 366 #endif // OS_CHROMEOS |
| 368 callback_loop_->PostTask(FROM_HERE, new InitTaskComplete( | 367 callback_loop_->PostTask(FROM_HERE, new InitTaskComplete( |
| 369 hardware_class, plugins)); | 368 hardware_class, plugins)); |
| 370 } | 369 } |
| 371 | 370 |
| 372 private: | 371 private: |
| 373 MessageLoop* callback_loop_; | 372 MessageLoop* callback_loop_; |
| 374 }; | 373 }; |
| 375 | 374 |
| (...skipping 419 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 795 UMA_HISTOGRAM_COUNTS_100("Chrome.CommandLineUncommonFlagCount", | 794 UMA_HISTOGRAM_COUNTS_100("Chrome.CommandLineUncommonFlagCount", |
| 796 command_line->GetSwitchCount() - common_commands); | 795 command_line->GetSwitchCount() - common_commands); |
| 797 | 796 |
| 798 // Kick off the process of saving the state (so the uptime numbers keep | 797 // Kick off the process of saving the state (so the uptime numbers keep |
| 799 // getting updated) every n minutes. | 798 // getting updated) every n minutes. |
| 800 ScheduleNextStateSave(); | 799 ScheduleNextStateSave(); |
| 801 } | 800 } |
| 802 | 801 |
| 803 void MetricsService::OnInitTaskComplete( | 802 void MetricsService::OnInitTaskComplete( |
| 804 const std::string& hardware_class, | 803 const std::string& hardware_class, |
| 805 const std::vector<webkit::npapi::WebPluginInfo>& plugins) { | 804 const std::vector<WebPluginInfo>& plugins) { |
| 806 DCHECK(state_ == INIT_TASK_SCHEDULED); | 805 DCHECK(state_ == INIT_TASK_SCHEDULED); |
| 807 hardware_class_ = hardware_class; | 806 hardware_class_ = hardware_class; |
| 808 plugins_ = plugins; | 807 plugins_ = plugins; |
| 809 if (state_ == INIT_TASK_SCHEDULED) | 808 if (state_ == INIT_TASK_SCHEDULED) |
| 810 state_ = INIT_TASK_DONE; | 809 state_ = INIT_TASK_DONE; |
| 811 } | 810 } |
| 812 | 811 |
| 813 std::string MetricsService::GenerateClientID() { | 812 std::string MetricsService::GenerateClientID() { |
| 814 return guid::GenerateGUID(); | 813 return guid::GenerateGUID(); |
| 815 } | 814 } |
| (...skipping 1093 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1909 thread_id = PlatformThread::CurrentId(); | 1908 thread_id = PlatformThread::CurrentId(); |
| 1910 return PlatformThread::CurrentId() == thread_id; | 1909 return 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 |