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

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

Issue 2398753002: Record UMA stats for subframes history navigations. (Closed)
Patch Set: Fix nits 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 unified diff | Download patch
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/navigator_impl.h" 5 #include "content/browser/frame_host/navigator_impl.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/metrics/histogram_macros.h" 10 #include "base/metrics/histogram_macros.h"
11 #include "base/strings/string_util.h"
11 #include "base/time/time.h" 12 #include "base/time/time.h"
12 #include "content/browser/frame_host/debug_urls.h" 13 #include "content/browser/frame_host/debug_urls.h"
13 #include "content/browser/frame_host/frame_tree.h" 14 #include "content/browser/frame_host/frame_tree.h"
14 #include "content/browser/frame_host/frame_tree_node.h" 15 #include "content/browser/frame_host/frame_tree_node.h"
15 #include "content/browser/frame_host/navigation_controller_impl.h" 16 #include "content/browser/frame_host/navigation_controller_impl.h"
16 #include "content/browser/frame_host/navigation_entry_impl.h" 17 #include "content/browser/frame_host/navigation_entry_impl.h"
17 #include "content/browser/frame_host/navigation_handle_impl.h" 18 #include "content/browser/frame_host/navigation_handle_impl.h"
18 #include "content/browser/frame_host/navigation_request.h" 19 #include "content/browser/frame_host/navigation_request.h"
19 #include "content/browser/frame_host/navigation_request_info.h" 20 #include "content/browser/frame_host/navigation_request_info.h"
20 #include "content/browser/frame_host/navigator_delegate.h" 21 #include "content/browser/frame_host/navigator_delegate.h"
(...skipping 416 matching lines...) Expand 10 before | Expand all | Expand 10 after
437 FrameTreeNode* frame_tree_node, 438 FrameTreeNode* frame_tree_node,
438 const FrameNavigationEntry& frame_entry, 439 const FrameNavigationEntry& frame_entry,
439 ReloadType reload_type, 440 ReloadType reload_type,
440 bool is_same_document_history_load) { 441 bool is_same_document_history_load) {
441 return NavigateToEntry(frame_tree_node, frame_entry, 442 return NavigateToEntry(frame_tree_node, frame_entry,
442 *controller_->GetPendingEntry(), reload_type, 443 *controller_->GetPendingEntry(), reload_type,
443 is_same_document_history_load, false, true, nullptr); 444 is_same_document_history_load, false, true, nullptr);
444 } 445 }
445 446
446 bool NavigatorImpl::NavigateNewChildFrame( 447 bool NavigatorImpl::NavigateNewChildFrame(
447 RenderFrameHostImpl* render_frame_host) { 448 RenderFrameHostImpl* render_frame_host,
449 const GURL& default_url) {
448 NavigationEntryImpl* entry = 450 NavigationEntryImpl* entry =
449 controller_->GetEntryWithUniqueID(render_frame_host->nav_entry_id()); 451 controller_->GetEntryWithUniqueID(render_frame_host->nav_entry_id());
450 if (!entry) 452 if (!entry)
451 return false; 453 return false;
452 454
453 FrameNavigationEntry* frame_entry = 455 FrameNavigationEntry* frame_entry =
454 entry->GetFrameEntry(render_frame_host->frame_tree_node()); 456 entry->GetFrameEntry(render_frame_host->frame_tree_node());
455 if (!frame_entry) 457 if (!frame_entry)
456 return false; 458 return false;
457 459
460 // Track how often history navigations load a different URL into a subframe
461 // than the frame's default URL.
462 bool restoring_different_url = frame_entry->url() != default_url;
463 UMA_HISTOGRAM_BOOLEAN("SessionRestore.RestoredSubframeURL",
464 restoring_different_url);
465 // If this frame's unique name uses a frame path, record the name length.
466 // If these names are long in practice, then a proposed plan to truncate
467 // unique names might affect restore behavior, since it is complex to deal
468 // with truncated names inside frame paths.
469 if (restoring_different_url) {
470 const std::string& unique_name =
471 render_frame_host->frame_tree_node()->unique_name();
472 const char kFramePathPrefix[] = "<!--framePath ";
473 if (base::StartsWith(unique_name, kFramePathPrefix,
474 base::CompareCase::SENSITIVE)) {
475 UMA_HISTOGRAM_COUNTS("SessionRestore.RestoreSubframeFramePathLength",
476 unique_name.size());
477 }
478 }
479
458 return NavigateToEntry(render_frame_host->frame_tree_node(), *frame_entry, 480 return NavigateToEntry(render_frame_host->frame_tree_node(), *frame_entry,
459 *entry, ReloadType::NONE, false, true, false, nullptr); 481 *entry, ReloadType::NONE, false, true, false, nullptr);
460 } 482 }
461 483
462 void NavigatorImpl::DidNavigate( 484 void NavigatorImpl::DidNavigate(
463 RenderFrameHostImpl* render_frame_host, 485 RenderFrameHostImpl* render_frame_host,
464 const FrameHostMsg_DidCommitProvisionalLoad_Params& params) { 486 const FrameHostMsg_DidCommitProvisionalLoad_Params& params) {
465 FrameTree* frame_tree = render_frame_host->frame_tree_node()->frame_tree(); 487 FrameTree* frame_tree = render_frame_host->frame_tree_node()->frame_tree();
466 bool oopifs_possible = SiteIsolationPolicy::AreCrossProcessFramesPossible(); 488 bool oopifs_possible = SiteIsolationPolicy::AreCrossProcessFramesPossible();
467 489
(...skipping 733 matching lines...) Expand 10 before | Expand all | Expand 10 after
1201 if (navigation_handle) 1223 if (navigation_handle)
1202 navigation_handle->update_entry_id_for_transfer(entry->GetUniqueID()); 1224 navigation_handle->update_entry_id_for_transfer(entry->GetUniqueID());
1203 1225
1204 controller_->SetPendingEntry(std::move(entry)); 1226 controller_->SetPendingEntry(std::move(entry));
1205 if (delegate_) 1227 if (delegate_)
1206 delegate_->NotifyChangedNavigationState(content::INVALIDATE_TYPE_URL); 1228 delegate_->NotifyChangedNavigationState(content::INVALIDATE_TYPE_URL);
1207 } 1229 }
1208 } 1230 }
1209 1231
1210 } // namespace content 1232 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/frame_host/navigator_impl.h ('k') | content/browser/frame_host/render_frame_host_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698