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 479 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 490 // defer firing of popstate until we're in the complete state. | 490 // defer firing of popstate until we're in the complete state. |
| 491 if (document()->isLoadCompleted()) | 491 if (document()->isLoadCompleted()) |
| 492 enqueuePopstateEvent(stateObject); | 492 enqueuePopstateEvent(stateObject); |
| 493 else | 493 else |
| 494 m_pendingStateObject = stateObject; | 494 m_pendingStateObject = stateObject; |
| 495 } | 495 } |
| 496 | 496 |
| 497 LocalDOMWindow::~LocalDOMWindow() | 497 LocalDOMWindow::~LocalDOMWindow() |
| 498 { | 498 { |
| 499 ASSERT(m_hasBeenReset); | 499 ASSERT(m_hasBeenReset); |
| 500 reset(); | |
| 501 | 500 |
| 502 #if ENABLE(OILPAN) | 501 #if ENABLE(OILPAN) |
| 503 // Oilpan: the frame host and document objects are | 502 // Oilpan: the frame host and document objects are |
| 504 // also garbage collected; cannot notify these | 503 // also garbage collected; cannot notify these |
| 505 // when removing event listeners. | 504 // when removing event listeners. |
| 506 removeAllEventListenersInternal(DoNotBroadcastListenerRemoval); | 505 removeAllEventListenersInternal(DoNotBroadcastListenerRemoval); |
| 507 | 506 |
| 508 // Cleared when detaching document. | 507 // Cleared when detaching document. |
| 509 ASSERT(!m_eventQueue); | 508 ASSERT(!m_eventQueue); |
| 510 #else | 509 #else |
| 510 reset(); | |
| 511 | |
| 511 removeAllEventListenersInternal(DoBroadcastListenerRemoval); | 512 removeAllEventListenersInternal(DoBroadcastListenerRemoval); |
| 512 | 513 |
| 513 ASSERT(m_document->isStopped()); | 514 ASSERT(m_document->isStopped()); |
| 514 clearDocument(); | 515 clearDocument(); |
| 515 #endif | 516 #endif |
| 516 } | 517 } |
| 517 | 518 |
| 518 const AtomicString& LocalDOMWindow::interfaceName() const | 519 const AtomicString& LocalDOMWindow::interfaceName() const |
| 519 { | 520 { |
| 520 return EventTargetNames::LocalDOMWindow; | 521 return EventTargetNames::LocalDOMWindow; |
| (...skipping 29 matching lines...) Expand all Loading... | |
| 550 { | 551 { |
| 551 m_frame->host()->eventHandlerRegistry().didRemoveAllEventHandlers(*this); | 552 m_frame->host()->eventHandlerRegistry().didRemoveAllEventHandlers(*this); |
| 552 m_frame->console().messageStorage()->frameWindowDiscarded(this); | 553 m_frame->console().messageStorage()->frameWindowDiscarded(this); |
| 553 InspectorInstrumentation::frameWindowDiscarded(m_frame, this); | 554 InspectorInstrumentation::frameWindowDiscarded(m_frame, this); |
| 554 } | 555 } |
| 555 | 556 |
| 556 void LocalDOMWindow::willDestroyDocumentInFrame() | 557 void LocalDOMWindow::willDestroyDocumentInFrame() |
| 557 { | 558 { |
| 558 // It is necessary to copy m_properties to a separate vector because the DOM WindowProperties may | 559 // It is necessary to copy m_properties to a separate vector because the DOM WindowProperties may |
| 559 // unregister themselves from the LocalDOMWindow as a result of the call to willDestroyGlobalObjectInFrame. | 560 // unregister themselves from the LocalDOMWindow as a result of the call to willDestroyGlobalObjectInFrame. |
| 560 Vector<DOMWindowProperty*> properties; | 561 WillBeHeapVector<RawPtrWillBeMember<DOMWindowProperty> > properties; |
| 561 copyToVector(m_properties, properties); | 562 copyToVector(m_properties, properties); |
| 562 for (size_t i = 0; i < properties.size(); ++i) | 563 for (size_t i = 0; i < properties.size(); ++i) |
| 563 properties[i]->willDestroyGlobalObjectInFrame(); | 564 properties[i]->willDestroyGlobalObjectInFrame(); |
| 564 } | 565 } |
| 565 | 566 |
| 566 void LocalDOMWindow::willDetachDocumentFromFrame() | 567 void LocalDOMWindow::willDetachDocumentFromFrame() |
| 567 { | 568 { |
| 568 // It is necessary to copy m_properties to a separate vector because the DOM WindowProperties may | 569 // It is necessary to copy m_properties to a separate vector because the DOM WindowProperties may |
| 569 // unregister themselves from the LocalDOMWindow as a result of the call to willDetachGlobalObjectFromFrame. | 570 // unregister themselves from the LocalDOMWindow as a result of the call to willDetachGlobalObjectFromFrame. |
| 570 Vector<DOMWindowProperty*> properties; | 571 WillBeHeapVector<RawPtrWillBeMember<DOMWindowProperty> > properties; |
| 571 copyToVector(m_properties, properties); | 572 copyToVector(m_properties, properties); |
| 572 for (size_t i = 0; i < properties.size(); ++i) | 573 for (size_t i = 0; i < properties.size(); ++i) |
| 573 properties[i]->willDetachGlobalObjectFromFrame(); | 574 properties[i]->willDetachGlobalObjectFromFrame(); |
| 574 } | 575 } |
| 575 | 576 |
| 576 void LocalDOMWindow::registerProperty(DOMWindowProperty* property) | 577 void LocalDOMWindow::registerProperty(DOMWindowProperty* property) |
| 577 { | 578 { |
| 578 m_properties.add(property); | 579 m_properties.add(property); |
| 579 } | 580 } |
| 580 | 581 |
| 581 void LocalDOMWindow::unregisterProperty(DOMWindowProperty* property) | 582 void LocalDOMWindow::unregisterProperty(DOMWindowProperty* property) |
| 582 { | 583 { |
| 583 m_properties.remove(property); | 584 m_properties.remove(property); |
| 584 } | 585 } |
| 585 | 586 |
| 586 void LocalDOMWindow::reset() | 587 void LocalDOMWindow::reset() |
| 587 { | 588 { |
| 588 willDestroyDocumentInFrame(); | 589 willDestroyDocumentInFrame(); |
|
Mads Ager (chromium)
2014/09/09 12:09:44
Look at all of this stuff we don't have to do in t
| |
| 589 resetDOMWindowProperties(); | |
| 590 } | |
| 591 | |
| 592 void LocalDOMWindow::resetDOMWindowProperties() | |
| 593 { | |
| 594 m_properties.clear(); | 590 m_properties.clear(); |
| 595 | 591 |
| 596 m_screen = nullptr; | 592 m_screen = nullptr; |
| 597 m_history = nullptr; | 593 m_history = nullptr; |
| 598 m_locationbar = nullptr; | 594 m_locationbar = nullptr; |
| 599 m_menubar = nullptr; | 595 m_menubar = nullptr; |
| 600 m_personalbar = nullptr; | 596 m_personalbar = nullptr; |
| 601 m_scrollbars = nullptr; | 597 m_scrollbars = nullptr; |
| 602 m_statusbar = nullptr; | 598 m_statusbar = nullptr; |
| 603 m_toolbar = nullptr; | 599 m_toolbar = nullptr; |
| (...skipping 1287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1891 } | 1887 } |
| 1892 | 1888 |
| 1893 PassOwnPtr<LifecycleNotifier<LocalDOMWindow> > LocalDOMWindow::createLifecycleNo tifier() | 1889 PassOwnPtr<LifecycleNotifier<LocalDOMWindow> > LocalDOMWindow::createLifecycleNo tifier() |
| 1894 { | 1890 { |
| 1895 return DOMWindowLifecycleNotifier::create(this); | 1891 return DOMWindowLifecycleNotifier::create(this); |
| 1896 } | 1892 } |
| 1897 | 1893 |
| 1898 void LocalDOMWindow::trace(Visitor* visitor) | 1894 void LocalDOMWindow::trace(Visitor* visitor) |
| 1899 { | 1895 { |
| 1900 visitor->trace(m_document); | 1896 visitor->trace(m_document); |
| 1897 #if ENABLE(OILPAN) | |
|
Mads Ager (chromium)
2014/09/09 12:09:44
nit: maybe just have the if around the entire body
sof
2014/09/09 12:53:58
ok.
| |
| 1898 visitor->trace(m_properties); | |
| 1899 #endif | |
| 1901 visitor->trace(m_screen); | 1900 visitor->trace(m_screen); |
| 1902 visitor->trace(m_history); | 1901 visitor->trace(m_history); |
| 1903 visitor->trace(m_locationbar); | 1902 visitor->trace(m_locationbar); |
| 1904 visitor->trace(m_menubar); | 1903 visitor->trace(m_menubar); |
| 1905 visitor->trace(m_personalbar); | 1904 visitor->trace(m_personalbar); |
| 1906 visitor->trace(m_scrollbars); | 1905 visitor->trace(m_scrollbars); |
| 1907 visitor->trace(m_statusbar); | 1906 visitor->trace(m_statusbar); |
| 1908 visitor->trace(m_toolbar); | 1907 visitor->trace(m_toolbar); |
| 1909 visitor->trace(m_console); | 1908 visitor->trace(m_console); |
| 1910 visitor->trace(m_navigator); | 1909 visitor->trace(m_navigator); |
| 1911 visitor->trace(m_location); | 1910 visitor->trace(m_location); |
| 1912 visitor->trace(m_media); | 1911 visitor->trace(m_media); |
| 1913 visitor->trace(m_sessionStorage); | 1912 visitor->trace(m_sessionStorage); |
| 1914 visitor->trace(m_localStorage); | 1913 visitor->trace(m_localStorage); |
| 1915 visitor->trace(m_applicationCache); | 1914 visitor->trace(m_applicationCache); |
| 1916 visitor->trace(m_performance); | 1915 visitor->trace(m_performance); |
| 1917 visitor->trace(m_css); | 1916 visitor->trace(m_css); |
| 1918 visitor->trace(m_eventQueue); | 1917 visitor->trace(m_eventQueue); |
| 1919 WillBeHeapSupplementable<LocalDOMWindow>::trace(visitor); | 1918 WillBeHeapSupplementable<LocalDOMWindow>::trace(visitor); |
| 1920 EventTargetWithInlineData::trace(visitor); | 1919 EventTargetWithInlineData::trace(visitor); |
| 1921 LifecycleContext<LocalDOMWindow>::trace(visitor); | 1920 LifecycleContext<LocalDOMWindow>::trace(visitor); |
| 1922 } | 1921 } |
| 1923 | 1922 |
| 1924 } // namespace blink | 1923 } // namespace blink |
| OLD | NEW |