Index: third_party/WebKit/Source/core/frame/LocalFrame.cpp |
diff --git a/third_party/WebKit/Source/core/frame/LocalFrame.cpp b/third_party/WebKit/Source/core/frame/LocalFrame.cpp |
index 57c4765081cc252bb1073a41379e3bf0d86f6413..2c34bdccc8e5ff0afe7a95ca276f629ac3800160 100644 |
--- a/third_party/WebKit/Source/core/frame/LocalFrame.cpp |
+++ b/third_party/WebKit/Source/core/frame/LocalFrame.cpp |
@@ -69,6 +69,7 @@ |
#include "core/paint/TransformRecorder.h" |
#include "core/svg/SVGDocumentExtensions.h" |
#include "platform/DragImage.h" |
+#include "platform/Histogram.h" |
#include "platform/JSONValues.h" |
#include "platform/PluginScriptForbiddenScope.h" |
#include "platform/RuntimeEnabledFeatures.h" |
@@ -217,6 +218,21 @@ inline float parentTextZoomFactor(LocalFrame* frame) |
return toLocalFrame(parent)->textZoomFactor(); |
} |
+// These are logged to UMA, so don't re-arrange them without creating a new histogram. |
+enum FrameStateForDeferredLoading { |
+ Created, |
+ WouldLoadBecauseVisible, |
+ // TODO(dgrogan): Add WouldLoadBecauseTopOrLeft, WouldLoadBecauseDisplayNone, etc |
+ |
+ FrameStateForDeferredLoadingEnd |
+}; |
+ |
+void RecordStateToHistogram(FrameStateForDeferredLoading state) |
+{ |
+ DEFINE_STATIC_LOCAL(EnumerationHistogram, unseenFrameHistogram, ("FrameLoading.Deferred.StateCountsV1", FrameStateForDeferredLoadingEnd)); |
+ unseenFrameHistogram.count(state); |
+} |
+ |
} // namespace |
template class CORE_TEMPLATE_EXPORT Supplement<LocalFrame>; |
@@ -806,6 +822,8 @@ inline LocalFrame::LocalFrame(FrameLoaderClient* client, FrameHost* host, FrameO |
, m_textZoomFactor(parentTextZoomFactor(this)) |
, m_inViewSourceMode(false) |
, m_interfaceProvider(interfaceProvider) |
+ , m_visibilityWasLogged(false) |
+ , m_creationWasLogged(false) |
{ |
if (isLocalRoot()) |
m_instrumentingAgents = new InstrumentingAgents(); |
@@ -837,6 +855,23 @@ PluginData* LocalFrame::pluginData() const |
return page()->pluginData(); |
} |
+void LocalFrame::didInstallNewDocument() |
+{ |
+ if (!m_creationWasLogged && isCrossOriginSubframe()) { |
dgrogan
2016/08/19 23:56:23
installNewDocument is called twice when an iframe
dcheng
2016/08/22 07:00:29
When a frame is first created, it always starts on
dgrogan
2016/08/22 23:38:09
You're right. This function is now only called whe
|
+ m_creationWasLogged = true; |
+ RecordStateToHistogram(Created); |
+ } |
+} |
+ |
+void LocalFrame::onVisibilityMaybeChanged(bool visible) |
+{ |
+ if (visible && !m_visibilityWasLogged && isCrossOriginSubframe()) { |
+ DCHECK(m_creationWasLogged); |
dgrogan
2016/08/22 23:38:09
This was racy.
|
+ m_visibilityWasLogged = true; |
+ RecordStateToHistogram(WouldLoadBecauseVisible); |
+ } |
+} |
+ |
DEFINE_WEAK_IDENTIFIER_MAP(LocalFrame); |
FrameNavigationDisabler::FrameNavigationDisabler(LocalFrame& frame) |