Index: third_party/WebKit/Source/core/loader/FrameLoader.cpp |
diff --git a/third_party/WebKit/Source/core/loader/FrameLoader.cpp b/third_party/WebKit/Source/core/loader/FrameLoader.cpp |
index 23b058dc70155aed38401d5d15f0860ebd8d6adb..a99a75e90d185f7aaa0a7df98d4877b91cb92ec1 100644 |
--- a/third_party/WebKit/Source/core/loader/FrameLoader.cpp |
+++ b/third_party/WebKit/Source/core/loader/FrameLoader.cpp |
@@ -79,6 +79,7 @@ |
#include "core/probe/CoreProbes.h" |
#include "core/svg/graphics/SVGImage.h" |
#include "core/xml/parser/XMLDocumentParser.h" |
+#include "platform/Histogram.h" |
#include "platform/InstanceCounters.h" |
#include "platform/PluginScriptForbiddenScope.h" |
#include "platform/ScriptForbiddenScope.h" |
@@ -484,6 +485,35 @@ void FrameLoader::UpdateForSameDocumentNavigation( |
HistoryScrollRestorationType scroll_restoration_type, |
FrameLoadType type, |
Document* initiating_document) { |
+ // This enum is used to index different kinds of single-page-application |
+ // navigations for UMA enum histogram. New enum values can be added, but |
+ // existing enums must never be renumbered or deleted and reused. |
+ // This enum should be consistent with SinglePageAppNavigationType in |
+ // tools/metrics/histograms/enums. |
+ enum SinglePageAppNavigationType { |
+ kSPANavTypeHistoryPushStateOrReplaceState = 0, |
+ kSPANavTypeSameDocumentBackwardOrForward = 1, |
+ kSPANavTypeOtherFragmentNavigation = 2, |
+ kSPANavTypeCount = kSPANavTypeOtherFragmentNavigation + 1, |
+ }; |
+ const char* histogramName = |
+ "RendererScheduler.UpdateForSameDocumentNavigationCount"; |
+ if (same_document_navigation_source == kSameDocumentNavigationHistoryApi) { |
Liquan (Max) Gu
2017/06/16 17:37:35
Can I assume that these three conditions are exclu
|
+ UMA_HISTOGRAM_ENUMERATION(histogramName, |
+ kSPANavTypeHistoryPushStateOrReplaceState, |
+ kSPANavTypeCount); |
+ } |
+ if (type == kFrameLoadTypeBackForward) { |
+ UMA_HISTOGRAM_ENUMERATION(histogramName, |
+ kSPANavTypeSameDocumentBackwardOrForward, |
+ kSPANavTypeCount); |
+ } |
+ if (same_document_navigation_source == kSameDocumentNavigationDefault && |
+ type != kFrameLoadTypeBackForward) { |
+ UMA_HISTOGRAM_ENUMERATION(histogramName, kSPANavTypeOtherFragmentNavigation, |
+ kSPANavTypeCount); |
+ } |
+ |
TRACE_EVENT1("blink", "FrameLoader::updateForSameDocumentNavigation", "url", |
new_url.GetString().Ascii().data()); |