OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) | 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) |
4 * (C) 2001 Dirk Mueller (mueller@kde.org) | 4 * (C) 2001 Dirk Mueller (mueller@kde.org) |
5 * Copyright (C) 2004, 2005, 2006, 2007 Apple Inc. All rights reserved. | 5 * Copyright (C) 2004, 2005, 2006, 2007 Apple Inc. All rights reserved. |
6 * Copyright (C) 2006 Alexey Proskuryakov (ap@webkit.org) | 6 * Copyright (C) 2006 Alexey Proskuryakov (ap@webkit.org) |
7 * (C) 2007, 2008 Nikolas Zimmermann <zimmermann@kde.org> | 7 * (C) 2007, 2008 Nikolas Zimmermann <zimmermann@kde.org> |
8 * | 8 * |
9 * Redistribution and use in source and binary forms, with or without | 9 * Redistribution and use in source and binary forms, with or without |
10 * modification, are permitted provided that the following conditions | 10 * modification, are permitted provided that the following conditions |
(...skipping 28 matching lines...) Expand all Loading... |
39 #include "core/editing/Editor.h" | 39 #include "core/editing/Editor.h" |
40 #include "core/events/Event.h" | 40 #include "core/events/Event.h" |
41 #include "core/events/EventUtil.h" | 41 #include "core/events/EventUtil.h" |
42 #include "core/frame/FrameHost.h" | 42 #include "core/frame/FrameHost.h" |
43 #include "core/frame/LocalDOMWindow.h" | 43 #include "core/frame/LocalDOMWindow.h" |
44 #include "core/frame/Settings.h" | 44 #include "core/frame/Settings.h" |
45 #include "core/frame/UseCounter.h" | 45 #include "core/frame/UseCounter.h" |
46 #include "core/inspector/ConsoleMessage.h" | 46 #include "core/inspector/ConsoleMessage.h" |
47 #include "core/inspector/InspectorInstrumentation.h" | 47 #include "core/inspector/InspectorInstrumentation.h" |
48 #include "platform/EventDispatchForbiddenScope.h" | 48 #include "platform/EventDispatchForbiddenScope.h" |
49 #include "wtf/PtrUtil.h" | |
50 #include "wtf/StdLibExtras.h" | 49 #include "wtf/StdLibExtras.h" |
51 #include "wtf/Threading.h" | 50 #include "wtf/Threading.h" |
52 #include "wtf/Vector.h" | 51 #include "wtf/Vector.h" |
53 #include <memory> | |
54 | 52 |
55 using namespace WTF; | 53 using namespace WTF; |
56 | 54 |
57 namespace blink { | 55 namespace blink { |
58 namespace { | 56 namespace { |
59 | 57 |
60 Settings* windowSettings(LocalDOMWindow* executingWindow) | 58 Settings* windowSettings(LocalDOMWindow* executingWindow) |
61 { | 59 { |
62 if (executingWindow) { | 60 if (executingWindow) { |
63 if (LocalFrame* frame = executingWindow->frame()) { | 61 if (LocalFrame* frame = executingWindow->frame()) { |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 return; | 100 return; |
103 v8::Context::Scope contextScope(v8Context); | 101 v8::Context::Scope contextScope(v8Context); |
104 v8::Local<v8::Object> handler = v8Listener->getListenerObject(context); | 102 v8::Local<v8::Object> handler = v8Listener->getListenerObject(context); |
105 | 103 |
106 String messageText = String::format( | 104 String messageText = String::format( |
107 "Handling of '%s' input event was delayed for %ld ms due to main thread
being busy. " | 105 "Handling of '%s' input event was delayed for %ld ms due to main thread
being busy. " |
108 "Consider marking event handler as 'passive' to make the page more respo
nive.", | 106 "Consider marking event handler as 'passive' to make the page more respo
nive.", |
109 event->type().getString().utf8().data(), lround(delayedSeconds * 1000)); | 107 event->type().getString().utf8().data(), lround(delayedSeconds * 1000)); |
110 | 108 |
111 v8::Local<v8::Function> function = eventListenerEffectiveFunction(v8Listener
->isolate(), handler); | 109 v8::Local<v8::Function> function = eventListenerEffectiveFunction(v8Listener
->isolate(), handler); |
112 std::unique_ptr<SourceLocation> location = SourceLocation::fromFunction(func
tion); | 110 OwnPtr<SourceLocation> location = SourceLocation::fromFunction(function); |
113 ConsoleMessage* message = ConsoleMessage::create(JSMessageSource, WarningMes
sageLevel, messageText, std::move(location)); | 111 ConsoleMessage* message = ConsoleMessage::create(JSMessageSource, WarningMes
sageLevel, messageText, std::move(location)); |
114 context->addConsoleMessage(message); | 112 context->addConsoleMessage(message); |
115 registeredListener->setBlockedEventWarningEmitted(); | 113 registeredListener->setBlockedEventWarningEmitted(); |
116 } | 114 } |
117 | 115 |
118 | 116 |
119 } // namespace | 117 } // namespace |
120 | 118 |
121 EventTargetData::EventTargetData() | 119 EventTargetData::EventTargetData() |
122 { | 120 { |
(...skipping 424 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
547 UseCounter::count(executingWindow->document(), UseCounter::TextInput
Fired); | 545 UseCounter::count(executingWindow->document(), UseCounter::TextInput
Fired); |
548 } | 546 } |
549 | 547 |
550 ExecutionContext* context = getExecutionContext(); | 548 ExecutionContext* context = getExecutionContext(); |
551 if (!context) | 549 if (!context) |
552 return false; | 550 return false; |
553 | 551 |
554 size_t i = 0; | 552 size_t i = 0; |
555 size_t size = entry.size(); | 553 size_t size = entry.size(); |
556 if (!d->firingEventIterators) | 554 if (!d->firingEventIterators) |
557 d->firingEventIterators = wrapUnique(new FiringEventIteratorVector); | 555 d->firingEventIterators = adoptPtr(new FiringEventIteratorVector); |
558 d->firingEventIterators->append(FiringEventIterator(event->type(), i, size))
; | 556 d->firingEventIterators->append(FiringEventIterator(event->type(), i, size))
; |
559 | 557 |
560 double blockedEventThreshold = blockedEventsWarningThreshold(context, event)
; | 558 double blockedEventThreshold = blockedEventsWarningThreshold(context, event)
; |
561 double now = 0.0; | 559 double now = 0.0; |
562 bool shouldReportBlockedEvent = false; | 560 bool shouldReportBlockedEvent = false; |
563 if (blockedEventThreshold) { | 561 if (blockedEventThreshold) { |
564 now = WTF::monotonicallyIncreasingTime(); | 562 now = WTF::monotonicallyIncreasingTime(); |
565 shouldReportBlockedEvent = now - event->platformTimeStamp() > blockedEve
ntThreshold; | 563 shouldReportBlockedEvent = now - event->platformTimeStamp() > blockedEve
ntThreshold; |
566 } | 564 } |
567 bool firedListener = false; | 565 bool firedListener = false; |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
644 // they have one less listener to invoke. | 642 // they have one less listener to invoke. |
645 if (d->firingEventIterators) { | 643 if (d->firingEventIterators) { |
646 for (size_t i = 0; i < d->firingEventIterators->size(); ++i) { | 644 for (size_t i = 0; i < d->firingEventIterators->size(); ++i) { |
647 d->firingEventIterators->at(i).iterator = 0; | 645 d->firingEventIterators->at(i).iterator = 0; |
648 d->firingEventIterators->at(i).end = 0; | 646 d->firingEventIterators->at(i).end = 0; |
649 } | 647 } |
650 } | 648 } |
651 } | 649 } |
652 | 650 |
653 } // namespace blink | 651 } // namespace blink |
OLD | NEW |