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

Side by Side Diff: content/browser/frame_host/navigation_controller_impl.cc

Issue 253333003: Add a histogram for size of the memory used by redirect chain. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 7 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "content/browser/frame_host/navigation_controller_impl.h" 5 #include "content/browser/frame_host/navigation_controller_impl.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/debug/trace_event.h" 8 #include "base/debug/trace_event.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/metrics/histogram.h"
10 #include "base/strings/string_number_conversions.h" // Temporary 11 #include "base/strings/string_number_conversions.h" // Temporary
11 #include "base/strings/string_util.h" 12 #include "base/strings/string_util.h"
12 #include "base/strings/utf_string_conversions.h" 13 #include "base/strings/utf_string_conversions.h"
13 #include "base/time/time.h" 14 #include "base/time/time.h"
14 #include "content/browser/browser_url_handler_impl.h" 15 #include "content/browser/browser_url_handler_impl.h"
15 #include "content/browser/dom_storage/dom_storage_context_wrapper.h" 16 #include "content/browser/dom_storage/dom_storage_context_wrapper.h"
16 #include "content/browser/dom_storage/session_storage_namespace_impl.h" 17 #include "content/browser/dom_storage/session_storage_namespace_impl.h"
17 #include "content/browser/frame_host/debug_urls.h" 18 #include "content/browser/frame_host/debug_urls.h"
18 #include "content/browser/frame_host/interstitial_page_impl.h" 19 #include "content/browser/frame_host/interstitial_page_impl.h"
19 #include "content/browser/frame_host/navigation_entry_impl.h" 20 #include "content/browser/frame_host/navigation_entry_impl.h"
(...skipping 797 matching lines...) Expand 10 before | Expand all | Expand 10 after
817 // All committed entries should have nonempty content state so WebKit doesn't 818 // All committed entries should have nonempty content state so WebKit doesn't
818 // get confused when we go back to them (see the function for details). 819 // get confused when we go back to them (see the function for details).
819 DCHECK(params.page_state.IsValid()); 820 DCHECK(params.page_state.IsValid());
820 NavigationEntryImpl* active_entry = 821 NavigationEntryImpl* active_entry =
821 NavigationEntryImpl::FromNavigationEntry(GetLastCommittedEntry()); 822 NavigationEntryImpl::FromNavigationEntry(GetLastCommittedEntry());
822 active_entry->SetTimestamp(timestamp); 823 active_entry->SetTimestamp(timestamp);
823 active_entry->SetHttpStatusCode(params.http_status_code); 824 active_entry->SetHttpStatusCode(params.http_status_code);
824 active_entry->SetPageState(params.page_state); 825 active_entry->SetPageState(params.page_state);
825 active_entry->SetRedirectChain(params.redirects); 826 active_entry->SetRedirectChain(params.redirects);
826 827
828 // Use histogram to track memory impact of redirect chain because it's now
829 // not cleared for committed entries.
830 size_t redirect_chain_size = 0;
831 for (size_t i = 0; i < params.redirects.size(); ++i) {
832 redirect_chain_size += params.redirects[i].spec().length();
833 }
834 UMA_HISTOGRAM_COUNTS("Navigation.RedirectChainSize", redirect_chain_size);
835
827 // Once it is committed, we no longer need to track several pieces of state on 836 // Once it is committed, we no longer need to track several pieces of state on
828 // the entry. 837 // the entry.
829 active_entry->ResetForCommit(); 838 active_entry->ResetForCommit();
830 839
831 // The active entry's SiteInstance should match our SiteInstance. 840 // The active entry's SiteInstance should match our SiteInstance.
832 // TODO(creis): This check won't pass for subframes until we create entries 841 // TODO(creis): This check won't pass for subframes until we create entries
833 // for subframe navigations. 842 // for subframe navigations.
834 if (PageTransitionIsMainFrame(params.transition)) 843 if (PageTransitionIsMainFrame(params.transition))
835 CHECK(active_entry->site_instance() == rfh->GetSiteInstance()); 844 CHECK(active_entry->site_instance() == rfh->GetSiteInstance());
836 845
(...skipping 903 matching lines...) Expand 10 before | Expand all | Expand 10 after
1740 } 1749 }
1741 } 1750 }
1742 } 1751 }
1743 1752
1744 void NavigationControllerImpl::SetGetTimestampCallbackForTest( 1753 void NavigationControllerImpl::SetGetTimestampCallbackForTest(
1745 const base::Callback<base::Time()>& get_timestamp_callback) { 1754 const base::Callback<base::Time()>& get_timestamp_callback) {
1746 get_timestamp_callback_ = get_timestamp_callback; 1755 get_timestamp_callback_ = get_timestamp_callback;
1747 } 1756 }
1748 1757
1749 } // namespace content 1758 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | tools/metrics/histograms/histograms.xml » ('j') | tools/metrics/histograms/histograms.xml » ('J')

Powered by Google App Engine
This is Rietveld 408576698