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

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

Issue 1644773003: Remove BrowserIterator (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@host-desktop-1
Patch Set: . Created 4 years, 10 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 <string> 9 #include <string>
10 10
11 #include "base/location.h" 11 #include "base/location.h"
12 #include "base/logging.h" 12 #include "base/logging.h"
13 #include "base/metrics/histogram_macros.h" 13 #include "base/metrics/histogram_macros.h"
14 #include "base/time/time.h" 14 #include "base/time/time.h"
15 #include "build/build_config.h" 15 #include "build/build_config.h"
16 #include "chrome/browser/ui/browser.h" 16 #include "chrome/browser/ui/browser.h"
17 #include "chrome/browser/ui/browser_iterator.h" 17 #include "chrome/browser/ui/browser_list.h"
18 #include "chrome/browser/ui/tabs/tab_strip_model.h" 18 #include "chrome/browser/ui/tabs/tab_strip_model.h"
19 #include "components/metrics/profiler/tracking_synchronizer.h" 19 #include "components/metrics/profiler/tracking_synchronizer.h"
20 #include "components/metrics/proto/profiler_event.pb.h" 20 #include "components/metrics/proto/profiler_event.pb.h"
21 #include "components/startup_metric_utils/browser/startup_metric_utils.h" 21 #include "components/startup_metric_utils/browser/startup_metric_utils.h"
22 #include "content/public/browser/navigation_handle.h" 22 #include "content/public/browser/navigation_handle.h"
23 23
24 // static 24 // static
25 void FirstWebContentsProfiler::Start() { 25 void FirstWebContentsProfiler::Start() {
26 for (chrome::BrowserIterator browser_it; !browser_it.done(); 26 for (auto* browser : *BrowserList::GetInstance()) {
27 browser_it.Next()) {
28 content::WebContents* web_contents = 27 content::WebContents* web_contents =
29 browser_it->tab_strip_model()->GetActiveWebContents(); 28 browser->tab_strip_model()->GetActiveWebContents();
30 if (web_contents) { 29 if (web_contents) {
31 // FirstWebContentsProfiler owns itself and is also bound to 30 // FirstWebContentsProfiler owns itself and is also bound to
32 // |web_contents|'s lifetime by observing WebContentsDestroyed(). 31 // |web_contents|'s lifetime by observing WebContentsDestroyed().
33 new FirstWebContentsProfiler(web_contents); 32 new FirstWebContentsProfiler(web_contents);
34 return; 33 return;
35 } 34 }
36 } 35 }
37 } 36 }
38 37
39 FirstWebContentsProfiler::FirstWebContentsProfiler( 38 FirstWebContentsProfiler::FirstWebContentsProfiler(
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 } 155 }
157 if (!collected_load_metric_) { 156 if (!collected_load_metric_) {
158 UMA_HISTOGRAM_ENUMERATION("Startup.FirstWebContents.FinishReason_NoLoad", 157 UMA_HISTOGRAM_ENUMERATION("Startup.FirstWebContents.FinishReason_NoLoad",
159 finish_reason, FinishReason::ENUM_MAX); 158 finish_reason, FinishReason::ENUM_MAX);
160 } 159 }
161 160
162 delete this; 161 delete this;
163 } 162 }
164 163
165 #endif // !defined(OS_ANDROID) 164 #endif // !defined(OS_ANDROID)
OLDNEW
« no previous file with comments | « chrome/browser/memory/tab_manager.cc ('k') | chrome/browser/profile_resetter/profile_resetter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698