| 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" |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 ~BrowserActivityObserver() {} | 46 ~BrowserActivityObserver() {} |
| 47 | 47 |
| 48 private: | 48 private: |
| 49 // NotificationObserver implementation. | 49 // NotificationObserver implementation. |
| 50 virtual void Observe(NotificationType type, | 50 virtual void Observe(NotificationType type, |
| 51 const NotificationSource& source, | 51 const NotificationSource& source, |
| 52 const NotificationDetails& details) { | 52 const NotificationDetails& details) { |
| 53 DCHECK(type == NotificationType::NAV_ENTRY_COMMITTED); | 53 DCHECK(type == NotificationType::NAV_ENTRY_COMMITTED); |
| 54 const content::LoadCommittedDetails& load = | 54 const content::LoadCommittedDetails& load = |
| 55 *Details<content::LoadCommittedDetails>(details).ptr(); | 55 *Details<content::LoadCommittedDetails>(details).ptr(); |
| 56 if (!load.is_main_frame || load.is_auto || load.is_in_page) | 56 if (!load.is_navigation_to_different_page()) |
| 57 return; // Don't log for subframes or other trivial types. | 57 return; // Don't log for subframes or other trivial types. |
| 58 | 58 |
| 59 LogRenderProcessHostCount(); | 59 LogRenderProcessHostCount(); |
| 60 LogBrowserTabCount(); | 60 LogBrowserTabCount(); |
| 61 } | 61 } |
| 62 | 62 |
| 63 // Counts the number of active RenderProcessHosts and logs them. | 63 // Counts the number of active RenderProcessHosts and logs them. |
| 64 void LogRenderProcessHostCount() const { | 64 void LogRenderProcessHostCount() const { |
| 65 int hosts_count = 0; | 65 int hosts_count = 0; |
| 66 for (RenderProcessHost::iterator i(RenderProcessHost::AllHostsIterator()); | 66 for (RenderProcessHost::iterator i(RenderProcessHost::AllHostsIterator()); |
| (...skipping 603 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 670 // If no more TabContents from Browsers, check the BackgroundPrintingManager. | 670 // If no more TabContents from Browsers, check the BackgroundPrintingManager. |
| 671 while (bg_printing_iterator_ != GetBackgroundPrintingManager()->end()) { | 671 while (bg_printing_iterator_ != GetBackgroundPrintingManager()->end()) { |
| 672 cur_ = *bg_printing_iterator_; | 672 cur_ = *bg_printing_iterator_; |
| 673 CHECK(cur_); | 673 CHECK(cur_); |
| 674 ++bg_printing_iterator_; | 674 ++bg_printing_iterator_; |
| 675 return; | 675 return; |
| 676 } | 676 } |
| 677 // Reached the end - no more TabContents. | 677 // Reached the end - no more TabContents. |
| 678 cur_ = NULL; | 678 cur_ = NULL; |
| 679 } | 679 } |
| OLD | NEW |