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..86bb0881353d9c7fdbc5a8da10c32415cc03b565 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, ("DeferredFrameLoading.StatesV1", 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,22 @@ PluginData* LocalFrame::pluginData() const |
return page()->pluginData(); |
} |
+void LocalFrame::didInstallNewRealDocument() |
+{ |
+ if (!m_creationWasLogged && isCrossOriginSubframe()) { |
+ m_creationWasLogged = true; |
+ RecordStateToHistogram(Created); |
+ } |
+} |
+ |
+void LocalFrame::onVisibilityMaybeChanged(bool visible) |
+{ |
+ if (visible && !m_visibilityWasLogged && isCrossOriginSubframe()) { |
+ m_visibilityWasLogged = true; |
+ RecordStateToHistogram(WouldLoadBecauseVisible); |
+ } |
+} |
+ |
DEFINE_WEAK_IDENTIFIER_MAP(LocalFrame); |
FrameNavigationDisabler::FrameNavigationDisabler(LocalFrame& frame) |