| OLD | NEW |
| 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 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 294 protected: | 294 protected: |
| 295 DOMWindowLifecycleNotifier& lifecycleNotifier(); | 295 DOMWindowLifecycleNotifier& lifecycleNotifier(); |
| 296 | 296 |
| 297 private: | 297 private: |
| 298 // Rather than simply inheriting FrameDestructionObserver like most other | 298 // Rather than simply inheriting FrameDestructionObserver like most other |
| 299 // classes, LocalDOMWindow hides its FrameDestructionObserver with | 299 // classes, LocalDOMWindow hides its FrameDestructionObserver with |
| 300 // composition. This prevents conflicting overloads between DOMWindow, which | 300 // composition. This prevents conflicting overloads between DOMWindow, which |
| 301 // has a frame() accessor that returns Frame* for bindings code, and | 301 // has a frame() accessor that returns Frame* for bindings code, and |
| 302 // FrameDestructionObserver, which has a frame() accessor that returns a | 302 // FrameDestructionObserver, which has a frame() accessor that returns a |
| 303 // LocalFrame*. | 303 // LocalFrame*. |
| 304 class WindowFrameObserver final : public FrameDestructionObserver { | 304 class WindowFrameObserver final : public NoBaseWillBeGarbageCollected<Window
FrameObserver>, public FrameDestructionObserver { |
| 305 WTF_MAKE_FAST_ALLOCATED_WILL_BE_REMOVED; |
| 306 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(WindowFrameObserver); |
| 307 DECLARE_EMPTY_VIRTUAL_DESTRUCTOR_WILL_BE_REMOVED(WindowFrameObserver); |
| 305 public: | 308 public: |
| 306 WindowFrameObserver(LocalDOMWindow&, LocalFrame&); | 309 static PassOwnPtrWillBeRawPtr<WindowFrameObserver> create(LocalDOMWindow
*, LocalFrame&); |
| 310 |
| 311 virtual void trace(Visitor*) override; |
| 307 | 312 |
| 308 private: | 313 private: |
| 314 WindowFrameObserver(LocalDOMWindow*, LocalFrame&); |
| 315 |
| 309 // FrameDestructionObserver overrides: | 316 // FrameDestructionObserver overrides: |
| 310 void willDetachFrameHost() override; | 317 void willDetachFrameHost() override; |
| 311 | 318 |
| 312 LocalDOMWindow& m_window; | 319 RawPtrWillBeMember<LocalDOMWindow> m_window; |
| 313 }; | 320 }; |
| 321 friend WTF::OwnedPtrDeleter<WindowFrameObserver>; |
| 314 | 322 |
| 315 explicit LocalDOMWindow(LocalFrame&); | 323 explicit LocalDOMWindow(LocalFrame&); |
| 316 | 324 |
| 317 Page* page(); | 325 Page* page(); |
| 318 | 326 |
| 319 void clearDocument(); | 327 void clearDocument(); |
| 320 void willDestroyDocumentInFrame(); | 328 void willDestroyDocumentInFrame(); |
| 321 | 329 |
| 322 // FIXME: Oilpan: the need for this internal method will fall | 330 // FIXME: Oilpan: the need for this internal method will fall |
| 323 // away when EventTargets are no longer using refcounts and | 331 // away when EventTargets are no longer using refcounts and |
| 324 // window properties are also on the heap. Inline the minimal | 332 // window properties are also on the heap. Inline the minimal |
| 325 // do-not-broadcast handling then and remove the enum + | 333 // do-not-broadcast handling then and remove the enum + |
| 326 // removeAllEventListenersInternal(). | 334 // removeAllEventListenersInternal(). |
| 327 enum BroadcastListenerRemoval { | 335 enum BroadcastListenerRemoval { |
| 328 DoNotBroadcastListenerRemoval, | 336 DoNotBroadcastListenerRemoval, |
| 329 DoBroadcastListenerRemoval | 337 DoBroadcastListenerRemoval |
| 330 }; | 338 }; |
| 331 | 339 |
| 332 void willDetachFrameHost(); | 340 void willDetachFrameHost(); |
| 333 void removeAllEventListenersInternal(BroadcastListenerRemoval); | 341 void removeAllEventListenersInternal(BroadcastListenerRemoval); |
| 334 | 342 |
| 335 WindowFrameObserver m_frameObserver; | 343 OwnPtrWillBeMember<WindowFrameObserver> m_frameObserver; |
| 336 RefPtrWillBeMember<Document> m_document; | 344 RefPtrWillBeMember<Document> m_document; |
| 337 | 345 |
| 338 bool m_shouldPrintWhenFinishedLoading; | 346 bool m_shouldPrintWhenFinishedLoading; |
| 339 #if ENABLE(ASSERT) | 347 #if ENABLE(ASSERT) |
| 340 bool m_hasBeenReset; | 348 bool m_hasBeenReset; |
| 341 #endif | 349 #endif |
| 342 | 350 |
| 343 WillBeHeapHashSet<RawPtrWillBeWeakMember<DOMWindowProperty> > m_properties; | 351 WillBeHeapHashSet<RawPtrWillBeWeakMember<DOMWindowProperty> > m_properties; |
| 344 | 352 |
| 345 mutable RefPtrWillBeMember<Screen> m_screen; | 353 mutable RefPtrWillBeMember<Screen> m_screen; |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 378 } | 386 } |
| 379 | 387 |
| 380 inline String LocalDOMWindow::defaultStatus() const | 388 inline String LocalDOMWindow::defaultStatus() const |
| 381 { | 389 { |
| 382 return m_defaultStatus; | 390 return m_defaultStatus; |
| 383 } | 391 } |
| 384 | 392 |
| 385 } // namespace blink | 393 } // namespace blink |
| 386 | 394 |
| 387 #endif // LocalDOMWindow_h | 395 #endif // LocalDOMWindow_h |
| OLD | NEW |