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

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

Issue 1017043002: Remove all event listeners during window's frame destruction step. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Improve LocalDOMWindow::dispose() comment a bit Created 5 years, 9 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/DOMWindowLifecycleObserver.h ('k') | Source/core/frame/LocalDOMWindow.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, 2009, 2010 Apple Inc. All rights reserved. 2 * Copyright (C) 2006, 2007, 2009, 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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 56
57 enum PageshowEventPersistence { 57 enum PageshowEventPersistence {
58 PageshowEventNotPersisted = 0, 58 PageshowEventNotPersisted = 0,
59 PageshowEventPersisted = 1 59 PageshowEventPersisted = 1
60 }; 60 };
61 61
62 // Note: if you're thinking of returning something DOM-related by reference, 62 // Note: if you're thinking of returning something DOM-related by reference,
63 // please ping dcheng@chromium.org first. You probably don't want to do that. 63 // please ping dcheng@chromium.org first. You probably don't want to do that.
64 class LocalDOMWindow final : public DOMWindow, public WillBeHeapSupplementable<L ocalDOMWindow>, public DOMWindowLifecycleNotifier { 64 class LocalDOMWindow final : public DOMWindow, public WillBeHeapSupplementable<L ocalDOMWindow>, public DOMWindowLifecycleNotifier {
65 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(LocalDOMWindow); 65 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(LocalDOMWindow);
66 WILL_BE_USING_PRE_FINALIZER(LocalDOMWindow, dispose);
66 public: 67 public:
67 static PassRefPtrWillBeRawPtr<Document> createDocument(const String& mimeTyp e, const DocumentInit&, bool forceXHTML); 68 static PassRefPtrWillBeRawPtr<Document> createDocument(const String& mimeTyp e, const DocumentInit&, bool forceXHTML);
68 static PassRefPtrWillBeRawPtr<LocalDOMWindow> create(LocalFrame& frame) 69 static PassRefPtrWillBeRawPtr<LocalDOMWindow> create(LocalFrame& frame)
69 { 70 {
70 return adoptRefWillBeNoop(new LocalDOMWindow(frame)); 71 return adoptRefWillBeNoop(new LocalDOMWindow(frame));
71 } 72 }
72 virtual ~LocalDOMWindow(); 73 virtual ~LocalDOMWindow();
74 void dispose();
73 75
74 PassRefPtrWillBeRawPtr<Document> installNewDocument(const String& mimeType, const DocumentInit&, bool forceXHTML = false); 76 PassRefPtrWillBeRawPtr<Document> installNewDocument(const String& mimeType, const DocumentInit&, bool forceXHTML = false);
75 77
76 // EventTarget overrides: 78 // EventTarget overrides:
77 virtual const AtomicString& interfaceName() const override; 79 virtual const AtomicString& interfaceName() const override;
78 virtual ExecutionContext* executionContext() const override; 80 virtual ExecutionContext* executionContext() const override;
79 virtual LocalDOMWindow* toDOMWindow() override; 81 virtual LocalDOMWindow* toDOMWindow() override;
80 82
81 // DOMWindow overrides: 83 // DOMWindow overrides:
82 DECLARE_VIRTUAL_TRACE(); 84 DECLARE_VIRTUAL_TRACE();
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
236 }; 238 };
237 friend WTF::OwnedPtrDeleter<WindowFrameObserver>; 239 friend WTF::OwnedPtrDeleter<WindowFrameObserver>;
238 240
239 explicit LocalDOMWindow(LocalFrame&); 241 explicit LocalDOMWindow(LocalFrame&);
240 242
241 Page* page(); 243 Page* page();
242 244
243 void clearDocument(); 245 void clearDocument();
244 void willDestroyDocumentInFrame(); 246 void willDestroyDocumentInFrame();
245 247
246 // FIXME: Oilpan: the need for this internal method will fall
247 // away when EventTargets are no longer using refcounts and
248 // window properties are also on the heap. Inline the minimal
249 // do-not-broadcast handling then and remove the enum +
250 // removeAllEventListenersInternal().
251 enum BroadcastListenerRemoval {
252 DoNotBroadcastListenerRemoval,
253 DoBroadcastListenerRemoval
254 };
255
256 void willDetachFrameHost(); 248 void willDetachFrameHost();
257 void frameDestroyed(); 249 void frameDestroyed();
258 void removeAllEventListenersInternal(BroadcastListenerRemoval);
259 250
260 OwnPtrWillBeMember<WindowFrameObserver> m_frameObserver; 251 OwnPtrWillBeMember<WindowFrameObserver> m_frameObserver;
261 RefPtrWillBeMember<Document> m_document; 252 RefPtrWillBeMember<Document> m_document;
262 253
263 bool m_shouldPrintWhenFinishedLoading; 254 bool m_shouldPrintWhenFinishedLoading;
264 #if ENABLE(ASSERT) 255 #if ENABLE(ASSERT)
265 bool m_hasBeenReset; 256 bool m_hasBeenReset;
266 #endif 257 #endif
267 258
268 WillBeHeapHashSet<RawPtrWillBeWeakMember<DOMWindowProperty>> m_properties; 259 WillBeHeapHashSet<RawPtrWillBeWeakMember<DOMWindowProperty>> m_properties;
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
300 } 291 }
301 292
302 inline String LocalDOMWindow::defaultStatus() const 293 inline String LocalDOMWindow::defaultStatus() const
303 { 294 {
304 return m_defaultStatus; 295 return m_defaultStatus;
305 } 296 }
306 297
307 } // namespace blink 298 } // namespace blink
308 299
309 #endif // LocalDOMWindow_h 300 #endif // LocalDOMWindow_h
OLDNEW
« no previous file with comments | « Source/core/frame/DOMWindowLifecycleObserver.h ('k') | Source/core/frame/LocalDOMWindow.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698