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

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

Issue 2484213003: Convert performance monitor to the subscription model. (Closed)
Patch Set: same 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
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 99562b50dbc1064632c9c4b1335e3a1f0570fef2..b7bd6325e42488f7b6765afba9eb48a0c41be74f 100644
--- a/third_party/WebKit/Source/core/events/EventTarget.cpp
+++ b/third_party/WebKit/Source/core/events/EventTarget.cpp
@@ -59,8 +59,6 @@ using namespace WTF;
namespace blink {
namespace {
-static const double kBlockedWarningThresholdMillis = 100.0;
-
enum PassiveForcedListenerResultType {
PreventDefaultNotCalled,
DocumentLevelTouchPreventDefaultCalled,
@@ -96,15 +94,14 @@ bool isScrollBlockingEvent(const AtomicString& eventType) {
eventType == EventTypeNames::wheel;
}
-double blockedEventsWarningThreshold(ExecutionContext* context, Event* event) {
+double blockedEventsWarningThreshold(ExecutionContext* context,
+ const Event* event) {
if (!event->cancelable())
return 0.0;
if (!isScrollBlockingEvent(event->type()))
return 0.0;
-
- return PerformanceMonitor::enabled(context)
- ? kBlockedWarningThresholdMillis / 1000
- : 0;
+ return PerformanceMonitor::threshold(context,
+ PerformanceMonitor::kBlockedEvent);
}
void reportBlockedEvent(ExecutionContext* context,
@@ -135,8 +132,10 @@ void reportBlockedEvent(ExecutionContext* context,
eventListenerEffectiveFunction(v8Listener->isolate(), handler);
std::unique_ptr<SourceLocation> location =
SourceLocation::fromFunction(function);
- PerformanceMonitor::logViolation(WarningMessageLevel, context, messageText,
- std::move(location));
+
+ PerformanceMonitor::reportGenericViolation(
+ context, PerformanceMonitor::kBlockedEvent, messageText, delayedSeconds,
+ std::move(location));
registeredListener->setBlockedEventWarningEmitted();
}

Powered by Google App Engine
This is Rietveld 408576698