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