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

Unified Diff: third_party/WebKit/Source/core/frame/LocalFrame.cpp

Issue 2212183004: Log to UMA when x-origin frames (1) are created and (2) become visible (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: log creation after installNewDocument Created 4 years, 4 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 side-by-side diff with in-line comments
Download patch
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)
« no previous file with comments | « third_party/WebKit/Source/core/frame/LocalFrame.h ('k') | third_party/WebKit/Source/core/loader/DocumentLoader.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698