OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/logging.h" | 7 #include "base/logging.h" |
8 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
9 #include "base/metrics/histogram.h" | 9 #include "base/metrics/histogram.h" |
10 #include "build/build_config.h" | 10 #include "build/build_config.h" |
11 #include "chrome/browser/browser_process.h" | 11 #include "chrome/browser/browser_process.h" |
12 #include "chrome/browser/browser_shutdown.h" | 12 #include "chrome/browser/browser_shutdown.h" |
13 #include "chrome/browser/download/download_service.h" | 13 #include "chrome/browser/download/download_service.h" |
14 #include "chrome/browser/metrics/thread_watcher.h" | 14 #include "chrome/browser/metrics/thread_watcher.h" |
15 #include "chrome/browser/prefs/pref_service.h" | 15 #include "chrome/browser/prefs/pref_service.h" |
16 #include "chrome/browser/printing/background_printing_manager.h" | 16 #include "chrome/browser/printing/background_printing_manager.h" |
17 #include "chrome/browser/profiles/profile_manager.h" | 17 #include "chrome/browser/profiles/profile_manager.h" |
18 #include "chrome/browser/ui/browser_window.h" | 18 #include "chrome/browser/ui/browser_window.h" |
19 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" | 19 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" |
20 #include "chrome/common/chrome_notification_types.h" | 20 #include "chrome/common/chrome_notification_types.h" |
21 #include "chrome/common/pref_names.h" | 21 #include "chrome/common/pref_names.h" |
22 #include "content/browser/renderer_host/render_process_host.h" | |
23 #include "content/browser/tab_contents/navigation_details.h" | 22 #include "content/browser/tab_contents/navigation_details.h" |
24 #include "content/public/browser/notification_registrar.h" | 23 #include "content/public/browser/notification_registrar.h" |
25 #include "content/public/browser/notification_service.h" | 24 #include "content/public/browser/notification_service.h" |
| 25 #include "content/public/browser/render_process_host.h" |
26 #include "content/public/common/result_codes.h" | 26 #include "content/public/common/result_codes.h" |
27 | 27 |
28 #if defined(OS_MACOSX) | 28 #if defined(OS_MACOSX) |
29 #include "chrome/browser/chrome_browser_application_mac.h" | 29 #include "chrome/browser/chrome_browser_application_mac.h" |
30 #endif | 30 #endif |
31 | 31 |
32 #if defined(OS_CHROMEOS) | 32 #if defined(OS_CHROMEOS) |
33 #include "chrome/browser/chromeos/boot_times_loader.h" | 33 #include "chrome/browser/chromeos/boot_times_loader.h" |
34 #include "chrome/browser/chromeos/cros/cros_library.h" | 34 #include "chrome/browser/chromeos/cros/cros_library.h" |
35 #include "chrome/browser/chromeos/cros/update_library.h" | 35 #include "chrome/browser/chromeos/cros/update_library.h" |
(...skipping 29 matching lines...) Expand all Loading... |
65 if (!load.is_navigation_to_different_page()) | 65 if (!load.is_navigation_to_different_page()) |
66 return; // Don't log for subframes or other trivial types. | 66 return; // Don't log for subframes or other trivial types. |
67 | 67 |
68 LogRenderProcessHostCount(); | 68 LogRenderProcessHostCount(); |
69 LogBrowserTabCount(); | 69 LogBrowserTabCount(); |
70 } | 70 } |
71 | 71 |
72 // Counts the number of active RenderProcessHosts and logs them. | 72 // Counts the number of active RenderProcessHosts and logs them. |
73 void LogRenderProcessHostCount() const { | 73 void LogRenderProcessHostCount() const { |
74 int hosts_count = 0; | 74 int hosts_count = 0; |
75 for (RenderProcessHost::iterator i(RenderProcessHost::AllHostsIterator()); | 75 for (content::RenderProcessHost::iterator i( |
| 76 content::RenderProcessHost::AllHostsIterator()); |
76 !i.IsAtEnd(); i.Advance()) | 77 !i.IsAtEnd(); i.Advance()) |
77 ++hosts_count; | 78 ++hosts_count; |
78 UMA_HISTOGRAM_CUSTOM_COUNTS("MPArch.RPHCountPerLoad", hosts_count, | 79 UMA_HISTOGRAM_CUSTOM_COUNTS("MPArch.RPHCountPerLoad", hosts_count, |
79 1, 50, 50); | 80 1, 50, 50); |
80 } | 81 } |
81 | 82 |
82 // Counts the number of tabs in each browser window and logs them. This is | 83 // Counts the number of tabs in each browser window and logs them. This is |
83 // different than the number of TabContents objects since TabContents objects | 84 // different than the number of TabContents objects since TabContents objects |
84 // can be used for popups and in dialog boxes. We're just counting toplevel | 85 // can be used for popups and in dialog boxes. We're just counting toplevel |
85 // tabs here. | 86 // tabs here. |
(...skipping 770 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
856 // If no more TabContents from Browsers, check the BackgroundPrintingManager. | 857 // If no more TabContents from Browsers, check the BackgroundPrintingManager. |
857 while (bg_printing_iterator_ != GetBackgroundPrintingManager()->end()) { | 858 while (bg_printing_iterator_ != GetBackgroundPrintingManager()->end()) { |
858 cur_ = *bg_printing_iterator_; | 859 cur_ = *bg_printing_iterator_; |
859 CHECK(cur_); | 860 CHECK(cur_); |
860 ++bg_printing_iterator_; | 861 ++bg_printing_iterator_; |
861 return; | 862 return; |
862 } | 863 } |
863 // Reached the end - no more TabContents. | 864 // Reached the end - no more TabContents. |
864 cur_ = NULL; | 865 cur_ = NULL; |
865 } | 866 } |
OLD | NEW |