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

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 DCHECK, remove others as a category Created 3 years, 6 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 /* 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 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 #include "core/loader/ProgressTracker.h" 72 #include "core/loader/ProgressTracker.h"
73 #include "core/loader/appcache/ApplicationCacheHost.h" 73 #include "core/loader/appcache/ApplicationCacheHost.h"
74 #include "core/page/ChromeClient.h" 74 #include "core/page/ChromeClient.h"
75 #include "core/page/CreateWindow.h" 75 #include "core/page/CreateWindow.h"
76 #include "core/page/FrameTree.h" 76 #include "core/page/FrameTree.h"
77 #include "core/page/Page.h" 77 #include "core/page/Page.h"
78 #include "core/page/scrolling/ScrollingCoordinator.h" 78 #include "core/page/scrolling/ScrollingCoordinator.h"
79 #include "core/probe/CoreProbes.h" 79 #include "core/probe/CoreProbes.h"
80 #include "core/svg/graphics/SVGImage.h" 80 #include "core/svg/graphics/SVGImage.h"
81 #include "core/xml/parser/XMLDocumentParser.h" 81 #include "core/xml/parser/XMLDocumentParser.h"
82 #include "platform/Histogram.h"
82 #include "platform/InstanceCounters.h" 83 #include "platform/InstanceCounters.h"
83 #include "platform/PluginScriptForbiddenScope.h" 84 #include "platform/PluginScriptForbiddenScope.h"
84 #include "platform/ScriptForbiddenScope.h" 85 #include "platform/ScriptForbiddenScope.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"
91 #include "platform/scroll/ScrollAnimatorBase.h" 92 #include "platform/scroll/ScrollAnimatorBase.h"
(...skipping 385 matching lines...) Expand 10 before | Expand all | Expand 10 after
477 return allowed; 478 return allowed;
478 } 479 }
479 480
480 void FrameLoader::UpdateForSameDocumentNavigation( 481 void FrameLoader::UpdateForSameDocumentNavigation(
481 const KURL& new_url, 482 const KURL& new_url,
482 SameDocumentNavigationSource same_document_navigation_source, 483 SameDocumentNavigationSource same_document_navigation_source,
483 PassRefPtr<SerializedScriptValue> data, 484 PassRefPtr<SerializedScriptValue> data,
484 HistoryScrollRestorationType scroll_restoration_type, 485 HistoryScrollRestorationType scroll_restoration_type,
485 FrameLoadType type, 486 FrameLoadType type,
486 Document* initiating_document) { 487 Document* initiating_document) {
488 // This enum is used to index different kinds of single-page-application
Nate Chapin 2017/06/21 18:05:24 Could we put this all of this logging in a helper?
Liquan (Max) Gu 2017/06/26 14:52:21 By 'all of this logging' do you mean the big switc
489 // navigations for UMA enum histogram. New enum values can be added, but
490 // existing enums must never be renumbered or deleted and reused.
491 // This enum should be consistent with SinglePageAppNavigationType in
492 // tools/metrics/histograms/enums.
493 //
494 // |SinglePageAppNavigationType| falls into this grid according to different
495 // combinations of |FrameLoadType| and |SameDocumentNavigationSource|:
496 //
497 // HistoryApi Default
498 // kFrameLoadTypeBackForward illegal 1
499 // !kFrameLoadTypeBackForward 0 2
500 enum SinglePageAppNavigationType {
tdresser 2017/06/21 14:45:00 We'd normally define the enum outside of this meth
Liquan (Max) Gu 2017/06/26 14:52:21 Good idea.
501 kSPANavTypeHistoryPushStateOrReplaceState = 0,
502 kSPANavTypeSameDocumentBackwardOrForward = 1,
503 kSPANavTypeOtherFragmentNavigation = 2,
504 kSPANavTypeCount
505 };
506 SinglePageAppNavigationType single_page_app_navigation_type;
507 switch (same_document_navigation_source) {
508 case kSameDocumentNavigationDefault:
509 if (type == kFrameLoadTypeBackForward) {
510 single_page_app_navigation_type =
511 kSPANavTypeSameDocumentBackwardOrForward;
512 } else {
513 single_page_app_navigation_type = kSPANavTypeOtherFragmentNavigation;
514 }
515 break;
516 case kSameDocumentNavigationHistoryApi:
517 // It's illegal to have both kSameDocumentNavigationHistoryApi and
518 // kFrameLoadTypeBackForward.
519 DCHECK(type != kFrameLoadTypeBackForward);
520 single_page_app_navigation_type =
521 kSPANavTypeHistoryPushStateOrReplaceState;
522 }
523 UMA_HISTOGRAM_ENUMERATION(
524 "RendererScheduler.UpdateForSameDocumentNavigationCount",
525 single_page_app_navigation_type, kSPANavTypeCount);
526
487 TRACE_EVENT1("blink", "FrameLoader::updateForSameDocumentNavigation", "url", 527 TRACE_EVENT1("blink", "FrameLoader::updateForSameDocumentNavigation", "url",
488 new_url.GetString().Ascii().data()); 528 new_url.GetString().Ascii().data());
489 529
490 // Generate start and stop notifications only when loader is completed so that 530 // Generate start and stop notifications only when loader is completed so that
491 // we don't fire them for fragment redirection that happens in window.onload 531 // we don't fire them for fragment redirection that happens in window.onload
492 // handler. See https://bugs.webkit.org/show_bug.cgi?id=31838 532 // handler. See https://bugs.webkit.org/show_bug.cgi?id=31838
493 // Do not fire the notifications if the frame is concurrently navigating away 533 // Do not fire the notifications if the frame is concurrently navigating away
494 // from the document, since a new document is already loading. 534 // from the document, since a new document is already loading.
495 if (frame_->GetDocument()->LoadEventFinished() && 535 if (frame_->GetDocument()->LoadEventFinished() &&
496 !provisional_document_loader_) 536 !provisional_document_loader_)
(...skipping 1187 matching lines...) Expand 10 before | Expand all | Expand 10 after
1684 // TODO(japhet): This is needed because the browser process DCHECKs if the 1724 // TODO(japhet): This is needed because the browser process DCHECKs if the
1685 // first entry we commit in a new frame has replacement set. It's unclear 1725 // first entry we commit in a new frame has replacement set. It's unclear
1686 // whether the DCHECK is right, investigate removing this special case. 1726 // whether the DCHECK is right, investigate removing this special case.
1687 bool replace_current_item = load_type == kFrameLoadTypeReplaceCurrentItem && 1727 bool replace_current_item = load_type == kFrameLoadTypeReplaceCurrentItem &&
1688 (!Opener() || !request.Url().IsEmpty()); 1728 (!Opener() || !request.Url().IsEmpty());
1689 loader->SetReplacesCurrentHistoryItem(replace_current_item); 1729 loader->SetReplacesCurrentHistoryItem(replace_current_item);
1690 return loader; 1730 return loader;
1691 } 1731 }
1692 1732
1693 } // namespace blink 1733 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698