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

Side by Side Diff: third_party/WebKit/Source/core/frame/LocalDOMWindow.cpp

Issue 1577263004: Communicate whether passive event listeners exist to cc. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master_wheel_passive_listeners
Patch Set: Move to having fields on WebLayerTreeView Created 4 years, 10 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) 2006, 2007, 2008, 2010 Apple Inc. All rights reserved. 2 * Copyright (C) 2006, 2007, 2008, 2010 Apple Inc. All rights reserved.
3 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) 3 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 1277 matching lines...) Expand 10 before | Expand all | Expand 10 after
1288 document->cancelIdleCallback(id); 1288 document->cancelIdleCallback(id);
1289 } 1289 }
1290 1290
1291 bool LocalDOMWindow::addEventListenerInternal(const AtomicString& eventType, Pas sRefPtrWillBeRawPtr<EventListener> prpListener, const EventListenerOptions& opti ons) 1291 bool LocalDOMWindow::addEventListenerInternal(const AtomicString& eventType, Pas sRefPtrWillBeRawPtr<EventListener> prpListener, const EventListenerOptions& opti ons)
1292 { 1292 {
1293 RefPtrWillBeRawPtr<EventListener> listener = prpListener; 1293 RefPtrWillBeRawPtr<EventListener> listener = prpListener;
1294 if (!EventTarget::addEventListenerInternal(eventType, listener, options)) 1294 if (!EventTarget::addEventListenerInternal(eventType, listener, options))
1295 return false; 1295 return false;
1296 1296
1297 if (frame() && frame()->host()) 1297 if (frame() && frame()->host())
1298 frame()->host()->eventHandlerRegistry().didAddEventHandler(*this, eventT ype); 1298 frame()->host()->eventHandlerRegistry().didAddEventHandler(*this, eventT ype, options);
1299 1299
1300 if (Document* document = this->document()) { 1300 if (Document* document = this->document()) {
1301 document->addListenerTypeIfNeeded(eventType); 1301 document->addListenerTypeIfNeeded(eventType);
1302 } 1302 }
1303 1303
1304 notifyAddEventListener(this, eventType); 1304 notifyAddEventListener(this, eventType);
1305 1305
1306 if (eventType == EventTypeNames::unload) { 1306 if (eventType == EventTypeNames::unload) {
1307 UseCounter::count(document(), UseCounter::DocumentUnloadRegistered); 1307 UseCounter::count(document(), UseCounter::DocumentUnloadRegistered);
1308 addUnloadEventListener(this); 1308 addUnloadEventListener(this);
(...skipping 12 matching lines...) Expand all
1321 1321
1322 return true; 1322 return true;
1323 } 1323 }
1324 1324
1325 bool LocalDOMWindow::removeEventListenerInternal(const AtomicString& eventType, PassRefPtrWillBeRawPtr<EventListener> listener, const EventListenerOptions& opti ons) 1325 bool LocalDOMWindow::removeEventListenerInternal(const AtomicString& eventType, PassRefPtrWillBeRawPtr<EventListener> listener, const EventListenerOptions& opti ons)
1326 { 1326 {
1327 if (!EventTarget::removeEventListenerInternal(eventType, listener, options)) 1327 if (!EventTarget::removeEventListenerInternal(eventType, listener, options))
1328 return false; 1328 return false;
1329 1329
1330 if (frame() && frame()->host()) 1330 if (frame() && frame()->host())
1331 frame()->host()->eventHandlerRegistry().didRemoveEventHandler(*this, eve ntType); 1331 frame()->host()->eventHandlerRegistry().didRemoveEventHandler(*this, eve ntType, options);
1332 1332
1333 notifyRemoveEventListener(this, eventType); 1333 notifyRemoveEventListener(this, eventType);
1334 1334
1335 if (eventType == EventTypeNames::unload) { 1335 if (eventType == EventTypeNames::unload) {
1336 removeUnloadEventListener(this); 1336 removeUnloadEventListener(this);
1337 } else if (eventType == EventTypeNames::beforeunload && allowsBeforeUnloadLi steners(this)) { 1337 } else if (eventType == EventTypeNames::beforeunload && allowsBeforeUnloadLi steners(this)) {
1338 removeBeforeUnloadEventListener(this); 1338 removeBeforeUnloadEventListener(this);
1339 } 1339 }
1340 1340
1341 return true; 1341 return true;
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
1500 { 1500 {
1501 // If the LocalDOMWindow still has a frame reference, that frame must point 1501 // If the LocalDOMWindow still has a frame reference, that frame must point
1502 // back to this LocalDOMWindow: otherwise, it's easy to get into a situation 1502 // back to this LocalDOMWindow: otherwise, it's easy to get into a situation
1503 // where script execution leaks between different LocalDOMWindows. 1503 // where script execution leaks between different LocalDOMWindows.
1504 if (m_frameObserver->frame()) 1504 if (m_frameObserver->frame())
1505 ASSERT_WITH_SECURITY_IMPLICATION(m_frameObserver->frame()->domWindow() = = this); 1505 ASSERT_WITH_SECURITY_IMPLICATION(m_frameObserver->frame()->domWindow() = = this);
1506 return m_frameObserver->frame(); 1506 return m_frameObserver->frame();
1507 } 1507 }
1508 1508
1509 } // namespace blink 1509 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698