Changeset 104380 in webkit
- Timestamp:
- Jan 7, 2012 12:46:38 AM (12 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 41 edited
- 2 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/CMakeLists.txt
r104344 r104380 990 990 page/DOMTimer.cpp 991 991 page/DOMWindow.cpp 992 page/DOMWindowProperty.cpp 992 993 page/DragController.cpp 993 994 page/EventHandler.cpp -
trunk/Source/WebCore/ChangeLog
r104378 r104380 1 2012-01-07 Adam Barth <abarth@webkit.org> 2 3 Disconnecting DOMWindow properties is fragile and overly complicated 4 https://bugs.webkit.org/show_bug.cgi?id=75699 5 6 Reviewed by Alexey Proskuryakov. 7 8 Previously, we had to carefully check every object tree hanging off of 9 DOMWindow to make sure that every property correctly disconnected 10 itself and all its subobjects from the Frame when the DOMWindow 11 disconnected from the Frame. 12 13 This patch introduces DOMWindowProperty, which is a base class that 14 handles this work automagically, ensuring that we won't have any 15 dangling Frame pointers and removing a bunch of boilerplate code. 16 17 * CMakeLists.txt: 18 * GNUmakefile.list.am: 19 * Target.pri: 20 * WebCore.gypi: 21 * WebCore.vcproj/WebCore.vcproj: 22 * css/StyleMedia.cpp: 23 (WebCore::StyleMedia::StyleMedia): 24 * css/StyleMedia.h: 25 (WebCore::StyleMedia::create): 26 * loader/appcache/DOMApplicationCache.cpp: 27 (WebCore::DOMApplicationCache::DOMApplicationCache): 28 (WebCore::DOMApplicationCache::disconnectFrame): 29 * loader/appcache/DOMApplicationCache.h: 30 * page/BarInfo.cpp: 31 (WebCore::BarInfo::BarInfo): 32 * page/BarInfo.h: 33 * page/Console.cpp: 34 (WebCore::Console::Console): 35 (WebCore::Console::memory): 36 * page/Console.h: 37 * page/DOMSelection.cpp: 38 (WebCore::DOMSelection::DOMSelection): 39 * page/DOMSelection.h: 40 * page/DOMWindow.cpp: 41 (WebCore::DOMWindow::registerProperty): 42 (WebCore::DOMWindow::unregisterProperty): 43 (WebCore::DOMWindow::clear): 44 * page/DOMWindow.h: 45 * page/Geolocation.cpp: 46 (WebCore::Geolocation::Geolocation): 47 (WebCore::Geolocation::disconnectFrame): 48 * page/Geolocation.h: 49 * page/History.cpp: 50 (WebCore::History::History): 51 * page/History.h: 52 * page/Location.cpp: 53 (WebCore::Location::Location): 54 * page/Location.h: 55 * page/Navigator.cpp: 56 (WebCore::Navigator::Navigator): 57 (WebCore::Navigator::~Navigator): 58 * page/Navigator.h: 59 * page/Performance.cpp: 60 (WebCore::Performance::Performance): 61 (WebCore::Performance::memory): 62 * page/Performance.h: 63 * page/PerformanceNavigation.cpp: 64 (WebCore::PerformanceNavigation::PerformanceNavigation): 65 * page/PerformanceNavigation.h: 66 * page/PerformanceTiming.cpp: 67 (WebCore::PerformanceTiming::PerformanceTiming): 68 * page/PerformanceTiming.h: 69 * page/Screen.cpp: 70 (WebCore::Screen::Screen): 71 * page/Screen.h: 72 * plugins/DOMMimeTypeArray.cpp: 73 (WebCore::DOMMimeTypeArray::DOMMimeTypeArray): 74 * plugins/DOMMimeTypeArray.h: 75 * plugins/DOMPluginArray.cpp: 76 (WebCore::DOMPluginArray::DOMPluginArray): 77 * plugins/DOMPluginArray.h: 78 * storage/Storage.cpp: 79 (WebCore::Storage::Storage): 80 * storage/Storage.h: 81 1 82 2012-01-06 Mark Rowe <mrowe@apple.com> 2 83 -
trunk/Source/WebCore/GNUmakefile.list.am
r104344 r104380 2647 2647 Source/WebCore/page/DOMWindow.cpp \ 2648 2648 Source/WebCore/page/DOMWindow.h \ 2649 Source/WebCore/page/DOMWindowProperty.cpp \ 2650 Source/WebCore/page/DOMWindowProperty.h \ 2649 2651 Source/WebCore/page/DragActions.h \ 2650 2652 Source/WebCore/page/DragClient.h \ -
trunk/Source/WebCore/Target.pri
r104344 r104380 968 968 page/DOMTimer.cpp \ 969 969 page/DOMWindow.cpp \ 970 page/DOMWindowProperty.cpp \ 970 971 page/DragController.cpp \ 971 972 page/EventHandler.cpp \ -
trunk/Source/WebCore/WebCore.gypi
r104368 r104380 2992 2992 'page/DOMTimer.h', 2993 2993 'page/DOMWindow.cpp', 2994 'page/DOMWindowProperty.cpp', 2995 'page/DOMWindowProperty.h', 2994 2996 'page/DragController.cpp', 2995 2997 'page/EventHandler.cpp', -
trunk/Source/WebCore/WebCore.vcproj/WebCore.vcproj
r104344 r104380 25187 25187 </File> 25188 25188 <File 25189 RelativePath="..\page\DOMWindowProperty.cpp" 25190 > 25191 </File> 25192 <File 25193 RelativePath="..\page\DOMWindowProperty.h" 25194 > 25195 </File> 25196 <File 25189 25197 RelativePath="..\page\DragActions.h" 25190 25198 > -
trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj
r104344 r104380 3370 3370 97C471DB12F925BD0086354B /* ContentSecurityPolicy.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 97C471D912F925BC0086354B /* ContentSecurityPolicy.cpp */; }; 3371 3371 97C471DC12F925BD0086354B /* ContentSecurityPolicy.h in Headers */ = {isa = PBXBuildFile; fileRef = 97C471DA12F925BD0086354B /* ContentSecurityPolicy.h */; settings = {ATTRIBUTES = (Private, ); }; }; 3372 97D2AD0314B823A60093DF32 /* DOMWindowProperty.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 97D2AD0114B823A60093DF32 /* DOMWindowProperty.cpp */; }; 3373 97D2AD0414B823A60093DF32 /* DOMWindowProperty.h in Headers */ = {isa = PBXBuildFile; fileRef = 97D2AD0214B823A60093DF32 /* DOMWindowProperty.h */; settings = {ATTRIBUTES = (Private, ); }; }; 3372 3374 97DCE20110807C750057D394 /* HistoryController.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 97DCE1FF10807C750057D394 /* HistoryController.cpp */; }; 3373 3375 97DCE20210807C750057D394 /* HistoryController.h in Headers */ = {isa = PBXBuildFile; fileRef = 97DCE20010807C750057D394 /* HistoryController.h */; settings = {ATTRIBUTES = (Private, ); }; }; … … 10630 10632 97C471D912F925BC0086354B /* ContentSecurityPolicy.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ContentSecurityPolicy.cpp; sourceTree = "<group>"; }; 10631 10633 97C471DA12F925BD0086354B /* ContentSecurityPolicy.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ContentSecurityPolicy.h; sourceTree = "<group>"; }; 10634 97D2AD0114B823A60093DF32 /* DOMWindowProperty.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DOMWindowProperty.cpp; sourceTree = "<group>"; }; 10635 97D2AD0214B823A60093DF32 /* DOMWindowProperty.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DOMWindowProperty.h; sourceTree = "<group>"; }; 10632 10636 97DCE1FF10807C750057D394 /* HistoryController.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = HistoryController.cpp; sourceTree = "<group>"; }; 10633 10637 97DCE20010807C750057D394 /* HistoryController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HistoryController.h; sourceTree = "<group>"; }; … … 15654 15658 1403B99509EB13AF00797C7F /* DOMWindow.h */, 15655 15659 1403B90C09EB124500797C7F /* DOMWindow.idl */, 15660 97D2AD0114B823A60093DF32 /* DOMWindowProperty.cpp */, 15661 97D2AD0214B823A60093DF32 /* DOMWindowProperty.h */, 15656 15662 A718760D0B2A120100A16ECE /* DragActions.h */, 15657 15663 A7CA59620B27C1F200FA021D /* DragClient.h */, … … 24884 24890 FD537353137B651800008DCE /* ZeroPole.h in Headers */, 24885 24891 974A862314B7ADBB003FDC76 /* FrameDestructionObserver.h in Headers */, 24892 97D2AD0414B823A60093DF32 /* DOMWindowProperty.h in Headers */, 24886 24893 ); 24887 24894 runOnlyForDeploymentPostprocessing = 0; … … 27788 27795 FD537352137B651800008DCE /* ZeroPole.cpp in Sources */, 27789 27796 974A862214B7ADBB003FDC76 /* FrameDestructionObserver.cpp in Sources */, 27797 97D2AD0314B823A60093DF32 /* DOMWindowProperty.cpp in Sources */, 27790 27798 ); 27791 27799 runOnlyForDeploymentPostprocessing = 0; -
trunk/Source/WebCore/css/StyleMedia.cpp
r97854 r104380 37 37 38 38 StyleMedia::StyleMedia(Frame* frame) 39 : m_frame(frame)39 : DOMWindowProperty(frame) 40 40 { 41 41 } -
trunk/Source/WebCore/css/StyleMedia.h
r98316 r104380 28 28 #define StyleMedia_h 29 29 30 #include "DOMWindowProperty.h" 30 31 #include "PlatformString.h" 31 32 #include <wtf/RefCounted.h> … … 35 36 class Frame; 36 37 37 class StyleMedia : public RefCounted<StyleMedia> {38 class StyleMedia : public RefCounted<StyleMedia>, public DOMWindowProperty { 38 39 public: 39 static PassRefPtr<StyleMedia> create(Frame* frame) 40 { 41 return adoptRef(new StyleMedia(frame)); 42 } 43 44 Frame* frame() { return m_frame; } 45 void disconnectFrame() { m_frame = 0; } 40 static PassRefPtr<StyleMedia> create(Frame* frame) { return adoptRef(new StyleMedia(frame));} 46 41 47 42 String type() const; 48 49 43 bool matchMedium(const String&) const; 50 44 51 45 private: 52 StyleMedia(Frame*); 53 54 Frame* m_frame; 46 explicit StyleMedia(Frame*); 55 47 }; 56 48 -
trunk/Source/WebCore/loader/appcache/DOMApplicationCache.cpp
r98388 r104380 41 41 42 42 DOMApplicationCache::DOMApplicationCache(Frame* frame) 43 : m_frame(frame)43 : DOMWindowProperty(frame) 44 44 { 45 45 ApplicationCacheHost* cacheHost = applicationCacheHost(); … … 53 53 if (cacheHost) 54 54 cacheHost->setDOMApplicationCache(0); 55 m_frame = 0;55 DOMWindowProperty::disconnectFrame(); 56 56 } 57 57 -
trunk/Source/WebCore/loader/appcache/DOMApplicationCache.h
r98388 r104380 28 28 29 29 #include "ApplicationCacheHost.h" 30 #include "DOMWindowProperty.h" 30 31 #include "EventNames.h" 31 32 #include "EventTarget.h" … … 42 43 class KURL; 43 44 44 class DOMApplicationCache : public RefCounted<DOMApplicationCache>, public EventTarget {45 class DOMApplicationCache : public RefCounted<DOMApplicationCache>, public EventTarget, public DOMWindowProperty { 45 46 public: 46 47 static PassRefPtr<DOMApplicationCache> create(Frame* frame) { return adoptRef(new DOMApplicationCache(frame)); } 47 48 ~DOMApplicationCache() { ASSERT(!m_frame); } 48 49 49 Frame* frame() const { return m_frame; } 50 void disconnectFrame(); 50 virtual void disconnectFrame() OVERRIDE; 51 51 52 52 unsigned short status() const; … … 76 76 77 77 private: 78 DOMApplicationCache(Frame*);78 explicit DOMApplicationCache(Frame*); 79 79 80 80 virtual void refEventTarget() { ref(); } … … 85 85 ApplicationCacheHost* applicationCacheHost() const; 86 86 87 Frame* m_frame;88 87 EventTargetData m_eventTargetData; 89 88 }; -
trunk/Source/WebCore/page/BarInfo.cpp
r52772 r104380 37 37 38 38 BarInfo::BarInfo(Frame* frame, Type type) 39 : m_frame(frame)39 : DOMWindowProperty(frame) 40 40 , m_type(type) 41 41 { 42 }43 44 Frame* BarInfo::frame() const45 {46 return m_frame;47 }48 49 void BarInfo::disconnectFrame()50 {51 m_frame = 0;52 42 } 53 43 -
trunk/Source/WebCore/page/BarInfo.h
r42100 r104380 30 30 #define BarInfo_h 31 31 32 #include "DOMWindowProperty.h" 32 33 #include <wtf/PassRefPtr.h> 33 34 #include <wtf/RefCounted.h> … … 37 38 class Frame; 38 39 39 class BarInfo : public RefCounted<BarInfo> {40 class BarInfo : public RefCounted<BarInfo>, public DOMWindowProperty { 40 41 public: 41 42 enum Type { Locationbar, Menubar, Personalbar, Scrollbars, Statusbar, Toolbar }; … … 43 44 static PassRefPtr<BarInfo> create(Frame* frame, Type type) { return adoptRef(new BarInfo(frame, type)); } 44 45 45 Frame* frame() const;46 void disconnectFrame();47 48 46 Type type() const; 49 50 47 bool visible() const; 51 48 52 49 private: 53 50 BarInfo(Frame*, Type); 54 Frame* m_frame;55 51 Type m_type; 56 52 }; -
trunk/Source/WebCore/page/Console.cpp
r102233 r104380 57 57 58 58 Console::Console(Frame* frame) 59 : m_frame(frame)59 : DOMWindowProperty(frame) 60 60 { 61 61 } … … 63 63 Console::~Console() 64 64 { 65 }66 67 Frame* Console::frame() const68 {69 return m_frame;70 }71 72 void Console::disconnectFrame()73 {74 if (m_memory)75 m_memory = 0;76 m_frame = 0;77 65 } 78 66 … … 349 337 } 350 338 351 MemoryInfo* Console::memory() const 352 { 353 m_memory = MemoryInfo::create(m_frame); 354 return m_memory.get(); 339 PassRefPtr<MemoryInfo> Console::memory() const 340 { 341 // FIXME: Because we create a new object here each time, 342 // console.memory !== console.memory, which seems wrong. 343 return MemoryInfo::create(m_frame); 355 344 } 356 345 -
trunk/Source/WebCore/page/Console.h
r102233 r104380 31 31 32 32 #include "ConsoleTypes.h" 33 #include "DOMWindowProperty.h" 33 34 #include "ScriptProfile.h" 34 35 #include "ScriptState.h" … … 49 50 #endif 50 51 51 class Console : public RefCounted<Console> {52 class Console : public RefCounted<Console>, public DOMWindowProperty { 52 53 public: 53 54 static PassRefPtr<Console> create(Frame* frame) { return adoptRef(new Console(frame)); } 54 55 virtual ~Console(); 55 56 Frame* frame() const;57 void disconnectFrame();58 56 59 57 void addMessage(MessageSource, MessageType, MessageLevel, const String& message, unsigned lineNumber, const String& sourceURL); … … 86 84 static void setShouldPrintExceptions(bool); 87 85 88 MemoryInfo*memory() const;86 PassRefPtr<MemoryInfo> memory() const; 89 87 90 88 private: … … 92 90 void addMessage(MessageType, MessageLevel, PassRefPtr<ScriptArguments>, PassRefPtr<ScriptCallStack>, bool acceptNoArguments = false); 93 91 94 Console(Frame*);92 explicit Console(Frame*); 95 93 96 Frame* m_frame;97 94 #if ENABLE(JAVASCRIPT_DEBUGGER) 98 95 ProfilesArray m_profiles; 99 96 #endif 100 mutable RefPtr<MemoryInfo> m_memory;101 97 }; 102 98 -
trunk/Source/WebCore/page/DOMSelection.cpp
r104317 r104380 55 55 56 56 DOMSelection::DOMSelection(Frame* frame) 57 : m_frame(frame) 58 { 59 } 60 61 Frame* DOMSelection::frame() const 62 { 63 return m_frame; 64 } 65 66 void DOMSelection::disconnectFrame() 67 { 68 m_frame = 0; 57 : DOMWindowProperty(frame) 58 { 69 59 } 70 60 -
trunk/Source/WebCore/page/DOMSelection.h
r66590 r104380 31 31 #define DOMSelection_h 32 32 33 #include "DOMWindowProperty.h" 33 34 #include <wtf/Forward.h> 34 35 #include <wtf/PassRefPtr.h> … … 44 45 typedef int ExceptionCode; 45 46 46 class DOMSelection : public RefCounted<DOMSelection> {47 class DOMSelection : public RefCounted<DOMSelection>, public DOMWindowProperty { 47 48 public: 48 49 static PassRefPtr<DOMSelection> create(Frame* frame) { return adoptRef(new DOMSelection(frame)); } 49 50 Frame* frame() const;51 void disconnectFrame();52 50 53 51 // Safari Selection Object API … … 91 89 92 90 private: 93 DOMSelection(Frame*);91 explicit DOMSelection(Frame*); 94 92 95 93 // Convenience method for accessors, does not NULL check m_frame. … … 97 95 98 96 bool isValidForPosition(Node*) const; 99 Frame* m_frame;100 97 }; 101 98 -
trunk/Source/WebCore/page/DOMWindow.cpp
r104372 r104380 477 477 } 478 478 479 void DOMWindow::registerProperty(DOMWindowProperty* property) 480 { 481 m_properties.add(property); 482 } 483 484 void DOMWindow::unregisterProperty(DOMWindowProperty* property) 485 { 486 m_properties.remove(property); 487 } 488 479 489 void DOMWindow::clear() 480 490 { 481 if (m_screen) 482 m_screen->disconnectFrame(); 491 HashSet<DOMWindowProperty*>::iterator stop = m_properties.end(); 492 for (HashSet<DOMWindowProperty*>::iterator it = m_properties.begin(); it != stop; ++it) 493 (*it)->disconnectFrame(); 494 m_properties.clear(); 495 483 496 m_screen = 0; 484 485 if (m_selection)486 m_selection->disconnectFrame();487 497 m_selection = 0; 488 489 if (m_history)490 m_history->disconnectFrame();491 498 m_history = 0; 492 493 499 m_crypto = 0; 494 495 if (m_locationbar)496 m_locationbar->disconnectFrame();497 500 m_locationbar = 0; 498 499 if (m_menubar)500 m_menubar->disconnectFrame();501 501 m_menubar = 0; 502 503 if (m_personalbar)504 m_personalbar->disconnectFrame();505 502 m_personalbar = 0; 506 507 if (m_scrollbars)508 m_scrollbars->disconnectFrame();509 503 m_scrollbars = 0; 510 511 if (m_statusbar)512 m_statusbar->disconnectFrame();513 504 m_statusbar = 0; 514 515 if (m_toolbar)516 m_toolbar->disconnectFrame();517 505 m_toolbar = 0; 518 519 if (m_console)520 m_console->disconnectFrame();521 506 m_console = 0; 522 523 if (m_navigator)524 m_navigator->disconnectFrame();525 507 m_navigator = 0; 526 527 508 #if ENABLE(WEB_TIMING) 528 if (m_performance)529 m_performance->disconnectFrame();530 509 m_performance = 0; 531 510 #endif 532 533 if (m_location)534 m_location->disconnectFrame();535 511 m_location = 0; 536 537 if (m_media)538 m_media->disconnectFrame();539 512 m_media = 0; 540 541 if (m_sessionStorage)542 m_sessionStorage->disconnectFrame();543 513 m_sessionStorage = 0; 544 545 if (m_localStorage)546 m_localStorage->disconnectFrame();547 514 m_localStorage = 0; 548 549 if (m_applicationCache)550 m_applicationCache->disconnectFrame();551 515 m_applicationCache = 0; 552 553 516 #if ENABLE(NOTIFICATIONS) 517 // FIXME: Notifications shouldn't have different disconnection logic than 518 // the rest of the DOMWindowProperties. 554 519 resetNotifications(); 555 520 #endif 556 557 521 #if ENABLE(INDEXED_DATABASE) 558 522 m_idbFactory = 0; 559 523 #endif 560 561 524 #if ENABLE(BLOB) 562 525 m_domURL = 0; 563 526 #endif 564 565 527 #if ENABLE(QUOTA) 566 528 m_storageInfo = 0; -
trunk/Source/WebCore/page/DOMWindow.h
r104372 r104380 42 42 class DOMSelection; 43 43 class DOMURL; 44 class DOMWindowProperty; 44 45 class Database; 45 46 class DatabaseCallback; … … 93 94 94 95 virtual void frameDestroyed() OVERRIDE; 96 97 void registerProperty(DOMWindowProperty*); 98 void unregisterProperty(DOMWindowProperty*); 95 99 96 100 void clear(); … … 438 442 439 443 bool m_shouldPrintWhenFinishedLoading; 444 445 HashSet<DOMWindowProperty*> m_properties; 446 440 447 mutable RefPtr<Screen> m_screen; 441 448 mutable RefPtr<DOMSelection> m_selection; -
trunk/Source/WebCore/page/DOMWindowProperty.cpp
r104379 r104380 1 1 /* 2 * Copyright (C) 2009 Apple Inc. All rights reserved. 3 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) 2 * Copyright (C) 2011 Google, Inc. All Rights Reserved. 4 3 * 5 4 * Redistribution and use in source and binary forms, with or without … … 12 11 * documentation and/or other materials provided with the distribution. 13 12 * 14 * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER,INC. ``AS IS'' AND ANY13 * THIS SOFTWARE IS PROVIDED BY GOOGLE INC. ``AS IS'' AND ANY 15 14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 16 15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 17 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER,INC. OR16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR 18 17 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 19 18 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, … … 25 24 */ 26 25 27 #i fndef StyleMedia_h28 # define StyleMedia_h26 #include "config.h" 27 #include "DOMWindowProperty.h" 29 28 30 #include " PlatformString.h"31 #include <wtf/RefCounted.h>29 #include "DOMWindow.h" 30 #include "Frame.h" 32 31 33 32 namespace WebCore { 34 33 35 class Frame; 34 DOMWindowProperty::DOMWindowProperty(Frame* frame) 35 : m_frame(frame) 36 { 37 if (m_frame) 38 m_frame->domWindow()->registerProperty(this); 39 } 36 40 37 class StyleMedia : public RefCounted<StyleMedia> { 38 public: 39 static PassRefPtr<StyleMedia> create(Frame* frame) 40 { 41 return adoptRef(new StyleMedia(frame)); 42 } 41 DOMWindowProperty::~DOMWindowProperty() 42 { 43 if (m_frame) 44 m_frame->domWindow()->unregisterProperty(this); 45 } 43 46 44 Frame* frame() { return m_frame; } 45 void disconnectFrame() { m_frame = 0; } 47 void DOMWindowProperty::disconnectFrame() 48 { 49 m_frame = 0; 50 } 46 51 47 String type() const; 48 49 bool matchMedium(const String&) const; 50 51 private: 52 StyleMedia(Frame*); 53 54 Frame* m_frame; 55 }; 56 57 } // namespace 58 59 #endif // StyleMedia_h 52 } -
trunk/Source/WebCore/page/DOMWindowProperty.h
r104379 r104380 1 1 /* 2 * Copyright (C) 2009 Apple Inc. All rights reserved. 3 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) 2 * Copyright (C) 2011 Google, Inc. All Rights Reserved. 4 3 * 5 4 * Redistribution and use in source and binary forms, with or without … … 12 11 * documentation and/or other materials provided with the distribution. 13 12 * 14 * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER,INC. ``AS IS'' AND ANY13 * THIS SOFTWARE IS PROVIDED BY GOOGLE INC. ``AS IS'' AND ANY 15 14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 16 15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 17 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER,INC. OR16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR 18 17 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 19 18 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, … … 25 24 */ 26 25 27 #ifndef StyleMedia_h 28 #define StyleMedia_h 29 30 #include "PlatformString.h" 31 #include <wtf/RefCounted.h> 26 #ifndef DOMWindowProperty_h 27 #define DOMWindowProperty_h 32 28 33 29 namespace WebCore { … … 35 31 class Frame; 36 32 37 class StyleMedia : public RefCounted<StyleMedia>{33 class DOMWindowProperty { 38 34 public: 39 static PassRefPtr<StyleMedia> create(Frame* frame) 40 { 41 return adoptRef(new StyleMedia(frame)); 42 } 35 explicit DOMWindowProperty(Frame*); 36 virtual void disconnectFrame(); 43 37 44 Frame* frame() { return m_frame; } 45 void disconnectFrame() { m_frame = 0; } 38 Frame* frame() const { return m_frame; } 46 39 47 String type() const; 48 49 bool matchMedium(const String&) const; 50 51 private: 52 StyleMedia(Frame*); 40 protected: 41 virtual ~DOMWindowProperty(); 53 42 54 43 Frame* m_frame; 55 44 }; 56 45 57 } // namespace46 } 58 47 59 #endif // StyleMedia_h48 #endif -
trunk/Source/WebCore/page/Geolocation.cpp
r97594 r104380 226 226 227 227 Geolocation::Geolocation(Frame* frame) 228 : m_frame(frame)228 : DOMWindowProperty(frame) 229 229 #if !ENABLE(CLIENT_BASED_GEOLOCATION) 230 230 , m_service(GeolocationService::create(this)) … … 274 274 if (m_frame && m_frame->document()) 275 275 m_frame->document()->setUsingGeolocation(false); 276 m_frame = 0;276 DOMWindowProperty::disconnectFrame(); 277 277 } 278 278 -
trunk/Source/WebCore/page/Geolocation.h
r97594 r104380 28 28 #define Geolocation_h 29 29 30 #include "DOMWindowProperty.h" 30 31 #include "Geoposition.h" 31 32 #include "PositionCallback.h" … … 48 49 class Page; 49 50 50 class Geolocation : public RefCounted<Geolocation> 51 class Geolocation : public RefCounted<Geolocation>, public DOMWindowProperty 51 52 #if !ENABLE(CLIENT_BASED_GEOLOCATION) && ENABLE(GEOLOCATION) 52 53 , public GeolocationServiceClient … … 55 56 public: 56 57 static PassRefPtr<Geolocation> create(Frame* frame) { return adoptRef(new Geolocation(frame)); } 57 58 58 ~Geolocation(); 59 59 60 virtual void disconnectFrame() OVERRIDE; 60 61 void reset(); 61 void disconnectFrame(); 62 62 63 63 void getCurrentPosition(PassRefPtr<PositionCallback>, PassRefPtr<PositionErrorCallback>, PassRefPtr<PositionOptions>); 64 64 int watchPosition(PassRefPtr<PositionCallback>, PassRefPtr<PositionErrorCallback>, PassRefPtr<PositionOptions>); … … 66 66 67 67 void setIsAllowed(bool); 68 Frame* frame() const { return m_frame; }69 68 70 69 #if ENABLE(CLIENT_BASED_GEOLOCATION) … … 80 79 bool isAllowed() const { return m_allowGeolocation == Yes; } 81 80 bool isDenied() const { return m_allowGeolocation == No; } 82 83 Geolocation(Frame*);81 82 explicit Geolocation(Frame*); 84 83 85 84 Page* page() const; … … 173 172 GeoNotifierSet m_oneShots; 174 173 Watchers m_watchers; 175 Frame* m_frame;176 174 #if !ENABLE(CLIENT_BASED_GEOLOCATION) 177 175 OwnPtr<GeolocationService> m_service; -
trunk/Source/WebCore/page/History.cpp
r92068 r104380 42 42 43 43 History::History(Frame* frame) 44 : m_frame(frame)44 : DOMWindowProperty(frame) 45 45 { 46 }47 48 Frame* History::frame() const49 {50 return m_frame;51 }52 53 void History::disconnectFrame()54 {55 m_frame = 0;56 46 } 57 47 -
trunk/Source/WebCore/page/History.h
r74853 r104380 27 27 #define History_h 28 28 29 #include "DOMWindowProperty.h" 29 30 #include "KURL.h" 30 31 #include <wtf/Forward.h> … … 39 40 typedef int ExceptionCode; 40 41 41 class History : public RefCounted<History> {42 class History : public RefCounted<History>, public DOMWindowProperty { 42 43 public: 43 44 static PassRefPtr<History> create(Frame* frame) { return adoptRef(new History(frame)); } 44 45 Frame* frame() const;46 void disconnectFrame();47 45 48 46 unsigned length() const; … … 62 60 63 61 private: 64 History(Frame*);62 explicit History(Frame*); 65 63 66 64 KURL urlForState(const String& url); 67 68 Frame* m_frame;69 65 }; 70 66 -
trunk/Source/WebCore/page/Location.cpp
r100164 r104380 41 41 42 42 Location::Location(Frame* frame) 43 : m_frame(frame) 44 { 45 } 46 47 void Location::disconnectFrame() 48 { 49 m_frame = 0; 43 : DOMWindowProperty(frame) 44 { 50 45 } 51 46 -
trunk/Source/WebCore/page/Location.h
r100164 r104380 30 30 #define Location_h 31 31 32 #include "DOMWindowProperty.h" 32 33 #include <wtf/PassRefPtr.h> 33 34 #include <wtf/RefCounted.h> … … 42 43 typedef int ExceptionCode; 43 44 44 class Location : public RefCounted<Location> {45 class Location : public RefCounted<Location>, public DOMWindowProperty { 45 46 public: 46 47 static PassRefPtr<Location> create(Frame* frame) { return adoptRef(new Location(frame)); } 47 48 Frame* frame() const { return m_frame; }49 void disconnectFrame();50 48 51 49 void setHref(const String&, DOMWindow* activeWindow, DOMWindow* firstWindow); … … 75 73 76 74 private: 77 Location(Frame*);75 explicit Location(Frame*); 78 76 79 77 const KURL& url() const; 80 81 Frame* m_frame;82 78 }; 83 79 -
trunk/Source/WebCore/page/Navigator.cpp
r104146 r104380 60 60 61 61 Navigator::Navigator(Frame* frame) 62 : m_frame(frame)62 : DOMWindowProperty(frame) 63 63 { 64 64 } … … 66 66 Navigator::~Navigator() 67 67 { 68 disconnectFrame();69 68 } 70 69 … … 73 72 if (m_geolocation) 74 73 m_geolocation->reset(); 75 }76 77 void Navigator::disconnectFrame()78 {79 if (m_plugins) {80 m_plugins->disconnectFrame();81 m_plugins = 0;82 }83 if (m_mimeTypes) {84 m_mimeTypes->disconnectFrame();85 m_mimeTypes = 0;86 }87 if (m_geolocation) {88 m_geolocation->disconnectFrame();89 m_geolocation = 0;90 }91 m_frame = 0;92 74 } 93 75 -
trunk/Source/WebCore/page/Navigator.h
r104146 r104380 21 21 #define Navigator_h 22 22 23 #include "DOMWindowProperty.h" 23 24 #include "NavigatorBase.h" 24 25 #include <wtf/Forward.h> … … 41 42 typedef int ExceptionCode; 42 43 43 class Navigator : public NavigatorBase, public RefCounted<Navigator> {44 class Navigator : public NavigatorBase, public RefCounted<Navigator>, public DOMWindowProperty { 44 45 public: 45 46 static PassRefPtr<Navigator> create(Frame* frame) { return adoptRef(new Navigator(frame)); } … … 47 48 48 49 void resetGeolocation(); 49 void disconnectFrame();50 Frame* frame() const { return m_frame; }51 50 52 51 String appVersion() const; … … 82 81 83 82 private: 84 Navigator(Frame*);85 Frame* m_frame; 83 explicit Navigator(Frame*); 84 86 85 mutable RefPtr<DOMPluginArray> m_plugins; 87 86 mutable RefPtr<DOMMimeTypeArray> m_mimeTypes; -
trunk/Source/WebCore/page/Performance.cpp
r95901 r104380 43 43 44 44 Performance::Performance(Frame* frame) 45 : m_frame(frame)45 : DOMWindowProperty(frame) 46 46 { 47 47 } 48 48 49 Frame* Performance::frame() const49 PassRefPtr<MemoryInfo> Performance::memory() const 50 50 { 51 return m_frame; 52 } 53 54 void Performance::disconnectFrame() 55 { 56 if (m_memory) 57 m_memory = 0; 58 if (m_navigation) { 59 m_navigation->disconnectFrame(); 60 m_navigation = 0; 61 } 62 if (m_timing) { 63 m_timing->disconnectFrame(); 64 m_timing = 0; 65 } 66 m_frame = 0; 67 } 68 69 MemoryInfo* Performance::memory() const 70 { 71 m_memory = MemoryInfo::create(m_frame); 72 return m_memory.get(); 51 return MemoryInfo::create(m_frame); 73 52 } 74 53 -
trunk/Source/WebCore/page/Performance.h
r95901 r104380 34 34 #if ENABLE(WEB_TIMING) 35 35 36 #include "DOMWindowProperty.h" 36 37 #include "MemoryInfo.h" 37 38 #include "PerformanceNavigation.h" … … 43 44 namespace WebCore { 44 45 45 class Performance : public RefCounted<Performance> {46 class Performance : public RefCounted<Performance>, public DOMWindowProperty { 46 47 public: 47 48 static PassRefPtr<Performance> create(Frame* frame) { return adoptRef(new Performance(frame)); } 48 49 49 Frame* frame() const; 50 void disconnectFrame(); 51 52 MemoryInfo* memory() const; 50 PassRefPtr<MemoryInfo> memory() const; 53 51 PerformanceNavigation* navigation() const; 54 52 PerformanceTiming* timing() const; 55 53 56 54 private: 57 Performance(Frame*);55 explicit Performance(Frame*); 58 56 59 mutable RefPtr<MemoryInfo> m_memory;60 57 mutable RefPtr<PerformanceNavigation> m_navigation; 61 58 mutable RefPtr<PerformanceTiming> m_timing; 62 Frame* m_frame;63 59 }; 64 60 65 61 } 66 62 67 #endif // !ENABLE(WEB_TIMING) 68 #endif // !defined(Performance_h) 63 #endif // ENABLE(WEB_TIMING) 64 65 #endif // Performance_h -
trunk/Source/WebCore/page/PerformanceNavigation.cpp
r102961 r104380 41 41 42 42 PerformanceNavigation::PerformanceNavigation(Frame* frame) 43 : m_frame(frame)43 : DOMWindowProperty(frame) 44 44 { 45 }46 47 Frame* PerformanceNavigation::frame() const48 {49 return m_frame;50 }51 52 void PerformanceNavigation::disconnectFrame()53 {54 m_frame = 0;55 45 } 56 46 -
trunk/Source/WebCore/page/PerformanceNavigation.h
r95901 r104380 34 34 #if ENABLE(WEB_TIMING) 35 35 36 #include "DOMWindowProperty.h" 36 37 #include <wtf/PassRefPtr.h> 37 38 #include <wtf/RefCounted.h> … … 41 42 class Frame; 42 43 43 class PerformanceNavigation : public RefCounted<PerformanceNavigation> {44 class PerformanceNavigation : public RefCounted<PerformanceNavigation>, public DOMWindowProperty { 44 45 public: 45 46 static PassRefPtr<PerformanceNavigation> create(Frame* frame) { return adoptRef(new PerformanceNavigation(frame)); } 46 47 Frame* frame() const;48 void disconnectFrame();49 47 50 48 enum PerformanceNavigationType { … … 59 57 60 58 private: 61 PerformanceNavigation(Frame*); 62 63 Frame* m_frame; 59 explicit PerformanceNavigation(Frame*); 64 60 }; 65 61 -
trunk/Source/WebCore/page/PerformanceTiming.cpp
r102961 r104380 52 52 53 53 PerformanceTiming::PerformanceTiming(Frame* frame) 54 : m_frame(frame) 55 { 56 } 57 58 Frame* PerformanceTiming::frame() const 59 { 60 return m_frame; 61 } 62 63 void PerformanceTiming::disconnectFrame() 64 { 65 m_frame = 0; 54 : DOMWindowProperty(frame) 55 { 66 56 } 67 57 -
trunk/Source/WebCore/page/PerformanceTiming.h
r102961 r104380 34 34 #if ENABLE(WEB_TIMING) 35 35 36 #include "DOMWindowProperty.h" 36 37 #include <wtf/PassRefPtr.h> 37 38 #include <wtf/RefCounted.h> … … 45 46 class ResourceLoadTiming; 46 47 47 class PerformanceTiming : public RefCounted<PerformanceTiming> {48 class PerformanceTiming : public RefCounted<PerformanceTiming>, public DOMWindowProperty { 48 49 public: 49 50 static PassRefPtr<PerformanceTiming> create(Frame* frame) { return adoptRef(new PerformanceTiming(frame)); } 50 51 Frame* frame() const;52 void disconnectFrame();53 51 54 52 unsigned long long navigationStart() const; … … 75 73 76 74 private: 77 PerformanceTiming(Frame*);75 explicit PerformanceTiming(Frame*); 78 76 79 77 const DocumentTiming* documentTiming() const; … … 83 81 unsigned long long resourceLoadTimeRelativeToAbsolute(int) const; 84 82 unsigned long long monotonicTimeToIntegerMilliseconds(double) const; 85 86 Frame* m_frame;87 83 }; 88 84 -
trunk/Source/WebCore/page/Screen.cpp
r102301 r104380 40 40 41 41 Screen::Screen(Frame* frame) 42 : m_frame(frame)42 : DOMWindowProperty(frame) 43 43 { 44 }45 46 Frame* Screen::frame() const47 {48 return m_frame;49 }50 51 void Screen::disconnectFrame()52 {53 m_frame = 0;54 44 } 55 45 -
trunk/Source/WebCore/page/Screen.h
r102301 r104380 31 31 #define Screen_h 32 32 33 #include "DOMWindowProperty.h" 33 34 #include <wtf/PassRefPtr.h> 34 35 #include <wtf/RefCounted.h> … … 38 39 class Frame; 39 40 40 class Screen : public RefCounted<Screen> {41 class Screen : public RefCounted<Screen>, public DOMWindowProperty { 41 42 public: 42 43 static PassRefPtr<Screen> create(Frame *frame) { return adoptRef(new Screen(frame)); } 43 44 Frame* frame() const;45 void disconnectFrame();46 44 47 45 unsigned horizontalDPI() const; … … 57 55 58 56 private: 59 Screen(Frame*); 60 61 Frame* m_frame; 57 explicit Screen(Frame*); 62 58 }; 63 59 -
trunk/Source/WebCore/plugins/DOMMimeTypeArray.cpp
r95901 r104380 30 30 31 31 DOMMimeTypeArray::DOMMimeTypeArray(Frame* frame) 32 : m_frame(frame)32 : DOMWindowProperty(frame) 33 33 { 34 34 } -
trunk/Source/WebCore/plugins/DOMMimeTypeArray.h
r95901 r104380 23 23 24 24 #include "DOMMimeType.h" 25 #include "DOMWindowProperty.h" 25 26 #include <wtf/Forward.h> 26 27 #include <wtf/PassRefPtr.h> … … 33 34 class PluginData; 34 35 35 class DOMMimeTypeArray : public RefCounted<DOMMimeTypeArray> {36 class DOMMimeTypeArray : public RefCounted<DOMMimeTypeArray>, public DOMWindowProperty { 36 37 public: 37 38 static PassRefPtr<DOMMimeTypeArray> create(Frame* frame) { return adoptRef(new DOMMimeTypeArray(frame)); } 38 39 ~DOMMimeTypeArray(); 39 40 Frame* frame() { return m_frame; }41 void disconnectFrame() { m_frame = 0; }42 40 43 41 unsigned length() const; … … 47 45 48 46 private: 49 DOMMimeTypeArray(Frame*);47 explicit DOMMimeTypeArray(Frame*); 50 48 PluginData* getPluginData() const; 51 52 Frame* m_frame;53 49 }; 54 50 -
trunk/Source/WebCore/plugins/DOMPluginArray.cpp
r95901 r104380 30 30 31 31 DOMPluginArray::DOMPluginArray(Frame* frame) 32 : m_frame(frame)32 : DOMWindowProperty(frame) 33 33 { 34 34 } -
trunk/Source/WebCore/plugins/DOMPluginArray.h
r95901 r104380 23 23 24 24 #include "DOMPlugin.h" 25 #include "DOMWindowProperty.h" 25 26 #include <wtf/Forward.h> 26 27 #include <wtf/PassRefPtr.h> … … 33 34 class PluginData; 34 35 35 class DOMPluginArray : public RefCounted<DOMPluginArray> {36 class DOMPluginArray : public RefCounted<DOMPluginArray>, public DOMWindowProperty { 36 37 public: 37 38 static PassRefPtr<DOMPluginArray> create(Frame* frame) { return adoptRef(new DOMPluginArray(frame)); } 38 39 ~DOMPluginArray(); 39 40 Frame* frame() { return m_frame; }41 void disconnectFrame() { m_frame = 0; }42 40 43 41 unsigned length() const; … … 49 47 50 48 private: 51 DOMPluginArray(Frame*);49 explicit DOMPluginArray(Frame*); 52 50 PluginData* pluginData() const; 53 54 Frame* m_frame;55 51 }; 56 52 -
trunk/Source/WebCore/storage/Storage.cpp
r99439 r104380 42 42 43 43 Storage::Storage(Frame* frame, PassRefPtr<StorageArea> storageArea) 44 : m_frame(frame)44 : DOMWindowProperty(frame) 45 45 , m_storageArea(storageArea) 46 46 { -
trunk/Source/WebCore/storage/Storage.h
r97574 r104380 27 27 #define Storage_h 28 28 29 #include "DOMWindowProperty.h" 29 30 #include <wtf/Forward.h> 30 31 #include <wtf/RefCounted.h> … … 37 38 typedef int ExceptionCode; 38 39 39 class Storage : public RefCounted<Storage> {40 class Storage : public RefCounted<Storage>, public DOMWindowProperty { 40 41 public: 41 42 static PassRefPtr<Storage> create(Frame*, PassRefPtr<StorageArea>); … … 51 52 bool contains(const String& key) const; 52 53 53 Frame* frame() { return m_frame; }54 void disconnectFrame() { m_frame = 0; }55 56 54 private: 57 55 Storage(Frame*, PassRefPtr<StorageArea>); 58 56 59 Frame* m_frame;60 57 RefPtr<StorageArea> m_storageArea; 61 58 };
Note: See TracChangeset
for help on using the changeset viewer.