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

Side by Side Diff: third_party/WebKit/Source/core/events/EventTarget.cpp

Issue 2873713002: [DevTools] added creation stack for event listeners without scheduled stack
Patch Set: better Created 3 years, 7 months 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 unified diff | Download patch
OLDNEW
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 272 matching lines...) Expand 10 before | Expand all | Expand 10 after
283 return AddEventListenerInternal(event_type, listener, options); 283 return AddEventListenerInternal(event_type, listener, options);
284 } 284 }
285 285
286 bool EventTarget::AddEventListenerInternal( 286 bool EventTarget::AddEventListenerInternal(
287 const AtomicString& event_type, 287 const AtomicString& event_type,
288 EventListener* listener, 288 EventListener* listener,
289 const AddEventListenerOptionsResolved& options) { 289 const AddEventListenerOptionsResolved& options) {
290 if (!listener) 290 if (!listener)
291 return false; 291 return false;
292 292
293 if (listener->GetType() == EventListener::kJSEventListenerType) {
294 String description = event_type + " event";
295 probe::AsyncTaskScheduled(GetExecutionContext(), description, listener);
296 }
297
293 V8DOMActivityLogger* activity_logger = 298 V8DOMActivityLogger* activity_logger =
294 V8DOMActivityLogger::CurrentActivityLoggerIfIsolatedWorld(); 299 V8DOMActivityLogger::CurrentActivityLoggerIfIsolatedWorld();
295 if (activity_logger) { 300 if (activity_logger) {
296 Vector<String> argv; 301 Vector<String> argv;
297 argv.push_back(ToNode() ? ToNode()->nodeName() : InterfaceName()); 302 argv.push_back(ToNode() ? ToNode()->nodeName() : InterfaceName());
298 argv.push_back(event_type); 303 argv.push_back(event_type);
299 activity_logger->LogEvent("blinkAddEventListener", argv.size(), 304 activity_logger->LogEvent("blinkAddEventListener", argv.size(),
300 argv.data()); 305 argv.data());
301 } 306 }
302 307
(...skipping 409 matching lines...) Expand 10 before | Expand all | Expand 10 after
712 717
713 // If stopImmediatePropagation has been called, we just break out 718 // If stopImmediatePropagation has been called, we just break out
714 // immediately, without handling any more events on this target. 719 // immediately, without handling any more events on this target.
715 if (event->ImmediatePropagationStopped()) 720 if (event->ImmediatePropagationStopped())
716 break; 721 break;
717 722
718 event->SetHandlingPassive(EventPassiveMode(registered_listener)); 723 event->SetHandlingPassive(EventPassiveMode(registered_listener));
719 bool passive_forced = registered_listener.PassiveForcedForDocumentTarget(); 724 bool passive_forced = registered_listener.PassiveForcedForDocumentTarget();
720 725
721 probe::UserCallback probe(context, nullptr, event->type(), false, this); 726 probe::UserCallback probe(context, nullptr, event->type(), false, this);
727 probe::AsyncTask async_task(context, listener, "Event Listener called",
728 true, true);
722 729
723 // To match Mozilla, the AT_TARGET phase fires both capturing and bubbling 730 // To match Mozilla, the AT_TARGET phase fires both capturing and bubbling
724 // event listeners, even though that violates some versions of the DOM spec. 731 // event listeners, even though that violates some versions of the DOM spec.
725 listener->handleEvent(context, event); 732 listener->handleEvent(context, event);
726 fired_listener = true; 733 fired_listener = true;
727 734
728 // If we're about to report this event listener as blocking, make sure it 735 // If we're about to report this event listener as blocking, make sure it
729 // wasn't removed while handling the event. 736 // wasn't removed while handling the event.
730 if (should_report_blocked_event && i > 0 && 737 if (should_report_blocked_event && i > 0 &&
731 entry[i - 1].Listener() == listener && !entry[i - 1].Passive() && 738 entry[i - 1].Listener() == listener && !entry[i - 1].Passive() &&
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
785 // they have one less listener to invoke. 792 // they have one less listener to invoke.
786 if (d->firing_event_iterators) { 793 if (d->firing_event_iterators) {
787 for (const auto& iterator : *d->firing_event_iterators) { 794 for (const auto& iterator : *d->firing_event_iterators) {
788 iterator.iterator = 0; 795 iterator.iterator = 0;
789 iterator.end = 0; 796 iterator.end = 0;
790 } 797 }
791 } 798 }
792 } 799 }
793 800
794 } // namespace blink 801 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698