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

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

Issue 1021053003: Delivering the FIRST_NONEMPTY_PAINT phase changing event to base/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@phase_splitting
Patch Set: Integration Created 5 years, 8 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 #if !defined(OS_ANDROID) 5 #if !defined(OS_ANDROID)
6 6
7 #include "chrome/browser/metrics/first_web_contents_profiler.h" 7 #include "chrome/browser/metrics/first_web_contents_profiler.h"
8 8
9 #include "base/metrics/histogram_macros.h" 9 #include "base/metrics/histogram_macros.h"
10 #include "base/process/process_info.h" 10 #include "base/process/process_info.h"
11 #include "base/time/time.h" 11 #include "base/time/time.h"
12 #include "chrome/browser/ui/browser.h" 12 #include "chrome/browser/ui/browser.h"
13 #include "chrome/browser/ui/browser_iterator.h" 13 #include "chrome/browser/ui/browser_iterator.h"
14 #include "chrome/browser/ui/tabs/tab_strip_model.h" 14 #include "chrome/browser/ui/tabs/tab_strip_model.h"
15 #include "components/metrics/metrics_log.h"
16 #include "components/metrics/profiler/tracking_synchronizer.h"
15 17
16 scoped_ptr<FirstWebContentsProfiler> 18 scoped_ptr<FirstWebContentsProfiler>
17 FirstWebContentsProfiler::CreateProfilerForFirstWebContents( 19 FirstWebContentsProfiler::CreateProfilerForFirstWebContents(
18 Delegate* delegate) { 20 Delegate* delegate) {
19 DCHECK(delegate); 21 DCHECK(delegate);
20 for (chrome::BrowserIterator iterator; !iterator.done(); iterator.Next()) { 22 for (chrome::BrowserIterator iterator; !iterator.done(); iterator.Next()) {
21 Browser* browser = *iterator; 23 Browser* browser = *iterator;
22 content::WebContents* web_contents = 24 content::WebContents* web_contents =
23 browser->tab_strip_model()->GetActiveWebContents(); 25 browser->tab_strip_model()->GetActiveWebContents();
24 if (web_contents) { 26 if (web_contents) {
(...skipping 19 matching lines...) Expand all
44 return; 46 return;
45 47
46 collected_paint_metric_ = true; 48 collected_paint_metric_ = true;
47 if (!process_creation_time_.is_null()) { 49 if (!process_creation_time_.is_null()) {
48 base::TimeDelta elapsed = base::Time::Now() - process_creation_time_; 50 base::TimeDelta elapsed = base::Time::Now() - process_creation_time_;
49 51
50 UMA_HISTOGRAM_LONG_TIMES_100("Startup.FirstWebContents.NonEmptyPaint", 52 UMA_HISTOGRAM_LONG_TIMES_100("Startup.FirstWebContents.NonEmptyPaint",
51 elapsed); 53 elapsed);
52 } 54 }
53 55
56 metrics::TrackingSynchronizer::OnProfilingPhaseCompletion(
57 metrics::ProfilerEventProto::EVENT_FIRST_NONEMPTY_PAINT);
58
54 if (IsFinishedCollectingMetrics()) 59 if (IsFinishedCollectingMetrics())
55 FinishedCollectingMetrics(); 60 FinishedCollectingMetrics();
56 } 61 }
57 62
58 void FirstWebContentsProfiler::DocumentOnLoadCompletedInMainFrame() { 63 void FirstWebContentsProfiler::DocumentOnLoadCompletedInMainFrame() {
59 if (collected_load_metric_) 64 if (collected_load_metric_)
60 return; 65 return;
61 66
62 collected_load_metric_ = true; 67 collected_load_metric_ = true;
63 if (!process_creation_time_.is_null()) { 68 if (!process_creation_time_.is_null()) {
(...skipping 13 matching lines...) Expand all
77 82
78 bool FirstWebContentsProfiler::IsFinishedCollectingMetrics() { 83 bool FirstWebContentsProfiler::IsFinishedCollectingMetrics() {
79 return collected_paint_metric_ && collected_load_metric_; 84 return collected_paint_metric_ && collected_load_metric_;
80 } 85 }
81 86
82 void FirstWebContentsProfiler::FinishedCollectingMetrics() { 87 void FirstWebContentsProfiler::FinishedCollectingMetrics() {
83 delegate_->ProfilerFinishedCollectingMetrics(); 88 delegate_->ProfilerFinishedCollectingMetrics();
84 } 89 }
85 90
86 #endif // !defined(OS_ANDROID) 91 #endif // !defined(OS_ANDROID)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698