| Index: third_party/WebKit/Source/core/events/EventTarget.cpp
|
| diff --git a/third_party/WebKit/Source/core/events/EventTarget.cpp b/third_party/WebKit/Source/core/events/EventTarget.cpp
|
| index afeac1d4727d710b5c7a65c86f050c9cc57a3d59..99562b50dbc1064632c9c4b1335e3a1f0570fef2 100644
|
| --- a/third_party/WebKit/Source/core/events/EventTarget.cpp
|
| +++ b/third_party/WebKit/Source/core/events/EventTarget.cpp
|
| @@ -42,9 +42,9 @@
|
| #include "core/events/PointerEvent.h"
|
| #include "core/frame/FrameHost.h"
|
| #include "core/frame/LocalDOMWindow.h"
|
| +#include "core/frame/PerformanceMonitor.h"
|
| #include "core/frame/Settings.h"
|
| #include "core/frame/UseCounter.h"
|
| -#include "core/inspector/ConsoleMessage.h"
|
| #include "core/inspector/InspectorInstrumentation.h"
|
| #include "platform/EventDispatchForbiddenScope.h"
|
| #include "platform/Histogram.h"
|
| @@ -59,6 +59,8 @@ using namespace WTF;
|
| namespace blink {
|
| namespace {
|
|
|
| +static const double kBlockedWarningThresholdMillis = 100.0;
|
| +
|
| enum PassiveForcedListenerResultType {
|
| PreventDefaultNotCalled,
|
| DocumentLevelTouchPreventDefaultCalled,
|
| @@ -94,19 +96,15 @@ bool isScrollBlockingEvent(const AtomicString& eventType) {
|
| eventType == EventTypeNames::wheel;
|
| }
|
|
|
| -double blockedEventsWarningThreshold(const ExecutionContext* context,
|
| - const Event* event) {
|
| +double blockedEventsWarningThreshold(ExecutionContext* context, Event* event) {
|
| if (!event->cancelable())
|
| return 0.0;
|
| if (!isScrollBlockingEvent(event->type()))
|
| return 0.0;
|
|
|
| - if (!context->isDocument())
|
| - return 0.0;
|
| - FrameHost* frameHost = toDocument(context)->frameHost();
|
| - if (!frameHost)
|
| - return 0.0;
|
| - return frameHost->settings().blockedMainThreadEventsWarningThreshold();
|
| + return PerformanceMonitor::enabled(context)
|
| + ? kBlockedWarningThresholdMillis / 1000
|
| + : 0;
|
| }
|
|
|
| void reportBlockedEvent(ExecutionContext* context,
|
| @@ -137,9 +135,8 @@ void reportBlockedEvent(ExecutionContext* context,
|
| eventListenerEffectiveFunction(v8Listener->isolate(), handler);
|
| std::unique_ptr<SourceLocation> location =
|
| SourceLocation::fromFunction(function);
|
| - ConsoleMessage* message = ConsoleMessage::create(
|
| - JSMessageSource, WarningMessageLevel, messageText, std::move(location));
|
| - context->addConsoleMessage(message);
|
| + PerformanceMonitor::logViolation(WarningMessageLevel, context, messageText,
|
| + std::move(location));
|
| registeredListener->setBlockedEventWarningEmitted();
|
| }
|
|
|
|
|