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

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

Issue 1166163003: Oilpan: revert back to a prefinalizer for LocalDOMWindow. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 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 | « Source/core/frame/LocalDOMWindow.h ('k') | no next file » | 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) 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 252 matching lines...) Expand 10 before | Expand all | Expand 10 after
263 return frame() && allowPopUp(*frame()); 263 return frame() && allowPopUp(*frame());
264 } 264 }
265 265
266 LocalDOMWindow::LocalDOMWindow(LocalFrame& frame) 266 LocalDOMWindow::LocalDOMWindow(LocalFrame& frame)
267 : m_frameObserver(WindowFrameObserver::create(this, frame)) 267 : m_frameObserver(WindowFrameObserver::create(this, frame))
268 , m_shouldPrintWhenFinishedLoading(false) 268 , m_shouldPrintWhenFinishedLoading(false)
269 #if ENABLE(ASSERT) 269 #if ENABLE(ASSERT)
270 , m_hasBeenReset(false) 270 , m_hasBeenReset(false)
271 #endif 271 #endif
272 { 272 {
273 #if ENABLE(OILPAN)
274 ThreadState::current()->registerPreFinalizer(*this);
275 #endif
273 } 276 }
274 277
275 void LocalDOMWindow::clearDocument() 278 void LocalDOMWindow::clearDocument()
276 { 279 {
277 if (!m_document) 280 if (!m_document)
278 return; 281 return;
279 282
280 ASSERT(!m_document->isActive()); 283 ASSERT(!m_document->isActive());
281 284
282 // FIXME: This should be part of ActiveDOMObject shutdown 285 // FIXME: This should be part of ActiveDOMObject shutdown
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
410 enqueuePopstateEvent(stateObject); 413 enqueuePopstateEvent(stateObject);
411 else 414 else
412 m_pendingStateObject = stateObject; 415 m_pendingStateObject = stateObject;
413 } 416 }
414 417
415 LocalDOMWindow::~LocalDOMWindow() 418 LocalDOMWindow::~LocalDOMWindow()
416 { 419 {
417 #if ENABLE(OILPAN) 420 #if ENABLE(OILPAN)
418 // Cleared when detaching document. 421 // Cleared when detaching document.
419 ASSERT(!m_eventQueue); 422 ASSERT(!m_eventQueue);
420
421 // Oilpan: should the LocalDOMWindow be GCed along with its LocalFrame witho ut the
422 // frame having first notified its observers of imminent destruction, the
423 // LocalDOMWindow will not have had an opportunity to remove event listeners .
424 //
425 // Non-Oilpan, LocalDOMWindow::reset() will always be invoked, the last oppo rtunity
426 // being via ~LocalFrame's setDOMWindow() call. Asserted for below.
427 if (frame())
428 removeAllEventListeners();
429 #else 423 #else
430 ASSERT(m_hasBeenReset); 424 ASSERT(m_hasBeenReset);
431 ASSERT(m_document->isStopped()); 425 ASSERT(m_document->isStopped());
432 clearDocument(); 426 clearDocument();
433 #endif 427 #endif
434 } 428 }
435 429
430 void LocalDOMWindow::dispose()
431 {
432 // Oilpan: should the LocalDOMWindow be GCed along with its LocalFrame witho ut the
433 // frame having first notified its observers of imminent destruction, the
434 // LocalDOMWindow will not have had an opportunity to remove event listeners .
435 //
436 // Arrange for that removal to happen using a prefinalizer action. Making Lo calDOMWindow
437 // eager finalizable is problematic as other eagerly finalized objects may w ell
438 // want to access their associated LocalDOMWindow from their destructors.
439 //
440 // (Non-Oilpan, LocalDOMWindow::reset() will always be invoked, the last opp ortunity
441 // being via ~LocalFrame's setDOMWindow() call. Asserted for in the destruct or.)
442 if (!frame())
443 return;
444
445 removeAllEventListeners();
446 }
447
436 ExecutionContext* LocalDOMWindow::executionContext() const 448 ExecutionContext* LocalDOMWindow::executionContext() const
437 { 449 {
438 return m_document.get(); 450 return m_document.get();
439 } 451 }
440 452
441 LocalDOMWindow* LocalDOMWindow::toDOMWindow() 453 LocalDOMWindow* LocalDOMWindow::toDOMWindow()
442 { 454 {
443 return this; 455 return this;
444 } 456 }
445 457
(...skipping 1067 matching lines...) Expand 10 before | Expand all | Expand 10 after
1513 DOMWindow::trace(visitor); 1525 DOMWindow::trace(visitor);
1514 DOMWindowLifecycleNotifier::trace(visitor); 1526 DOMWindowLifecycleNotifier::trace(visitor);
1515 } 1527 }
1516 1528
1517 LocalFrame* LocalDOMWindow::frame() const 1529 LocalFrame* LocalDOMWindow::frame() const
1518 { 1530 {
1519 return m_frameObserver->frame(); 1531 return m_frameObserver->frame();
1520 } 1532 }
1521 1533
1522 } // namespace blink 1534 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/frame/LocalDOMWindow.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698