Chromium Code Reviews| 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..444d190d74a2f75ff270bfd099ccedc946379b56 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" |
| @@ -94,19 +94,13 @@ 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) ? 0.1 : 0; |
|
caseq
2016/11/05 00:14:35
Extract constant for 0.1
pfeldman
2016/11/05 00:16:02
Done.
|
| } |
| void reportBlockedEvent(ExecutionContext* context, |
| @@ -137,9 +131,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(); |
| } |