| OLD | NEW |
| 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 Loading... |
| 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 | |
| 276 } | 273 } |
| 277 | 274 |
| 278 void LocalDOMWindow::clearDocument() | 275 void LocalDOMWindow::clearDocument() |
| 279 { | 276 { |
| 280 if (!m_document) | 277 if (!m_document) |
| 281 return; | 278 return; |
| 282 | 279 |
| 283 ASSERT(!m_document->isActive()); | 280 ASSERT(!m_document->isActive()); |
| 284 | 281 |
| 285 // FIXME: This should be part of ActiveDOMObject shutdown | 282 // FIXME: This should be part of ActiveDOMObject shutdown |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 413 enqueuePopstateEvent(stateObject); | 410 enqueuePopstateEvent(stateObject); |
| 414 else | 411 else |
| 415 m_pendingStateObject = stateObject; | 412 m_pendingStateObject = stateObject; |
| 416 } | 413 } |
| 417 | 414 |
| 418 LocalDOMWindow::~LocalDOMWindow() | 415 LocalDOMWindow::~LocalDOMWindow() |
| 419 { | 416 { |
| 420 #if ENABLE(OILPAN) | 417 #if ENABLE(OILPAN) |
| 421 // Cleared when detaching document. | 418 // Cleared when detaching document. |
| 422 ASSERT(!m_eventQueue); | 419 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(); |
| 423 #else | 429 #else |
| 424 ASSERT(m_hasBeenReset); | 430 ASSERT(m_hasBeenReset); |
| 425 ASSERT(m_document->isStopped()); | 431 ASSERT(m_document->isStopped()); |
| 426 clearDocument(); | 432 clearDocument(); |
| 427 #endif | 433 #endif |
| 428 } | 434 } |
| 429 | 435 |
| 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 // Do that here by way of a prefinalizing action. | |
| 436 // | |
| 437 // (Non-Oilpan, LocalDOMWindow::reset() will always be invoked, the last opp
ortunity | |
| 438 // being via ~LocalFrame's setDOMWindow() call.) | |
| 439 if (!frame()) | |
| 440 return; | |
| 441 | |
| 442 // (Prefinalizing actions run to completion before the Oilpan GC start to la
zily sweep, | |
| 443 // so keeping them short is worthwhile. Something that's worth keeping in mi
nd when | |
| 444 // working out where to best place some actions that have to be performed ve
ry late | |
| 445 // on in LocalDOMWindow's lifetime.) | |
| 446 removeAllEventListeners(); | |
| 447 } | |
| 448 | |
| 449 ExecutionContext* LocalDOMWindow::executionContext() const | 436 ExecutionContext* LocalDOMWindow::executionContext() const |
| 450 { | 437 { |
| 451 return m_document.get(); | 438 return m_document.get(); |
| 452 } | 439 } |
| 453 | 440 |
| 454 LocalDOMWindow* LocalDOMWindow::toDOMWindow() | 441 LocalDOMWindow* LocalDOMWindow::toDOMWindow() |
| 455 { | 442 { |
| 456 return this; | 443 return this; |
| 457 } | 444 } |
| 458 | 445 |
| (...skipping 1067 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1526 DOMWindow::trace(visitor); | 1513 DOMWindow::trace(visitor); |
| 1527 DOMWindowLifecycleNotifier::trace(visitor); | 1514 DOMWindowLifecycleNotifier::trace(visitor); |
| 1528 } | 1515 } |
| 1529 | 1516 |
| 1530 LocalFrame* LocalDOMWindow::frame() const | 1517 LocalFrame* LocalDOMWindow::frame() const |
| 1531 { | 1518 { |
| 1532 return m_frameObserver->frame(); | 1519 return m_frameObserver->frame(); |
| 1533 } | 1520 } |
| 1534 | 1521 |
| 1535 } // namespace blink | 1522 } // namespace blink |
| OLD | NEW |