Chromium Code Reviews| 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 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 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); |
| 423 #else | 420 #else |
| 424 ASSERT(m_hasBeenReset); | 421 ASSERT(m_hasBeenReset); |
| 425 ASSERT(m_document->isStopped()); | 422 ASSERT(m_document->isStopped()); |
| 426 clearDocument(); | 423 clearDocument(); |
| 427 #endif | 424 #endif |
| 428 } | |
| 429 | |
| 430 void LocalDOMWindow::dispose() | |
| 431 { | |
| 432 // Oilpan: should the LocalDOMWindow be GCed along with its LocalFrame witho ut the | 425 // Oilpan: should the LocalDOMWindow be GCed along with its LocalFrame witho ut the |
|
haraken
2015/06/04 01:02:31
I'm not sure if it makes any difference or not, bu
sof
2015/06/04 07:54:39
Yes, we really don't need this non-Oilpan; moved i
| |
| 433 // frame having first notified its observers of imminent destruction, the | 426 // frame having first notified its observers of imminent destruction, the |
| 434 // LocalDOMWindow will not have had an opportunity to remove event listeners . | 427 // LocalDOMWindow will not have had an opportunity to remove event listeners . |
| 435 // Do that here by way of a prefinalizing action. | |
| 436 // | 428 // |
| 437 // (Non-Oilpan, LocalDOMWindow::reset() will always be invoked, the last opp ortunity | 429 // (Non-Oilpan, LocalDOMWindow::reset() will always be invoked, the last opp ortunity |
| 438 // being via ~LocalFrame's setDOMWindow() call.) | 430 // being via ~LocalFrame's setDOMWindow() call.) |
| 439 if (!frame()) | 431 if (!frame()) |
| 440 return; | 432 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(); | 433 removeAllEventListeners(); |
| 447 } | 434 } |
| 448 | 435 |
| 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 { |
| (...skipping 1070 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 |