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

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

Issue 7648017: Make WebPluginInfo more generic (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 4 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
« no previous file with comments | « chrome/browser/metrics/metrics_service.h ('k') | chrome/browser/pdf_unsupported_feature.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
184 #include "chrome/common/chrome_notification_types.h" 184 #include "chrome/common/chrome_notification_types.h"
185 #include "chrome/common/chrome_switches.h" 185 #include "chrome/common/chrome_switches.h"
186 #include "chrome/common/guid.h" 186 #include "chrome/common/guid.h"
187 #include "chrome/common/pref_names.h" 187 #include "chrome/common/pref_names.h"
188 #include "chrome/common/render_messages.h" 188 #include "chrome/common/render_messages.h"
189 #include "content/browser/load_notification_details.h" 189 #include "content/browser/load_notification_details.h"
190 #include "content/browser/renderer_host/render_process_host.h" 190 #include "content/browser/renderer_host/render_process_host.h"
191 #include "content/common/child_process_info.h" 191 #include "content/common/child_process_info.h"
192 #include "content/common/notification_service.h" 192 #include "content/common/notification_service.h"
193 #include "webkit/plugins/npapi/plugin_list.h" 193 #include "webkit/plugins/npapi/plugin_list.h"
194 #include "webkit/plugins/npapi/webplugininfo.h" 194 #include "webkit/plugins/webplugininfo.h"
195 195
196 // TODO(port): port browser_distribution.h. 196 // TODO(port): port browser_distribution.h.
197 #if !defined(OS_POSIX) 197 #if !defined(OS_POSIX)
198 #include "chrome/installer/util/browser_distribution.h" 198 #include "chrome/installer/util/browser_distribution.h"
199 #endif 199 #endif
200 200
201 #if defined(OS_CHROMEOS) 201 #if defined(OS_CHROMEOS)
202 #include "chrome/browser/chromeos/cros/cros_library.h" 202 #include "chrome/browser/chromeos/cros/cros_library.h"
203 #include "chrome/browser/chromeos/external_metrics.h" 203 #include "chrome/browser/chromeos/external_metrics.h"
204 #include "chrome/browser/chromeos/system/statistics_provider.h" 204 #include "chrome/browser/chromeos/system/statistics_provider.h"
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
314 ~MetricsMemoryDetails() {} 314 ~MetricsMemoryDetails() {}
315 315
316 Task* completion_; 316 Task* completion_;
317 DISALLOW_COPY_AND_ASSIGN(MetricsMemoryDetails); 317 DISALLOW_COPY_AND_ASSIGN(MetricsMemoryDetails);
318 }; 318 };
319 319
320 class MetricsService::InitTaskComplete : public Task { 320 class MetricsService::InitTaskComplete : public Task {
321 public: 321 public:
322 explicit InitTaskComplete( 322 explicit InitTaskComplete(
323 const std::string& hardware_class, 323 const std::string& hardware_class,
324 const std::vector<webkit::npapi::WebPluginInfo>& plugins) 324 const std::vector<webkit::WebPluginInfo>& plugins)
325 : hardware_class_(hardware_class), plugins_(plugins) {} 325 : hardware_class_(hardware_class), plugins_(plugins) {}
326 326
327 virtual void Run() { 327 virtual void Run() {
328 g_browser_process->metrics_service()->OnInitTaskComplete( 328 g_browser_process->metrics_service()->OnInitTaskComplete(
329 hardware_class_, plugins_); 329 hardware_class_, plugins_);
330 } 330 }
331 331
332 private: 332 private:
333 std::string hardware_class_; 333 std::string hardware_class_;
334 std::vector<webkit::npapi::WebPluginInfo> plugins_; 334 std::vector<webkit::WebPluginInfo> plugins_;
335 }; 335 };
336 336
337 class MetricsService::InitTask : public Task { 337 class MetricsService::InitTask : public Task {
338 public: 338 public:
339 explicit InitTask(MessageLoop* callback_loop) 339 explicit InitTask(MessageLoop* callback_loop)
340 : callback_loop_(callback_loop) {} 340 : callback_loop_(callback_loop) {}
341 341
342 virtual void Run() { 342 virtual void Run() {
343 std::vector<webkit::npapi::WebPluginInfo> plugins; 343 std::vector<webkit::WebPluginInfo> plugins;
344 webkit::npapi::PluginList::Singleton()->GetPlugins(&plugins); 344 webkit::npapi::PluginList::Singleton()->GetPlugins(&plugins);
345 std::string hardware_class; // Empty string by default. 345 std::string hardware_class; // Empty string by default.
346 #if defined(OS_CHROMEOS) 346 #if defined(OS_CHROMEOS)
347 chromeos::system::StatisticsProvider::GetInstance()->GetMachineStatistic( 347 chromeos::system::StatisticsProvider::GetInstance()->GetMachineStatistic(
348 "hardware_class", &hardware_class); 348 "hardware_class", &hardware_class);
349 #endif // OS_CHROMEOS 349 #endif // OS_CHROMEOS
350 callback_loop_->PostTask(FROM_HERE, new InitTaskComplete( 350 callback_loop_->PostTask(FROM_HERE, new InitTaskComplete(
351 hardware_class, plugins)); 351 hardware_class, plugins));
352 } 352 }
353 353
(...skipping 433 matching lines...) Expand 10 before | Expand all | Expand 10 after
787 UMA_HISTOGRAM_COUNTS_100("Chrome.CommandLineUncommonFlagCount", 787 UMA_HISTOGRAM_COUNTS_100("Chrome.CommandLineUncommonFlagCount",
788 switch_count - common_commands); 788 switch_count - common_commands);
789 789
790 // Kick off the process of saving the state (so the uptime numbers keep 790 // Kick off the process of saving the state (so the uptime numbers keep
791 // getting updated) every n minutes. 791 // getting updated) every n minutes.
792 ScheduleNextStateSave(); 792 ScheduleNextStateSave();
793 } 793 }
794 794
795 void MetricsService::OnInitTaskComplete( 795 void MetricsService::OnInitTaskComplete(
796 const std::string& hardware_class, 796 const std::string& hardware_class,
797 const std::vector<webkit::npapi::WebPluginInfo>& plugins) { 797 const std::vector<webkit::WebPluginInfo>& plugins) {
798 DCHECK(state_ == INIT_TASK_SCHEDULED); 798 DCHECK(state_ == INIT_TASK_SCHEDULED);
799 hardware_class_ = hardware_class; 799 hardware_class_ = hardware_class;
800 plugins_ = plugins; 800 plugins_ = plugins;
801 io_thread_ = g_browser_process->io_thread(); 801 io_thread_ = g_browser_process->io_thread();
802 if (state_ == INIT_TASK_SCHEDULED) 802 if (state_ == INIT_TASK_SCHEDULED)
803 state_ = INIT_TASK_DONE; 803 state_ = INIT_TASK_DONE;
804 } 804 }
805 805
806 std::string MetricsService::GenerateClientID() { 806 std::string MetricsService::GenerateClientID() {
807 return guid::GenerateGUID(); 807 return guid::GenerateGUID();
(...skipping 885 matching lines...) Expand 10 before | Expand all | Expand 10 after
1693 thread_id = base::PlatformThread::CurrentId(); 1693 thread_id = base::PlatformThread::CurrentId();
1694 return base::PlatformThread::CurrentId() == thread_id; 1694 return base::PlatformThread::CurrentId() == thread_id;
1695 } 1695 }
1696 1696
1697 #if defined(OS_CHROMEOS) 1697 #if defined(OS_CHROMEOS)
1698 void MetricsService::StartExternalMetrics() { 1698 void MetricsService::StartExternalMetrics() {
1699 external_metrics_ = new chromeos::ExternalMetrics; 1699 external_metrics_ = new chromeos::ExternalMetrics;
1700 external_metrics_->Start(); 1700 external_metrics_->Start();
1701 } 1701 }
1702 #endif 1702 #endif
OLDNEW
« no previous file with comments | « chrome/browser/metrics/metrics_service.h ('k') | chrome/browser/pdf_unsupported_feature.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698