Chromium Code Reviews| 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 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 84 | 84 |
| 85 typedef Vector<RefPtr<MessagePort>, 1> MessagePortArray; | 85 typedef Vector<RefPtr<MessagePort>, 1> MessagePortArray; |
| 86 | 86 |
| 87 enum PageshowEventPersistence { | 87 enum PageshowEventPersistence { |
| 88 PageshowEventNotPersisted = 0, | 88 PageshowEventNotPersisted = 0, |
| 89 PageshowEventPersisted = 1 | 89 PageshowEventPersisted = 1 |
| 90 }; | 90 }; |
| 91 | 91 |
| 92 enum SetLocationLocking { LockHistoryBasedOnGestureState, LockHistoryAndBack ForwardList }; | 92 enum SetLocationLocking { LockHistoryBasedOnGestureState, LockHistoryAndBack ForwardList }; |
| 93 | 93 |
| 94 class DOMWindow FINAL : public RefCounted<DOMWindow>, public ScriptWrappable , public EventTargetWithInlineData, public FrameDestructionObserver, public Supp lementable<DOMWindow>, public LifecycleContext<DOMWindow> { | 94 class DOMWindow FINAL : public RefCountedWillBeRefCountedGarbageCollected<DO MWindow>, public ScriptWrappable, public EventTargetWithInlineData, public Frame DestructionObserver, public Supplementable<DOMWindow>, public LifecycleContext<D OMWindow> { |
|
haraken
2014/03/26 01:13:32
Don't you need to use WillBeHeapSupplementable<DOM
sof
2014/03/26 06:36:46
I would prefer to do it later; as long as the supp
sof
2014/03/26 07:44:27
The one interesting case is DOMWindowPagePopup::~D
haraken
2014/03/26 08:07:16
Makes sense. Agreed with the point that it's safe
| |
| 95 REFCOUNTED_EVENT_TARGET(DOMWindow); | 95 DEFINE_EVENT_TARGET_REFCOUNTING(RefCountedWillBeRefCountedGarbageCollect ed<DOMWindow>); |
| 96 public: | 96 public: |
| 97 static PassRefPtr<Document> createDocument(const String& mimeType, const DocumentInit&, bool forceXHTML); | 97 static PassRefPtr<Document> createDocument(const String& mimeType, const DocumentInit&, bool forceXHTML); |
| 98 static PassRefPtr<DOMWindow> create(LocalFrame& frame) { return adoptRef (new DOMWindow(frame)); } | 98 static PassRefPtrWillBeRawPtr<DOMWindow> create(LocalFrame& frame) |
| 99 { | |
| 100 return adoptRefWillBeRefCountedGarbageCollected(new DOMWindow(frame) ); | |
| 101 } | |
| 99 virtual ~DOMWindow(); | 102 virtual ~DOMWindow(); |
| 100 | 103 |
| 101 PassRefPtr<Document> installNewDocument(const String& mimeType, const Do cumentInit&, bool forceXHTML = false); | 104 PassRefPtr<Document> installNewDocument(const String& mimeType, const Do cumentInit&, bool forceXHTML = false); |
| 102 | 105 |
| 103 virtual const AtomicString& interfaceName() const OVERRIDE; | 106 virtual const AtomicString& interfaceName() const OVERRIDE; |
| 104 virtual ExecutionContext* executionContext() const OVERRIDE; | 107 virtual ExecutionContext* executionContext() const OVERRIDE; |
| 105 | 108 |
| 106 virtual DOMWindow* toDOMWindow() OVERRIDE; | 109 virtual DOMWindow* toDOMWindow() OVERRIDE; |
| 107 | 110 |
| 108 void registerProperty(DOMWindowProperty*); | 111 void registerProperty(DOMWindowProperty*); |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 141 DOMSelection* getSelection(); | 144 DOMSelection* getSelection(); |
| 142 | 145 |
| 143 Element* frameElement() const; | 146 Element* frameElement() const; |
| 144 | 147 |
| 145 void focus(ExecutionContext* = 0); | 148 void focus(ExecutionContext* = 0); |
| 146 void blur(); | 149 void blur(); |
| 147 void close(ExecutionContext* = 0); | 150 void close(ExecutionContext* = 0); |
| 148 void print(); | 151 void print(); |
| 149 void stop(); | 152 void stop(); |
| 150 | 153 |
| 151 PassRefPtr<DOMWindow> open(const String& urlString, const AtomicString& frameName, const String& windowFeaturesString, | 154 PassRefPtrWillBeRawPtr<DOMWindow> open(const String& urlString, const At omicString& frameName, const String& windowFeaturesString, |
| 152 DOMWindow* callingWindow, DOMWindow* enteredWindow); | 155 DOMWindow* callingWindow, DOMWindow* enteredWindow); |
| 153 | 156 |
| 154 typedef void (*PrepareDialogFunction)(DOMWindow*, void* context); | 157 typedef void (*PrepareDialogFunction)(DOMWindow*, void* context); |
| 155 void showModalDialog(const String& urlString, const String& dialogFeatur esString, | 158 void showModalDialog(const String& urlString, const String& dialogFeatur esString, |
| 156 DOMWindow* callingWindow, DOMWindow* enteredWindow, PrepareDialogFun ction, void* functionContext); | 159 DOMWindow* callingWindow, DOMWindow* enteredWindow, PrepareDialogFun ction, void* functionContext); |
| 157 | 160 |
| 158 void alert(const String& message); | 161 void alert(const String& message); |
| 159 bool confirm(const String& message); | 162 bool confirm(const String& message); |
| 160 String prompt(const String& message, const String& defaultValue); | 163 String prompt(const String& message, const String& defaultValue); |
| 161 | 164 |
| (...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 315 void enqueuePageshowEvent(PageshowEventPersistence); | 318 void enqueuePageshowEvent(PageshowEventPersistence); |
| 316 void enqueueHashchangeEvent(const String& oldURL, const String& newURL); | 319 void enqueueHashchangeEvent(const String& oldURL, const String& newURL); |
| 317 void enqueuePopstateEvent(PassRefPtr<SerializedScriptValue>); | 320 void enqueuePopstateEvent(PassRefPtr<SerializedScriptValue>); |
| 318 void dispatchWindowLoadEvent(); | 321 void dispatchWindowLoadEvent(); |
| 319 void documentWasClosed(); | 322 void documentWasClosed(); |
| 320 void statePopped(PassRefPtr<SerializedScriptValue>); | 323 void statePopped(PassRefPtr<SerializedScriptValue>); |
| 321 | 324 |
| 322 // FIXME: This shouldn't be public once DOMWindow becomes ExecutionConte xt. | 325 // FIXME: This shouldn't be public once DOMWindow becomes ExecutionConte xt. |
| 323 void clearEventQueue(); | 326 void clearEventQueue(); |
| 324 | 327 |
| 328 void trace(Visitor*); | |
| 329 | |
| 325 protected: | 330 protected: |
| 326 DOMWindowLifecycleNotifier& lifecycleNotifier(); | 331 DOMWindowLifecycleNotifier& lifecycleNotifier(); |
| 327 | 332 |
| 328 private: | 333 private: |
| 329 explicit DOMWindow(LocalFrame&); | 334 explicit DOMWindow(LocalFrame&); |
| 330 | 335 |
| 331 Page* page(); | 336 Page* page(); |
| 332 | 337 |
| 333 virtual void frameDestroyed() OVERRIDE; | 338 virtual void frameDestroyed() OVERRIDE; |
| 334 virtual void willDetachFrameHost() OVERRIDE; | 339 virtual void willDetachFrameHost() OVERRIDE; |
| 335 | 340 |
| 336 void clearDocument(); | 341 void clearDocument(); |
| 337 void resetDOMWindowProperties(); | 342 void resetDOMWindowProperties(); |
| 338 void willDestroyDocumentInFrame(); | 343 void willDestroyDocumentInFrame(); |
| 339 | 344 |
| 340 RefPtr<Document> m_document; | 345 RefPtr<Document> m_document; |
| 341 | 346 |
| 342 bool m_shouldPrintWhenFinishedLoading; | 347 bool m_shouldPrintWhenFinishedLoading; |
| 343 | 348 |
| 344 HashSet<DOMWindowProperty*> m_properties; | 349 HashSet<DOMWindowProperty*> m_properties; |
| 345 | 350 |
| 346 mutable RefPtrWillBePersistent<Screen> m_screen; | 351 mutable RefPtrWillBeMember<Screen> m_screen; |
| 347 mutable RefPtrWillBePersistent<History> m_history; | 352 mutable RefPtrWillBeMember<History> m_history; |
| 348 mutable RefPtr<BarProp> m_locationbar; | 353 mutable RefPtrWillBeMember<BarProp> m_locationbar; |
| 349 mutable RefPtr<BarProp> m_menubar; | 354 mutable RefPtrWillBeMember<BarProp> m_menubar; |
| 350 mutable RefPtr<BarProp> m_personalbar; | 355 mutable RefPtrWillBeMember<BarProp> m_personalbar; |
| 351 mutable RefPtr<BarProp> m_scrollbars; | 356 mutable RefPtrWillBeMember<BarProp> m_scrollbars; |
| 352 mutable RefPtr<BarProp> m_statusbar; | 357 mutable RefPtrWillBeMember<BarProp> m_statusbar; |
| 353 mutable RefPtr<BarProp> m_toolbar; | 358 mutable RefPtrWillBeMember<BarProp> m_toolbar; |
| 354 mutable RefPtrWillBePersistent<Console> m_console; | 359 mutable RefPtrWillBeMember<Console> m_console; |
| 355 mutable RefPtrWillBePersistent<Navigator> m_navigator; | 360 mutable RefPtrWillBeMember<Navigator> m_navigator; |
| 356 mutable RefPtrWillBePersistent<Location> m_location; | 361 mutable RefPtrWillBeMember<Location> m_location; |
| 357 mutable RefPtr<StyleMedia> m_media; | 362 mutable RefPtr<StyleMedia> m_media; |
| 358 | 363 |
| 359 String m_status; | 364 String m_status; |
| 360 String m_defaultStatus; | 365 String m_defaultStatus; |
| 361 | 366 |
| 362 mutable RefPtrWillBePersistent<Storage> m_sessionStorage; | 367 mutable RefPtrWillBeMember<Storage> m_sessionStorage; |
| 363 mutable RefPtrWillBePersistent<Storage> m_localStorage; | 368 mutable RefPtrWillBeMember<Storage> m_localStorage; |
| 364 mutable RefPtrWillBePersistent<ApplicationCache> m_applicationCache; | 369 mutable RefPtrWillBeMember<ApplicationCache> m_applicationCache; |
| 365 | 370 |
| 366 mutable RefPtrWillBePersistent<Performance> m_performance; | 371 mutable RefPtrWillBeMember<Performance> m_performance; |
| 367 | 372 |
| 368 mutable RefPtr<DOMWindowCSS> m_css; | 373 mutable RefPtr<DOMWindowCSS> m_css; |
| 369 | 374 |
| 370 RefPtr<DOMWindowEventQueue> m_eventQueue; | 375 RefPtr<DOMWindowEventQueue> m_eventQueue; |
| 371 RefPtr<SerializedScriptValue> m_pendingStateObject; | 376 RefPtr<SerializedScriptValue> m_pendingStateObject; |
| 372 }; | 377 }; |
| 373 | 378 |
| 374 inline String DOMWindow::status() const | 379 inline String DOMWindow::status() const |
| 375 { | 380 { |
| 376 return m_status; | 381 return m_status; |
| 377 } | 382 } |
| 378 | 383 |
| 379 inline String DOMWindow::defaultStatus() const | 384 inline String DOMWindow::defaultStatus() const |
| 380 { | 385 { |
| 381 return m_defaultStatus; | 386 return m_defaultStatus; |
| 382 } | 387 } |
| 383 | 388 |
| 384 } // namespace WebCore | 389 } // namespace WebCore |
| 385 | 390 |
| 386 #endif // DOMWindow_h | 391 #endif // DOMWindow_h |
| OLD | NEW |