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 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
258 | 258 |
259 display_count_ = gfx::Screen::GetNativeScreen()->GetNumDisplays(); | 259 display_count_ = gfx::Screen::GetNativeScreen()->GetNumDisplays(); |
260 UMA_HISTOGRAM_COUNTS_100("Hardware.Display.Count.OnStartup", display_count_); | 260 UMA_HISTOGRAM_COUNTS_100("Hardware.Display.Count.OnStartup", display_count_); |
261 gfx::Screen::GetNativeScreen()->AddObserver(this); | 261 gfx::Screen::GetNativeScreen()->AddObserver(this); |
262 is_screen_observer_ = true; | 262 is_screen_observer_ = true; |
263 | 263 |
264 #if !defined(OS_ANDROID) | 264 #if !defined(OS_ANDROID) |
265 first_web_contents_profiler_ = | 265 first_web_contents_profiler_ = |
266 FirstWebContentsProfiler::CreateProfilerForFirstWebContents(this).Pass(); | 266 FirstWebContentsProfiler::CreateProfilerForFirstWebContents(this).Pass(); |
267 #endif // !defined(OS_ANDROID) | 267 #endif // !defined(OS_ANDROID) |
268 if (!first_web_contents_profiler_) | |
269 chrome::SetBrowserStartupIsComplete(); | |
268 } | 270 } |
269 | 271 |
270 void ChromeBrowserMainExtraPartsMetrics::OnDisplayAdded( | 272 void ChromeBrowserMainExtraPartsMetrics::OnDisplayAdded( |
271 const gfx::Display& new_display) { | 273 const gfx::Display& new_display) { |
272 EmitDisplaysChangedMetric(); | 274 EmitDisplaysChangedMetric(); |
273 } | 275 } |
274 | 276 |
275 void ChromeBrowserMainExtraPartsMetrics::OnDisplayRemoved( | 277 void ChromeBrowserMainExtraPartsMetrics::OnDisplayRemoved( |
276 const gfx::Display& old_display) { | 278 const gfx::Display& old_display) { |
277 EmitDisplaysChangedMetric(); | 279 EmitDisplaysChangedMetric(); |
278 } | 280 } |
279 | 281 |
280 void ChromeBrowserMainExtraPartsMetrics::OnDisplayMetricsChanged( | 282 void ChromeBrowserMainExtraPartsMetrics::OnDisplayMetricsChanged( |
281 const gfx::Display& display, | 283 const gfx::Display& display, |
282 uint32_t changed_metrics) { | 284 uint32_t changed_metrics) { |
283 } | 285 } |
284 | 286 |
285 void ChromeBrowserMainExtraPartsMetrics::ProfilerFinishedCollectingMetrics() { | 287 void ChromeBrowserMainExtraPartsMetrics::ProfilerFinishedCollectingMetrics() { |
286 first_web_contents_profiler_.reset(); | 288 first_web_contents_profiler_.reset(); |
289 | |
290 // TODO(michaeln): Revisit this in light of session restore, for now | |
291 // claim complete after the first page loads. | |
292 chrome::SetBrowserStartupIsComplete(); | |
gab
2015/03/10 15:00:32
Doesn't feel like ExtraPartsMetrics is the right p
michaeln
2015/03/10 19:46:26
Ditto any guidance.
I picked this location becaus
gab
2015/03/10 19:55:27
Then perhaps put it directly in FirstWebContentsPr
michaeln
2015/03/20 00:21:27
I put it directly into ChromeBrowserMainParts, not
| |
287 } | 293 } |
288 | 294 |
289 void ChromeBrowserMainExtraPartsMetrics::EmitDisplaysChangedMetric() { | 295 void ChromeBrowserMainExtraPartsMetrics::EmitDisplaysChangedMetric() { |
290 int display_count = gfx::Screen::GetNativeScreen()->GetNumDisplays(); | 296 int display_count = gfx::Screen::GetNativeScreen()->GetNumDisplays(); |
291 if (display_count != display_count_) { | 297 if (display_count != display_count_) { |
292 display_count_ = display_count; | 298 display_count_ = display_count; |
293 UMA_HISTOGRAM_COUNTS_100("Hardware.Display.Count.OnChange", display_count_); | 299 UMA_HISTOGRAM_COUNTS_100("Hardware.Display.Count.OnChange", display_count_); |
294 } | 300 } |
295 } | 301 } |
296 | 302 |
297 namespace chrome { | 303 namespace chrome { |
298 | 304 |
299 void AddMetricsExtraParts(ChromeBrowserMainParts* main_parts) { | 305 void AddMetricsExtraParts(ChromeBrowserMainParts* main_parts) { |
300 main_parts->AddParts(new ChromeBrowserMainExtraPartsMetrics()); | 306 main_parts->AddParts(new ChromeBrowserMainExtraPartsMetrics()); |
301 } | 307 } |
302 | 308 |
303 } // namespace chrome | 309 } // namespace chrome |
OLD | NEW |