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

Unified Diff: content/browser/frame_host/navigator_impl.cc

Issue 2398753002: Record UMA stats for subframes history navigations. (Closed)
Patch Set: Created 4 years, 2 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 side-by-side diff with in-line comments
Download patch
Index: content/browser/frame_host/navigator_impl.cc
diff --git a/content/browser/frame_host/navigator_impl.cc b/content/browser/frame_host/navigator_impl.cc
index 93063b600cffe3aa9c0ea574b67ebeebd58a6a09..02a0e91289e7eadc43b34f764dcda42fea46e952 100644
--- a/content/browser/frame_host/navigator_impl.cc
+++ b/content/browser/frame_host/navigator_impl.cc
@@ -8,6 +8,7 @@
#include "base/logging.h"
#include "base/metrics/histogram_macros.h"
+#include "base/strings/string_util.h"
#include "base/time/time.h"
#include "content/browser/frame_host/debug_urls.h"
#include "content/browser/frame_host/frame_tree.h"
@@ -444,7 +445,8 @@ bool NavigatorImpl::NavigateToPendingEntry(
}
bool NavigatorImpl::NavigateNewChildFrame(
- RenderFrameHostImpl* render_frame_host) {
+ RenderFrameHostImpl* render_frame_host,
+ const GURL& default_url) {
NavigationEntryImpl* entry =
controller_->GetEntryWithUniqueID(render_frame_host->nav_entry_id());
if (!entry)
@@ -455,6 +457,26 @@ bool NavigatorImpl::NavigateNewChildFrame(
if (!frame_entry)
return false;
+ // Track how often history navigations load a different URL into a subframe
+ // than the frame's default URL.
+ bool restoring_different_url = frame_entry->url() != default_url;
+ UMA_HISTOGRAM_BOOLEAN("SessionRestore.RestoredDifferentSubframeURL",
+ restoring_different_url);
Charlie Reis 2016/10/05 19:32:04 I thought I'd include this while we're at it, sinc
+ // If this frame's unique name uses a frame path, record the name length.
+ // If these names are long in practice, then a proposed plan to truncate
+ // unique names might affect restore behavior, since it is complex to deal
+ // with truncated names inside frame paths.
+ if (restoring_different_url) {
+ const std::string& unique_name =
+ render_frame_host->frame_tree_node()->unique_name();
+ const char kFramePathPrefix[] = "<!--framePath ";
+ if (base::StartsWith(unique_name, kFramePathPrefix,
+ base::CompareCase::SENSITIVE)) {
+ UMA_HISTOGRAM_COUNTS("SessionRestore.RestoreSubframeFramePathLength",
+ unique_name.size());
+ }
+ }
+
return NavigateToEntry(render_frame_host->frame_tree_node(), *frame_entry,
*entry, ReloadType::NONE, false, true, false, nullptr);
}

Powered by Google App Engine
This is Rietveld 408576698