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

Side by Side Diff: chrome/browser/ui/browser_list.cc

Issue 10105030: TabContents -> WebContentsImpl, part 21. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 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 | Annotate | Revision Log
« no previous file with comments | « chrome/browser/ui/browser_list.h ('k') | chrome/browser/ui/browser_navigator.h » ('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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/ui/browser_list.h" 5 #include "chrome/browser/ui/browser_list.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/message_loop.h" 9 #include "base/message_loop.h"
10 #include "base/metrics/histogram.h" 10 #include "base/metrics/histogram.h"
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 int hosts_count = 0; 78 int hosts_count = 0;
79 for (content::RenderProcessHost::iterator i( 79 for (content::RenderProcessHost::iterator i(
80 content::RenderProcessHost::AllHostsIterator()); 80 content::RenderProcessHost::AllHostsIterator());
81 !i.IsAtEnd(); i.Advance()) 81 !i.IsAtEnd(); i.Advance())
82 ++hosts_count; 82 ++hosts_count;
83 UMA_HISTOGRAM_CUSTOM_COUNTS("MPArch.RPHCountPerLoad", hosts_count, 83 UMA_HISTOGRAM_CUSTOM_COUNTS("MPArch.RPHCountPerLoad", hosts_count,
84 1, 50, 50); 84 1, 50, 50);
85 } 85 }
86 86
87 // Counts the number of tabs in each browser window and logs them. This is 87 // Counts the number of tabs in each browser window and logs them. This is
88 // different than the number of TabContents objects since TabContents objects 88 // different than the number of WebContents objects since WebContents objects
89 // can be used for popups and in dialog boxes. We're just counting toplevel 89 // can be used for popups and in dialog boxes. We're just counting toplevel
90 // tabs here. 90 // tabs here.
91 void LogBrowserTabCount() const { 91 void LogBrowserTabCount() const {
92 int tab_count = 0; 92 int tab_count = 0;
93 for (BrowserList::const_iterator browser_iterator = BrowserList::begin(); 93 for (BrowserList::const_iterator browser_iterator = BrowserList::begin();
94 browser_iterator != BrowserList::end(); browser_iterator++) { 94 browser_iterator != BrowserList::end(); browser_iterator++) {
95 // Record how many tabs each window has open. 95 // Record how many tabs each window has open.
96 UMA_HISTOGRAM_CUSTOM_COUNTS("Tabs.TabCountPerWindow", 96 UMA_HISTOGRAM_CUSTOM_COUNTS("Tabs.TabCountPerWindow",
97 (*browser_iterator)->tab_count(), 1, 200, 50); 97 (*browser_iterator)->tab_count(), 1, 200, 50);
98 tab_count += (*browser_iterator)->tab_count(); 98 tab_count += (*browser_iterator)->tab_count();
(...skipping 749 matching lines...) Expand 10 before | Expand all | Expand 10 after
848 848
849 TabContentsIterator::TabContentsIterator() 849 TabContentsIterator::TabContentsIterator()
850 : browser_iterator_(BrowserList::begin()), 850 : browser_iterator_(BrowserList::begin()),
851 web_view_index_(-1), 851 web_view_index_(-1),
852 bg_printing_iterator_(GetBackgroundPrintingManager()->begin()), 852 bg_printing_iterator_(GetBackgroundPrintingManager()->begin()),
853 cur_(NULL) { 853 cur_(NULL) {
854 Advance(); 854 Advance();
855 } 855 }
856 856
857 void TabContentsIterator::Advance() { 857 void TabContentsIterator::Advance() {
858 // The current TabContents should be valid unless we are at the beginning. 858 // The current WebContents should be valid unless we are at the beginning.
859 DCHECK(cur_ || (web_view_index_ == -1 && 859 DCHECK(cur_ || (web_view_index_ == -1 &&
860 browser_iterator_ == BrowserList::begin())) 860 browser_iterator_ == BrowserList::begin()))
861 << "Trying to advance past the end"; 861 << "Trying to advance past the end";
862 862
863 // Update cur_ to the next TabContents in the list. 863 // Update cur_ to the next WebContents in the list.
864 while (browser_iterator_ != BrowserList::end()) { 864 while (browser_iterator_ != BrowserList::end()) {
865 if (++web_view_index_ >= (*browser_iterator_)->tab_count()) { 865 if (++web_view_index_ >= (*browser_iterator_)->tab_count()) {
866 // Advance to the next Browser in the list. 866 // Advance to the next Browser in the list.
867 ++browser_iterator_; 867 ++browser_iterator_;
868 web_view_index_ = -1; 868 web_view_index_ = -1;
869 continue; 869 continue;
870 } 870 }
871 871
872 TabContentsWrapper* next_tab = 872 TabContentsWrapper* next_tab =
873 (*browser_iterator_)->GetTabContentsWrapperAt(web_view_index_); 873 (*browser_iterator_)->GetTabContentsWrapperAt(web_view_index_);
874 if (next_tab) { 874 if (next_tab) {
875 cur_ = next_tab; 875 cur_ = next_tab;
876 return; 876 return;
877 } 877 }
878 } 878 }
879 // If no more TabContents from Browsers, check the BackgroundPrintingManager. 879 // If no more WebContents from Browsers, check the BackgroundPrintingManager.
880 while (bg_printing_iterator_ != GetBackgroundPrintingManager()->end()) { 880 while (bg_printing_iterator_ != GetBackgroundPrintingManager()->end()) {
881 cur_ = *bg_printing_iterator_; 881 cur_ = *bg_printing_iterator_;
882 CHECK(cur_); 882 CHECK(cur_);
883 ++bg_printing_iterator_; 883 ++bg_printing_iterator_;
884 return; 884 return;
885 } 885 }
886 // Reached the end - no more TabContents. 886 // Reached the end - no more WebContents.
887 cur_ = NULL; 887 cur_ = NULL;
888 } 888 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/browser_list.h ('k') | chrome/browser/ui/browser_navigator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698