OLD | NEW |
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/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/debug/trace_event.h" | 9 #include "base/debug/trace_event.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
| 11 #include "base/metrics/histogram.h" |
11 #include "base/strings/string_number_conversions.h" // Temporary | 12 #include "base/strings/string_number_conversions.h" // Temporary |
12 #include "base/strings/string_util.h" | 13 #include "base/strings/string_util.h" |
13 #include "base/strings/utf_string_conversions.h" | 14 #include "base/strings/utf_string_conversions.h" |
14 #include "base/time/time.h" | 15 #include "base/time/time.h" |
15 #include "cc/base/switches.h" | 16 #include "cc/base/switches.h" |
16 #include "content/browser/browser_url_handler_impl.h" | 17 #include "content/browser/browser_url_handler_impl.h" |
17 #include "content/browser/dom_storage/dom_storage_context_wrapper.h" | 18 #include "content/browser/dom_storage/dom_storage_context_wrapper.h" |
18 #include "content/browser/dom_storage/session_storage_namespace_impl.h" | 19 #include "content/browser/dom_storage/session_storage_namespace_impl.h" |
19 #include "content/browser/frame_host/debug_urls.h" | 20 #include "content/browser/frame_host/debug_urls.h" |
20 #include "content/browser/frame_host/interstitial_page_impl.h" | 21 #include "content/browser/frame_host/interstitial_page_impl.h" |
(...skipping 798 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
819 // All committed entries should have nonempty content state so WebKit doesn't | 820 // All committed entries should have nonempty content state so WebKit doesn't |
820 // get confused when we go back to them (see the function for details). | 821 // get confused when we go back to them (see the function for details). |
821 DCHECK(params.page_state.IsValid()); | 822 DCHECK(params.page_state.IsValid()); |
822 NavigationEntryImpl* active_entry = | 823 NavigationEntryImpl* active_entry = |
823 NavigationEntryImpl::FromNavigationEntry(GetLastCommittedEntry()); | 824 NavigationEntryImpl::FromNavigationEntry(GetLastCommittedEntry()); |
824 active_entry->SetTimestamp(timestamp); | 825 active_entry->SetTimestamp(timestamp); |
825 active_entry->SetHttpStatusCode(params.http_status_code); | 826 active_entry->SetHttpStatusCode(params.http_status_code); |
826 active_entry->SetPageState(params.page_state); | 827 active_entry->SetPageState(params.page_state); |
827 active_entry->SetRedirectChain(params.redirects); | 828 active_entry->SetRedirectChain(params.redirects); |
828 | 829 |
| 830 // Use histogram to track memory impact of redirect chain because it's now |
| 831 // not cleared for committed entries. |
| 832 size_t redirect_chain_size = 0; |
| 833 for (size_t i = 0; i < params.redirects.size(); ++i) { |
| 834 redirect_chain_size += params.redirects[i].spec().length(); |
| 835 } |
| 836 UMA_HISTOGRAM_COUNTS("Navigation.RedirectChainSize", redirect_chain_size); |
| 837 |
829 // Once it is committed, we no longer need to track several pieces of state on | 838 // Once it is committed, we no longer need to track several pieces of state on |
830 // the entry. | 839 // the entry. |
831 active_entry->ResetForCommit(); | 840 active_entry->ResetForCommit(); |
832 | 841 |
833 // The active entry's SiteInstance should match our SiteInstance. | 842 // The active entry's SiteInstance should match our SiteInstance. |
834 // TODO(creis): This check won't pass for subframes until we create entries | 843 // TODO(creis): This check won't pass for subframes until we create entries |
835 // for subframe navigations. | 844 // for subframe navigations. |
836 if (PageTransitionIsMainFrame(params.transition)) | 845 if (PageTransitionIsMainFrame(params.transition)) |
837 CHECK(active_entry->site_instance() == rfh->GetSiteInstance()); | 846 CHECK(active_entry->site_instance() == rfh->GetSiteInstance()); |
838 | 847 |
(...skipping 913 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1752 } | 1761 } |
1753 } | 1762 } |
1754 } | 1763 } |
1755 | 1764 |
1756 void NavigationControllerImpl::SetGetTimestampCallbackForTest( | 1765 void NavigationControllerImpl::SetGetTimestampCallbackForTest( |
1757 const base::Callback<base::Time()>& get_timestamp_callback) { | 1766 const base::Callback<base::Time()>& get_timestamp_callback) { |
1758 get_timestamp_callback_ = get_timestamp_callback; | 1767 get_timestamp_callback_ = get_timestamp_callback; |
1759 } | 1768 } |
1760 | 1769 |
1761 } // namespace content | 1770 } // namespace content |
OLD | NEW |