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

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

Issue 2380703002: Adjust use counters for editing and legacy events. (Closed)
Patch Set: Rebase Created 4 years, 2 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
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/frame/UseCounter.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 529 matching lines...) Expand 10 before | Expand all | Expand 10 after
540 if (listenersVector) { 540 if (listenersVector) {
541 firedEventListeners = fireEventListeners(event, d, *listenersVector); 541 firedEventListeners = fireEventListeners(event, d, *listenersVector);
542 } else if (legacyListenersVector) { 542 } else if (legacyListenersVector) {
543 AtomicString unprefixedTypeName = event->type(); 543 AtomicString unprefixedTypeName = event->type();
544 event->setType(legacyTypeName); 544 event->setType(legacyTypeName);
545 firedEventListeners = fireEventListeners(event, d, *legacyListenersVecto r); 545 firedEventListeners = fireEventListeners(event, d, *legacyListenersVecto r);
546 event->setType(unprefixedTypeName); 546 event->setType(unprefixedTypeName);
547 } 547 }
548 548
549 // Only invoke the callback if event listeners were fired for this phase. 549 // Only invoke the callback if event listeners were fired for this phase.
550 if (firedEventListeners) 550 if (firedEventListeners) {
551 event->doneDispatchingEventAtCurrentTarget(); 551 event->doneDispatchingEventAtCurrentTarget();
552 552
553 // TODO(dtapuska): Should we really do counting here for these events 553 // Only count uma metrics if we really fired an event listener.
554 // if we really didn't fire a listener? For example having a bubbling 554 Editor::countEvent(getExecutionContext(), event);
555 // listener on an event that doesn't bubble likely records a UMA 555 countLegacyEvents(legacyTypeName, listenersVector, legacyListenersVector );
556 // metric where it probably shouldn't because it was never fired. 556 }
557 // See https://crbug.com/612829
558 Editor::countEvent(getExecutionContext(), event);
559 countLegacyEvents(legacyTypeName, listenersVector, legacyListenersVector);
560 return dispatchEventResult(*event); 557 return dispatchEventResult(*event);
561 } 558 }
562 559
563 bool EventTarget::checkTypeThenUseCount( 560 bool EventTarget::checkTypeThenUseCount(
564 const Event* event, const AtomicString& eventTypeToCount, const UseCounter:: Feature feature) 561 const Event* event, const AtomicString& eventTypeToCount, const UseCounter:: Feature feature)
565 { 562 {
566 if (event->type() == eventTypeToCount) { 563 if (event->type() == eventTypeToCount) {
567 if (LocalDOMWindow* executingWindow = this->executingWindow()) 564 if (LocalDOMWindow* executingWindow = this->executingWindow())
568 UseCounter::count(executingWindow->document(), feature); 565 UseCounter::count(executingWindow->document(), feature);
569 return true; 566 return true;
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
715 // they have one less listener to invoke. 712 // they have one less listener to invoke.
716 if (d->firingEventIterators) { 713 if (d->firingEventIterators) {
717 for (size_t i = 0; i < d->firingEventIterators->size(); ++i) { 714 for (size_t i = 0; i < d->firingEventIterators->size(); ++i) {
718 d->firingEventIterators->at(i).iterator = 0; 715 d->firingEventIterators->at(i).iterator = 0;
719 d->firingEventIterators->at(i).end = 0; 716 d->firingEventIterators->at(i).end = 0;
720 } 717 }
721 } 718 }
722 } 719 }
723 720
724 } // namespace blink 721 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/frame/UseCounter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698