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