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

Side by Side Diff: third_party/WebKit/Source/core/loader/FrameLoader.cpp

Issue 2936723002: Report frequency of single page app navigations to UMA (Closed)
Patch Set: add helper function Created 3 years, 5 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
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/loader/FrameLoaderTypes.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights 2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights
3 * reserved. 3 * reserved.
4 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) 4 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
5 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. 5 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved.
6 * (http://www.torchmobile.com/) 6 * (http://www.torchmobile.com/)
7 * Copyright (C) 2008 Alp Toker <alp@atoker.com> 7 * Copyright (C) 2008 Alp Toker <alp@atoker.com>
8 * Copyright (C) Research In Motion Limited 2009. All rights reserved. 8 * Copyright (C) Research In Motion Limited 2009. All rights reserved.
9 * Copyright (C) 2011 Kris Jordan <krisjordan@gmail.com> 9 * Copyright (C) 2011 Kris Jordan <krisjordan@gmail.com>
10 * Copyright (C) 2011 Google Inc. All rights reserved. 10 * Copyright (C) 2011 Google Inc. All rights reserved.
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 #include "core/loader/ProgressTracker.h" 71 #include "core/loader/ProgressTracker.h"
72 #include "core/loader/appcache/ApplicationCacheHost.h" 72 #include "core/loader/appcache/ApplicationCacheHost.h"
73 #include "core/page/ChromeClient.h" 73 #include "core/page/ChromeClient.h"
74 #include "core/page/CreateWindow.h" 74 #include "core/page/CreateWindow.h"
75 #include "core/page/FrameTree.h" 75 #include "core/page/FrameTree.h"
76 #include "core/page/Page.h" 76 #include "core/page/Page.h"
77 #include "core/page/scrolling/ScrollingCoordinator.h" 77 #include "core/page/scrolling/ScrollingCoordinator.h"
78 #include "core/probe/CoreProbes.h" 78 #include "core/probe/CoreProbes.h"
79 #include "core/svg/graphics/SVGImage.h" 79 #include "core/svg/graphics/SVGImage.h"
80 #include "core/xml/parser/XMLDocumentParser.h" 80 #include "core/xml/parser/XMLDocumentParser.h"
81 #include "platform/Histogram.h"
81 #include "platform/InstanceCounters.h" 82 #include "platform/InstanceCounters.h"
82 #include "platform/PluginScriptForbiddenScope.h" 83 #include "platform/PluginScriptForbiddenScope.h"
83 #include "platform/ScriptForbiddenScope.h" 84 #include "platform/ScriptForbiddenScope.h"
84 #include "platform/WebFrameScheduler.h" 85 #include "platform/WebFrameScheduler.h"
85 #include "platform/bindings/DOMWrapperWorld.h" 86 #include "platform/bindings/DOMWrapperWorld.h"
86 #include "platform/instrumentation/tracing/TraceEvent.h" 87 #include "platform/instrumentation/tracing/TraceEvent.h"
87 #include "platform/loader/fetch/ResourceFetcher.h" 88 #include "platform/loader/fetch/ResourceFetcher.h"
88 #include "platform/loader/fetch/ResourceRequest.h" 89 #include "platform/loader/fetch/ResourceRequest.h"
89 #include "platform/network/HTTPParsers.h" 90 #include "platform/network/HTTPParsers.h"
90 #include "platform/network/NetworkUtils.h" 91 #include "platform/network/NetworkUtils.h"
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 !browser_side_navigation_enabled && 189 !browser_side_navigation_enabled &&
189 !frame->GetDocument()->GetContentSecurityPolicy()->AllowFormAction( 190 !frame->GetDocument()->GetContentSecurityPolicy()->AllowFormAction(
190 request.Url(), request.GetRedirectStatus(), 191 request.Url(), request.GetRedirectStatus(),
191 SecurityViolationReportingPolicy::kReport, check_header_type)) { 192 SecurityViolationReportingPolicy::kReport, check_header_type)) {
192 return kNavigationPolicyIgnore; 193 return kNavigationPolicyIgnore;
193 } 194 }
194 195
195 return policy; 196 return policy;
196 } 197 }
197 198
199 static SinglePageAppNavigationType CategorizeSinglePageAppNavigation(
Liquan (Max) Gu 2017/07/04 17:26:17 Helper function is created. Nothing functional is
200 SameDocumentNavigationSource same_document_navigation_source,
201 FrameLoadType frame_load_type) {
202 // |SinglePageAppNavigationType| falls into this grid according to different
203 // combinations of |FrameLoadType| and |SameDocumentNavigationSource|:
204 //
205 // HistoryApi Default
206 // kFrameLoadTypeBackForward illegal otherFragmentNav
207 // !kFrameLoadTypeBackForward sameDocBack/Forward historyPushOrReplace
208
209 switch (same_document_navigation_source) {
210 case kSameDocumentNavigationDefault:
211 if (frame_load_type == kFrameLoadTypeBackForward) {
212 return kSPANavTypeSameDocumentBackwardOrForward;
213 }
214 return kSPANavTypeOtherFragmentNavigation;
215 case kSameDocumentNavigationHistoryApi:
216 // It's illegal to have both kSameDocumentNavigationHistoryApi and
217 // kFrameLoadTypeBackForward.
218 DCHECK(frame_load_type != kFrameLoadTypeBackForward);
219 return kSPANavTypeHistoryPushStateOrReplaceState;
220 }
221 }
222
198 ResourceRequest FrameLoader::ResourceRequestForReload( 223 ResourceRequest FrameLoader::ResourceRequestForReload(
199 FrameLoadType frame_load_type, 224 FrameLoadType frame_load_type,
200 const KURL& override_url, 225 const KURL& override_url,
201 ClientRedirectPolicy client_redirect_policy) { 226 ClientRedirectPolicy client_redirect_policy) {
202 DCHECK(IsReloadLoadType(frame_load_type)); 227 DCHECK(IsReloadLoadType(frame_load_type));
203 WebCachePolicy cache_policy = 228 WebCachePolicy cache_policy =
204 frame_load_type == kFrameLoadTypeReloadBypassingCache 229 frame_load_type == kFrameLoadTypeReloadBypassingCache
205 ? WebCachePolicy::kBypassingCache 230 ? WebCachePolicy::kBypassingCache
206 : WebCachePolicy::kValidatingCacheData; 231 : WebCachePolicy::kValidatingCacheData;
207 if (!document_loader_ || !document_loader_->GetHistoryItem()) 232 if (!document_loader_ || !document_loader_->GetHistoryItem())
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after
484 return allowed; 509 return allowed;
485 } 510 }
486 511
487 void FrameLoader::UpdateForSameDocumentNavigation( 512 void FrameLoader::UpdateForSameDocumentNavigation(
488 const KURL& new_url, 513 const KURL& new_url,
489 SameDocumentNavigationSource same_document_navigation_source, 514 SameDocumentNavigationSource same_document_navigation_source,
490 PassRefPtr<SerializedScriptValue> data, 515 PassRefPtr<SerializedScriptValue> data,
491 HistoryScrollRestorationType scroll_restoration_type, 516 HistoryScrollRestorationType scroll_restoration_type,
492 FrameLoadType type, 517 FrameLoadType type,
493 Document* initiating_document) { 518 Document* initiating_document) {
519 SinglePageAppNavigationType single_page_app_navigation_type =
520 CategorizeSinglePageAppNavigation(same_document_navigation_source, type);
521 UMA_HISTOGRAM_ENUMERATION(
522 "RendererScheduler.UpdateForSameDocumentNavigationCount",
523 single_page_app_navigation_type, kSPANavTypeCount);
524
494 TRACE_EVENT1("blink", "FrameLoader::updateForSameDocumentNavigation", "url", 525 TRACE_EVENT1("blink", "FrameLoader::updateForSameDocumentNavigation", "url",
495 new_url.GetString().Ascii().data()); 526 new_url.GetString().Ascii().data());
496 527
497 // Generate start and stop notifications only when loader is completed so that 528 // Generate start and stop notifications only when loader is completed so that
498 // we don't fire them for fragment redirection that happens in window.onload 529 // we don't fire them for fragment redirection that happens in window.onload
499 // handler. See https://bugs.webkit.org/show_bug.cgi?id=31838 530 // handler. See https://bugs.webkit.org/show_bug.cgi?id=31838
500 // Do not fire the notifications if the frame is concurrently navigating away 531 // Do not fire the notifications if the frame is concurrently navigating away
501 // from the document, since a new document is already loading. 532 // from the document, since a new document is already loading.
502 bool was_loading = frame_->IsLoading(); 533 bool was_loading = frame_->IsLoading();
503 if (!was_loading) 534 if (!was_loading)
(...skipping 1195 matching lines...) Expand 10 before | Expand all | Expand 10 after
1699 // TODO(japhet): This is needed because the browser process DCHECKs if the 1730 // TODO(japhet): This is needed because the browser process DCHECKs if the
1700 // first entry we commit in a new frame has replacement set. It's unclear 1731 // first entry we commit in a new frame has replacement set. It's unclear
1701 // whether the DCHECK is right, investigate removing this special case. 1732 // whether the DCHECK is right, investigate removing this special case.
1702 bool replace_current_item = load_type == kFrameLoadTypeReplaceCurrentItem && 1733 bool replace_current_item = load_type == kFrameLoadTypeReplaceCurrentItem &&
1703 (!Opener() || !request.Url().IsEmpty()); 1734 (!Opener() || !request.Url().IsEmpty());
1704 loader->SetReplacesCurrentHistoryItem(replace_current_item); 1735 loader->SetReplacesCurrentHistoryItem(replace_current_item);
1705 return loader; 1736 return loader;
1706 } 1737 }
1707 1738
1708 } // namespace blink 1739 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/loader/FrameLoaderTypes.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698