Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 #include "chrome/browser/metrics/chrome_browser_main_extra_parts_metrics.h" | 5 #include "chrome/browser/metrics/chrome_browser_main_extra_parts_metrics.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 335 content::BrowserThread::GetBlockingPool()->PostDelayedTask( | 335 content::BrowserThread::GetBlockingPool()->PostDelayedTask( |
| 336 FROM_HERE, | 336 FROM_HERE, |
| 337 base::Bind(&RecordStartupMetricsOnBlockingPool), | 337 base::Bind(&RecordStartupMetricsOnBlockingPool), |
| 338 base::TimeDelta::FromSeconds(kStartupMetricsGatheringDelaySeconds)); | 338 base::TimeDelta::FromSeconds(kStartupMetricsGatheringDelaySeconds)); |
| 339 | 339 |
| 340 display_count_ = gfx::Screen::GetNativeScreen()->GetNumDisplays(); | 340 display_count_ = gfx::Screen::GetNativeScreen()->GetNumDisplays(); |
| 341 UMA_HISTOGRAM_COUNTS_100("Hardware.Display.Count.OnStartup", display_count_); | 341 UMA_HISTOGRAM_COUNTS_100("Hardware.Display.Count.OnStartup", display_count_); |
| 342 gfx::Screen::GetNativeScreen()->AddObserver(this); | 342 gfx::Screen::GetNativeScreen()->AddObserver(this); |
| 343 is_screen_observer_ = true; | 343 is_screen_observer_ = true; |
| 344 | 344 |
| 345 #if !defined(OS_ANDROID) | 345 #if !defined(OS_ANDROID) && !defined(OS_IOS) |
|
gab
2015/09/30 14:39:43
Does iOS even compile this file? I thought iOS did
Lei Zhang
2015/09/30 23:33:55
iOS still have not finished fully removing their c
| |
| 346 first_web_contents_profiler_ = | 346 first_web_contents_profiler_ = |
|
Lei Zhang
2015/09/30 06:40:09
Already never created on mobile.
| |
| 347 FirstWebContentsProfiler::CreateProfilerForFirstWebContents(this).Pass(); | 347 FirstWebContentsProfiler::CreateProfilerForFirstWebContents(this).Pass(); |
| 348 #endif // !defined(OS_ANDROID) | 348 #endif // !defined(OS_ANDROID) && !defined(OS_IOS) |
| 349 } | 349 } |
| 350 | 350 |
| 351 void ChromeBrowserMainExtraPartsMetrics::OnDisplayAdded( | 351 void ChromeBrowserMainExtraPartsMetrics::OnDisplayAdded( |
| 352 const gfx::Display& new_display) { | 352 const gfx::Display& new_display) { |
| 353 EmitDisplaysChangedMetric(); | 353 EmitDisplaysChangedMetric(); |
| 354 } | 354 } |
| 355 | 355 |
| 356 void ChromeBrowserMainExtraPartsMetrics::OnDisplayRemoved( | 356 void ChromeBrowserMainExtraPartsMetrics::OnDisplayRemoved( |
| 357 const gfx::Display& old_display) { | 357 const gfx::Display& old_display) { |
| 358 EmitDisplaysChangedMetric(); | 358 EmitDisplaysChangedMetric(); |
| 359 } | 359 } |
| 360 | 360 |
| 361 void ChromeBrowserMainExtraPartsMetrics::OnDisplayMetricsChanged( | 361 void ChromeBrowserMainExtraPartsMetrics::OnDisplayMetricsChanged( |
| 362 const gfx::Display& display, | 362 const gfx::Display& display, |
| 363 uint32_t changed_metrics) { | 363 uint32_t changed_metrics) { |
| 364 } | 364 } |
| 365 | 365 |
| 366 #if !defined(OS_ANDROID) && !defined(OS_IOS) | |
| 366 void ChromeBrowserMainExtraPartsMetrics::ProfilerFinishedCollectingMetrics() { | 367 void ChromeBrowserMainExtraPartsMetrics::ProfilerFinishedCollectingMetrics() { |
| 367 first_web_contents_profiler_.reset(); | 368 first_web_contents_profiler_.reset(); |
| 368 } | 369 } |
| 370 #endif // !defined(OS_ANDROID) && !defined(OS_IOS) | |
| 369 | 371 |
| 370 void ChromeBrowserMainExtraPartsMetrics::EmitDisplaysChangedMetric() { | 372 void ChromeBrowserMainExtraPartsMetrics::EmitDisplaysChangedMetric() { |
| 371 int display_count = gfx::Screen::GetNativeScreen()->GetNumDisplays(); | 373 int display_count = gfx::Screen::GetNativeScreen()->GetNumDisplays(); |
| 372 if (display_count != display_count_) { | 374 if (display_count != display_count_) { |
| 373 display_count_ = display_count; | 375 display_count_ = display_count; |
| 374 UMA_HISTOGRAM_COUNTS_100("Hardware.Display.Count.OnChange", display_count_); | 376 UMA_HISTOGRAM_COUNTS_100("Hardware.Display.Count.OnChange", display_count_); |
| 375 } | 377 } |
| 376 } | 378 } |
| 377 | 379 |
| 378 namespace chrome { | 380 namespace chrome { |
| 379 | 381 |
| 380 void AddMetricsExtraParts(ChromeBrowserMainParts* main_parts) { | 382 void AddMetricsExtraParts(ChromeBrowserMainParts* main_parts) { |
| 381 main_parts->AddParts(new ChromeBrowserMainExtraPartsMetrics()); | 383 main_parts->AddParts(new ChromeBrowserMainExtraPartsMetrics()); |
| 382 } | 384 } |
| 383 | 385 |
| 384 } // namespace chrome | 386 } // namespace chrome |
| OLD | NEW |