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

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

Issue 2090903003: Add use counters for the passive option to addEventListener (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Update histograms Created 4 years, 6 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 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
186 } 186 }
187 187
188 void EventTarget::setDefaultAddEventListenerOptions(const AtomicString& eventTyp e, AddEventListenerOptions& options) 188 void EventTarget::setDefaultAddEventListenerOptions(const AtomicString& eventTyp e, AddEventListenerOptions& options)
189 { 189 {
190 if (!isScrollBlockingEvent(eventType)) { 190 if (!isScrollBlockingEvent(eventType)) {
191 if (!options.hasPassive()) 191 if (!options.hasPassive())
192 options.setPassive(false); 192 options.setPassive(false);
193 return; 193 return;
194 } 194 }
195 195
196 if (LocalDOMWindow* executingWindow = this->executingWindow()) {
197 if (options.hasPassive()) {
198 UseCounter::count(executingWindow->document(), options.passive() ? U seCounter::AddEventListenerPassiveTrue : UseCounter::AddEventListenerPassiveFals e);
199 }
200 }
201
196 if (Settings* settings = windowSettings(executingWindow())) { 202 if (Settings* settings = windowSettings(executingWindow())) {
197 switch (settings->passiveListenerDefault()) { 203 switch (settings->passiveListenerDefault()) {
198 case PassiveListenerDefault::False: 204 case PassiveListenerDefault::False:
199 if (!options.hasPassive()) 205 if (!options.hasPassive())
200 options.setPassive(false); 206 options.setPassive(false);
201 break; 207 break;
202 case PassiveListenerDefault::True: 208 case PassiveListenerDefault::True:
203 if (!options.hasPassive()) 209 if (!options.hasPassive())
204 options.setPassive(true); 210 options.setPassive(true);
205 break; 211 break;
(...skipping 436 matching lines...) Expand 10 before | Expand all | Expand 10 after
642 // they have one less listener to invoke. 648 // they have one less listener to invoke.
643 if (d->firingEventIterators) { 649 if (d->firingEventIterators) {
644 for (size_t i = 0; i < d->firingEventIterators->size(); ++i) { 650 for (size_t i = 0; i < d->firingEventIterators->size(); ++i) {
645 d->firingEventIterators->at(i).iterator = 0; 651 d->firingEventIterators->at(i).iterator = 0;
646 d->firingEventIterators->at(i).end = 0; 652 d->firingEventIterators->at(i).end = 0;
647 } 653 }
648 } 654 }
649 } 655 }
650 656
651 } // namespace blink 657 } // 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