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

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: Update SPA categories 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
« no previous file with comments | « no previous file | third_party/WebKit/Source/web/tests/WebFrameTest.cpp » ('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 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
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 enum SinglePageAppNavigationType {
494 kSPANavTypeHistoryPushStateOrReplaceState = 0,
495 kSPANavTypeSameDocumentBackwardOrForward = 1,
496 kSPANavTypeOtherFragmentNavigation = 2,
497 kSPANavTypeCount = kSPANavTypeOtherFragmentNavigation + 1,
498 };
499 const char* histogramName =
500 "RendererScheduler.UpdateForSameDocumentNavigationCount";
501 if (same_document_navigation_source == kSameDocumentNavigationHistoryApi) {
Liquan (Max) Gu 2017/06/16 17:37:35 Can I assume that these three conditions are exclu
502 UMA_HISTOGRAM_ENUMERATION(histogramName,
503 kSPANavTypeHistoryPushStateOrReplaceState,
504 kSPANavTypeCount);
505 }
506 if (type == kFrameLoadTypeBackForward) {
507 UMA_HISTOGRAM_ENUMERATION(histogramName,
508 kSPANavTypeSameDocumentBackwardOrForward,
509 kSPANavTypeCount);
510 }
511 if (same_document_navigation_source == kSameDocumentNavigationDefault &&
512 type != kFrameLoadTypeBackForward) {
513 UMA_HISTOGRAM_ENUMERATION(histogramName, kSPANavTypeOtherFragmentNavigation,
514 kSPANavTypeCount);
515 }
516
487 TRACE_EVENT1("blink", "FrameLoader::updateForSameDocumentNavigation", "url", 517 TRACE_EVENT1("blink", "FrameLoader::updateForSameDocumentNavigation", "url",
488 new_url.GetString().Ascii().data()); 518 new_url.GetString().Ascii().data());
489 519
490 // Generate start and stop notifications only when loader is completed so that 520 // 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 521 // 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 522 // handler. See https://bugs.webkit.org/show_bug.cgi?id=31838
493 // Do not fire the notifications if the frame is concurrently navigating away 523 // Do not fire the notifications if the frame is concurrently navigating away
494 // from the document, since a new document is already loading. 524 // from the document, since a new document is already loading.
495 if (frame_->GetDocument()->LoadEventFinished() && 525 if (frame_->GetDocument()->LoadEventFinished() &&
496 !provisional_document_loader_) 526 !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 1714 // 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 1715 // 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. 1716 // whether the DCHECK is right, investigate removing this special case.
1687 bool replace_current_item = load_type == kFrameLoadTypeReplaceCurrentItem && 1717 bool replace_current_item = load_type == kFrameLoadTypeReplaceCurrentItem &&
1688 (!Opener() || !request.Url().IsEmpty()); 1718 (!Opener() || !request.Url().IsEmpty());
1689 loader->SetReplacesCurrentHistoryItem(replace_current_item); 1719 loader->SetReplacesCurrentHistoryItem(replace_current_item);
1690 return loader; 1720 return loader;
1691 } 1721 }
1692 1722
1693 } // namespace blink 1723 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/web/tests/WebFrameTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698