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

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

Issue 908043002: Revert of Issue FrameDestructionObserver::frameDestroyed() notification on detach. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 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
« no previous file with comments | « Source/core/frame/LocalDOMWindow.h ('k') | Source/core/frame/LocalFrame.cpp » ('j') | 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 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 { 137 {
138 visitor->trace(m_window); 138 visitor->trace(m_window);
139 FrameDestructionObserver::trace(visitor); 139 FrameDestructionObserver::trace(visitor);
140 } 140 }
141 141
142 void LocalDOMWindow::WindowFrameObserver::willDetachFrameHost() 142 void LocalDOMWindow::WindowFrameObserver::willDetachFrameHost()
143 { 143 {
144 m_window->willDetachFrameHost(); 144 m_window->willDetachFrameHost();
145 } 145 }
146 146
147 void LocalDOMWindow::WindowFrameObserver::frameDestroyed()
148 {
149 m_window->frameDestroyed();
150 FrameDestructionObserver::frameDestroyed();
151 }
152
153 class PostMessageTimer final : public NoBaseWillBeGarbageCollectedFinalized<Post MessageTimer>, public SuspendableTimer { 147 class PostMessageTimer final : public NoBaseWillBeGarbageCollectedFinalized<Post MessageTimer>, public SuspendableTimer {
154 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(PostMessageTimer); 148 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(PostMessageTimer);
155 public: 149 public:
156 PostMessageTimer(LocalDOMWindow& window, PassRefPtr<SerializedScriptValue> m essage, const String& sourceOrigin, PassRefPtrWillBeRawPtr<LocalDOMWindow> sourc e, PassOwnPtr<MessagePortChannelArray> channels, SecurityOrigin* targetOrigin, P assRefPtrWillBeRawPtr<ScriptCallStack> stackTrace, UserGestureToken* userGesture Token) 150 PostMessageTimer(LocalDOMWindow& window, PassRefPtr<SerializedScriptValue> m essage, const String& sourceOrigin, PassRefPtrWillBeRawPtr<LocalDOMWindow> sourc e, PassOwnPtr<MessagePortChannelArray> channels, SecurityOrigin* targetOrigin, P assRefPtrWillBeRawPtr<ScriptCallStack> stackTrace, UserGestureToken* userGesture Token)
157 : SuspendableTimer(window.document()) 151 : SuspendableTimer(window.document())
158 , m_window(&window) 152 , m_window(&window)
159 , m_message(message) 153 , m_message(message)
160 , m_origin(sourceOrigin) 154 , m_origin(sourceOrigin)
161 , m_source(source) 155 , m_source(source)
162 , m_channels(channels) 156 , m_channels(channels)
(...skipping 430 matching lines...) Expand 10 before | Expand all | Expand 10 after
593 return frame() ? frame()->page() : nullptr; 587 return frame() ? frame()->page() : nullptr;
594 } 588 }
595 589
596 void LocalDOMWindow::willDetachFrameHost() 590 void LocalDOMWindow::willDetachFrameHost()
597 { 591 {
598 frame()->host()->eventHandlerRegistry().didRemoveAllEventHandlers(*this); 592 frame()->host()->eventHandlerRegistry().didRemoveAllEventHandlers(*this);
599 frame()->host()->consoleMessageStorage().frameWindowDiscarded(this); 593 frame()->host()->consoleMessageStorage().frameWindowDiscarded(this);
600 LocalDOMWindow::notifyContextDestroyed(); 594 LocalDOMWindow::notifyContextDestroyed();
601 } 595 }
602 596
603 void LocalDOMWindow::frameDestroyed()
604 {
605 willDestroyDocumentInFrame();
606 m_properties.clear();
607 }
608
609 void LocalDOMWindow::willDestroyDocumentInFrame() 597 void LocalDOMWindow::willDestroyDocumentInFrame()
610 { 598 {
611 for (const auto& domWindowProperty : m_properties) 599 for (const auto& domWindowProperty : m_properties)
612 domWindowProperty->willDestroyGlobalObjectInFrame(); 600 domWindowProperty->willDestroyGlobalObjectInFrame();
613 } 601 }
614 602
615 void LocalDOMWindow::willDetachDocumentFromFrame() 603 void LocalDOMWindow::willDetachDocumentFromFrame()
616 { 604 {
617 for (const auto& domWindowProperty : m_properties) 605 for (const auto& domWindowProperty : m_properties)
618 domWindowProperty->willDetachGlobalObjectFromFrame(); 606 domWindowProperty->willDetachGlobalObjectFromFrame();
619 } 607 }
620 608
621 void LocalDOMWindow::registerProperty(DOMWindowProperty* property) 609 void LocalDOMWindow::registerProperty(DOMWindowProperty* property)
622 { 610 {
623 m_properties.add(property); 611 m_properties.add(property);
624 } 612 }
625 613
626 void LocalDOMWindow::unregisterProperty(DOMWindowProperty* property) 614 void LocalDOMWindow::unregisterProperty(DOMWindowProperty* property)
627 { 615 {
628 m_properties.remove(property); 616 m_properties.remove(property);
629 } 617 }
630 618
631 void LocalDOMWindow::reset() 619 void LocalDOMWindow::reset()
632 { 620 {
633 frameDestroyed(); 621 willDestroyDocumentInFrame();
622 m_properties.clear();
634 623
635 m_screen = nullptr; 624 m_screen = nullptr;
636 m_history = nullptr; 625 m_history = nullptr;
637 m_locationbar = nullptr; 626 m_locationbar = nullptr;
638 m_menubar = nullptr; 627 m_menubar = nullptr;
639 m_personalbar = nullptr; 628 m_personalbar = nullptr;
640 m_scrollbars = nullptr; 629 m_scrollbars = nullptr;
641 m_statusbar = nullptr; 630 m_statusbar = nullptr;
642 m_toolbar = nullptr; 631 m_toolbar = nullptr;
643 m_console = nullptr; 632 m_console = nullptr;
(...skipping 1214 matching lines...) Expand 10 before | Expand all | Expand 10 after
1858 return m_frameObserver->frame(); 1847 return m_frameObserver->frame();
1859 } 1848 }
1860 1849
1861 v8::Handle<v8::Object> LocalDOMWindow::wrap(v8::Handle<v8::Object> creationConte xt, v8::Isolate* isolate) 1850 v8::Handle<v8::Object> LocalDOMWindow::wrap(v8::Handle<v8::Object> creationConte xt, v8::Isolate* isolate)
1862 { 1851 {
1863 ASSERT_NOT_REACHED(); // LocalDOMWindow has [Custom=ToV8]. 1852 ASSERT_NOT_REACHED(); // LocalDOMWindow has [Custom=ToV8].
1864 return v8::Handle<v8::Object>(); 1853 return v8::Handle<v8::Object>();
1865 } 1854 }
1866 1855
1867 } // namespace blink 1856 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/frame/LocalDOMWindow.h ('k') | Source/core/frame/LocalFrame.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698