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

Unified Diff: third_party/WebKit/Source/core/inspector/InspectorPageAgent.cpp

Issue 1949793002: Emit a console warning when blocking event listener is delayed for too long (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebased Created 4 years, 7 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/inspector/InspectorPageAgent.cpp
diff --git a/third_party/WebKit/Source/core/inspector/InspectorPageAgent.cpp b/third_party/WebKit/Source/core/inspector/InspectorPageAgent.cpp
index fd95b4cacf4353c817af3ca0eea045b3ec5431a2..91f8de62a20c1fc47800b5653a197f939f6317b8 100644
--- a/third_party/WebKit/Source/core/inspector/InspectorPageAgent.cpp
+++ b/third_party/WebKit/Source/core/inspector/InspectorPageAgent.cpp
@@ -43,7 +43,9 @@
#include "core/fetch/Resource.h"
#include "core/fetch/ResourceFetcher.h"
#include "core/fetch/ScriptResource.h"
+#include "core/frame/FrameHost.h"
#include "core/frame/LocalFrame.h"
+#include "core/frame/Settings.h"
#include "core/html/HTMLFrameOwnerElement.h"
#include "core/html/VoidCallback.h"
#include "core/html/imports/HTMLImportLoader.h"
@@ -77,6 +79,7 @@ static const char pageAgentEnabled[] = "pageAgentEnabled";
static const char pageAgentScriptsToEvaluateOnLoad[] = "pageAgentScriptsToEvaluateOnLoad";
static const char screencastEnabled[] = "screencastEnabled";
static const char autoAttachToCreatedPages[] = "autoAttachToCreatedPages";
+static const char blockedEventsWarningThreshold[] = "blockedEventsWarningThreshold";
}
namespace {
@@ -360,10 +363,10 @@ InspectorPageAgent::InspectorPageAgent(InspectedFrames* inspectedFrames, Client*
void InspectorPageAgent::restore()
{
- if (m_state->booleanProperty(PageAgentState::pageAgentEnabled, false)) {
- ErrorString error;
+ ErrorString error;
+ if (m_state->booleanProperty(PageAgentState::pageAgentEnabled, false))
enable(&error);
- }
+ setBlockedEventsWarningThreshold(&error, m_state->numberProperty(PageAgentState::blockedEventsWarningThreshold, 0.0));
}
void InspectorPageAgent::enable(ErrorString*)
@@ -765,6 +768,15 @@ void InspectorPageAgent::setOverlayMessage(ErrorString*, const Maybe<String>& me
m_client->setPausedInDebuggerMessage(message.fromMaybe(String()));
}
+void InspectorPageAgent::setBlockedEventsWarningThreshold(ErrorString*, double threshold)
+{
+ m_state->setNumber(PageAgentState::blockedEventsWarningThreshold, threshold);
+ FrameHost* host = m_inspectedFrames->root()->host();
+ if (!host)
+ return;
+ host->settings().setBlockedMainThreadEventsWarningThreshold(threshold);
+}
+
DEFINE_TRACE(InspectorPageAgent)
{
visitor->trace(m_inspectedFrames);

Powered by Google App Engine
This is Rietveld 408576698