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

Unified Diff: third_party/WebKit/Source/core/events/EventTarget.cpp

Issue 2474073005: DevTools: add the logging aspect into the PerformanceMonitor (Closed)
Patch Set: test fixed Created 4 years, 1 month 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
« no previous file with comments | « third_party/WebKit/Source/core/dom/Document.cpp ('k') | third_party/WebKit/Source/core/frame/FrameView.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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();
}
« no previous file with comments | « third_party/WebKit/Source/core/dom/Document.cpp ('k') | third_party/WebKit/Source/core/frame/FrameView.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698