Changeset 108954 in webkit
- Timestamp:
- Feb 26, 2012 9:10:08 PM (12 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 2 added
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/CMakeLists.txt
r108930 r108954 536 536 dom/CompositionEvent.cpp 537 537 dom/ContainerNode.cpp 538 dom/ContextDestructionObserver.cpp 538 539 dom/CustomEvent.cpp 539 540 dom/DatasetDOMStringMap.cpp -
trunk/Source/WebCore/ChangeLog
r108952 r108954 1 2012-02-26 Adam Barth <abarth@webkit.org> 2 3 ContextDestructionObserver should live in its own file 4 https://bugs.webkit.org/show_bug.cgi?id=79619 5 6 Reviewed by Hajime Morita. 7 8 WebKit prefers to have one class per file. (This patch is paying a 9 build system hacking debt I incurred earlier.) 10 11 * CMakeLists.txt: 12 * GNUmakefile.list.am: 13 * Target.pri: 14 * WebCore.gypi: 15 * WebCore.vcproj/WebCore.vcproj: 16 * WebCore.xcodeproj/project.pbxproj: 17 * dom/ActiveDOMObject.cpp: 18 (WebCore): 19 * dom/ActiveDOMObject.h: 20 (ActiveDOMObject): 21 (WebCore::ActiveDOMObject::suspendIfNeededCalled): 22 (WebCore::ActiveDOMObject::setPendingActivity): 23 (WebCore::ActiveDOMObject::unsetPendingActivity): 24 * dom/ContextDestructionObserver.cpp: Added. 25 (WebCore): 26 (WebCore::ContextDestructionObserver::ContextDestructionObserver): 27 (WebCore::ContextDestructionObserver::~ContextDestructionObserver): 28 (WebCore::ContextDestructionObserver::contextDestroyed): 29 * dom/ContextDestructionObserver.h: Added. 30 (WebCore): 31 (ContextDestructionObserver): 32 (WebCore::ContextDestructionObserver::scriptExecutionContext): 33 * dom/DOMAllInOne.cpp: 34 1 35 2012-02-26 Dirk Schulze <krit@webkit.org> 2 36 -
trunk/Source/WebCore/GNUmakefile.list.am
r108930 r108954 1553 1553 Source/WebCore/dom/ContainerNode.cpp \ 1554 1554 Source/WebCore/dom/ContainerNode.h \ 1555 Source/WebCore/dom/ContextDestructionObserver.cpp \ 1556 Source/WebCore/dom/ContextDestructionObserver.h \ 1555 1557 Source/WebCore/dom/CrossThreadTask.h \ 1556 1558 Source/WebCore/dom/CustomEvent.cpp \ -
trunk/Source/WebCore/Target.pri
r108930 r108954 489 489 dom/CompositionEvent.cpp \ 490 490 dom/ContainerNode.cpp \ 491 dom/ContextDestructionObserver.cpp \ 491 492 dom/CustomEvent.cpp \ 492 493 dom/DecodedDataDocumentParser.cpp \ -
trunk/Source/WebCore/WebCore.gypi
r108930 r108954 579 579 'dom/ClipboardAccessPolicy.h', 580 580 'dom/ContainerNode.h', 581 'dom/ContextDestructionObserver.h', 581 582 'dom/DOMImplementation.h', 582 583 'dom/DOMTimeStamp.h', … … 5004 5005 'dom/ContainerNode.cpp', 5005 5006 'dom/ContainerNodeAlgorithms.h', 5007 'dom/ContextDestructionObserver.cpp', 5006 5008 'dom/CrossThreadTask.h', 5007 5009 'dom/CustomEvent.cpp', -
trunk/Source/WebCore/WebCore.vcproj/WebCore.vcproj
r108930 r108954 46971 46971 </File> 46972 46972 <File 46973 RelativePath="..\dom\ContextDestructionObserver.cpp" 46974 > 46975 <FileConfiguration 46976 Name="Debug|Win32" 46977 ExcludedFromBuild="true" 46978 > 46979 <Tool 46980 Name="VCCLCompilerTool" 46981 /> 46982 </FileConfiguration> 46983 <FileConfiguration 46984 Name="Release|Win32" 46985 ExcludedFromBuild="true" 46986 > 46987 <Tool 46988 Name="VCCLCompilerTool" 46989 /> 46990 </FileConfiguration> 46991 <FileConfiguration 46992 Name="Debug_Cairo_CFLite|Win32" 46993 ExcludedFromBuild="true" 46994 > 46995 <Tool 46996 Name="VCCLCompilerTool" 46997 /> 46998 </FileConfiguration> 46999 <FileConfiguration 47000 Name="Release_Cairo_CFLite|Win32" 47001 ExcludedFromBuild="true" 47002 > 47003 <Tool 47004 Name="VCCLCompilerTool" 47005 /> 47006 </FileConfiguration> 47007 <FileConfiguration 47008 Name="Debug_All|Win32" 47009 ExcludedFromBuild="true" 47010 > 47011 <Tool 47012 Name="VCCLCompilerTool" 47013 /> 47014 </FileConfiguration> 47015 <FileConfiguration 47016 Name="Production|Win32" 47017 ExcludedFromBuild="true" 47018 > 47019 <Tool 47020 Name="VCCLCompilerTool" 47021 /> 47022 </FileConfiguration> 47023 </File> 47024 <File 47025 RelativePath="..\dom\ContextDestructionObserver.h" 47026 > 47027 </File> 47028 <File 46973 47029 RelativePath="..\dom\CrossThreadTask.h" 46974 47030 > -
trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj
r108930 r108954 3351 3351 975CA2A11303679D00E99AD9 /* JSCrypto.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 975CA29F1303679D00E99AD9 /* JSCrypto.cpp */; }; 3352 3352 975CA2A21303679D00E99AD9 /* JSCrypto.h in Headers */ = {isa = PBXBuildFile; fileRef = 975CA2A01303679D00E99AD9 /* JSCrypto.h */; }; 3353 97627B8D14FB3CEE002CDCA1 /* ContextDestructionObserver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 97627B8B14FB3CEE002CDCA1 /* ContextDestructionObserver.cpp */; }; 3354 97627B8E14FB3CEE002CDCA1 /* ContextDestructionObserver.h in Headers */ = {isa = PBXBuildFile; fileRef = 97627B8C14FB3CEE002CDCA1 /* ContextDestructionObserver.h */; settings = {ATTRIBUTES = (Private, ); }; }; 3353 3355 97665013144FAA4200F6BB51 /* EventFactory.h in Headers */ = {isa = PBXBuildFile; fileRef = 97665011144FAA4200F6BB51 /* EventFactory.h */; }; 3354 3356 9766504F144FBFFE00F6BB51 /* EventFactory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9766504E144FBFFE00F6BB51 /* EventFactory.cpp */; }; … … 10234 10236 975CA29F1303679D00E99AD9 /* JSCrypto.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSCrypto.cpp; sourceTree = "<group>"; }; 10235 10237 975CA2A01303679D00E99AD9 /* JSCrypto.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSCrypto.h; sourceTree = "<group>"; }; 10238 97627B8B14FB3CEE002CDCA1 /* ContextDestructionObserver.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ContextDestructionObserver.cpp; sourceTree = "<group>"; }; 10239 97627B8C14FB3CEE002CDCA1 /* ContextDestructionObserver.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ContextDestructionObserver.h; sourceTree = "<group>"; }; 10236 10240 97665011144FAA4200F6BB51 /* EventFactory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EventFactory.h; sourceTree = "<group>"; }; 10237 10241 9766504E144FBFFE00F6BB51 /* EventFactory.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = EventFactory.cpp; sourceTree = "<group>"; }; … … 20627 20631 A81872110977D3C0005826D9 /* ContainerNode.h */, 20628 20632 E1A1470711102B1500EEC0F3 /* ContainerNodeAlgorithms.h */, 20633 97627B8B14FB3CEE002CDCA1 /* ContextDestructionObserver.cpp */, 20634 97627B8C14FB3CEE002CDCA1 /* ContextDestructionObserver.h */, 20629 20635 2E3FAA0811A36BF100576624 /* CrossThreadTask.h */, 20630 20636 62CD32561157E57C0063B0A7 /* CustomEvent.cpp */, … … 21459 21465 41D015CA0F4B5C71004A662F /* ContentType.h in Headers */, 21460 21466 370D6EDB138454550044103E /* ContentTypeParser.h in Headers */, 21467 97627B8E14FB3CEE002CDCA1 /* ContextDestructionObserver.h in Headers */, 21461 21468 93B6A0E60B0BCA5C00F5027A /* ContextMenu.h in Headers */, 21462 21469 065AD4F50B0C2EDA005A2B1D /* ContextMenuClient.h in Headers */, … … 24891 24898 41D015CB0F4B5C71004A662F /* ContentType.cpp in Sources */, 24892 24899 370D6EDA138454550044103E /* ContentTypeParser.cpp in Sources */, 24900 97627B8D14FB3CEE002CDCA1 /* ContextDestructionObserver.cpp in Sources */, 24893 24901 065AD4F60B0C2EDA005A2B1D /* ContextMenuController.cpp in Sources */, 24894 24902 06027CB30B1CC03D00884B2D /* ContextMenuItemMac.mm in Sources */, -
trunk/Source/WebCore/dom/ActiveDOMObject.cpp
r107239 r108954 33 33 34 34 namespace WebCore { 35 36 ContextDestructionObserver::ContextDestructionObserver(ScriptExecutionContext* scriptExecutionContext)37 : m_scriptExecutionContext(scriptExecutionContext)38 {39 if (!m_scriptExecutionContext)40 return;41 42 ASSERT(m_scriptExecutionContext->isContextThread());43 m_scriptExecutionContext->didCreateDestructionObserver(this);44 }45 46 ContextDestructionObserver::~ContextDestructionObserver()47 {48 if (!m_scriptExecutionContext)49 return;50 51 ASSERT(m_scriptExecutionContext->isContextThread());52 m_scriptExecutionContext->willDestroyDestructionObserver(this);53 }54 55 void ContextDestructionObserver::contextDestroyed()56 {57 m_scriptExecutionContext = 0;58 }59 35 60 36 ActiveDOMObject::ActiveDOMObject(ScriptExecutionContext* scriptExecutionContext, void* upcastPointer) -
trunk/Source/WebCore/dom/ActiveDOMObject.h
r107239 r108954 28 28 #define ActiveDOMObject_h 29 29 30 #include "ContextDestructionObserver.h" 30 31 #include <wtf/Assertions.h> 31 32 32 33 namespace WebCore { 33 34 34 class ScriptExecutionContext; 35 class ActiveDOMObject : public ContextDestructionObserver { 36 public: 37 ActiveDOMObject(ScriptExecutionContext*, void* upcastPointer); 35 38 36 // FIXME: Move this class to it's own file. 37 class ContextDestructionObserver { 38 public: 39 explicit ContextDestructionObserver(ScriptExecutionContext*); 40 virtual void contextDestroyed(); 41 42 ScriptExecutionContext* scriptExecutionContext() const { return m_scriptExecutionContext; } 43 44 protected: 45 virtual ~ContextDestructionObserver(); 46 47 ScriptExecutionContext* m_scriptExecutionContext; 48 }; 49 50 class ActiveDOMObject : public ContextDestructionObserver { 51 public: 52 ActiveDOMObject(ScriptExecutionContext*, void* upcastPointer); 53 54 // suspendIfNeeded() should be called exactly once after object construction to synchronize 55 // the suspend state with that in ScriptExecutionContext. 56 void suspendIfNeeded(); 39 // suspendIfNeeded() should be called exactly once after object construction to synchronize 40 // the suspend state with that in ScriptExecutionContext. 41 void suspendIfNeeded(); 57 42 #if !ASSERT_DISABLED 58 43 bool suspendIfNeededCalled() const { return m_suspendIfNeededCalled; } 59 44 #endif 60 45 61 46 virtual bool hasPendingActivity() const; 62 47 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 48 // canSuspend() is used by the caller if there is a choice between suspending and stopping. 49 // For example, a page won't be suspended and placed in the back/forward cache if it has 50 // the objects that can not be suspended. 51 // However, 'suspend' can be called even if canSuspend() would return 'false'. That 52 // happens in step-by-step JS debugging for example - in this case it would be incorrect 53 // to stop the object. Exact semantics of suspend is up to the object then. 54 enum ReasonForSuspension { 55 JavaScriptDebuggerPaused, 56 WillShowDialog, 57 DocumentWillBecomeInactive 58 }; 59 virtual bool canSuspend() const; 60 virtual void suspend(ReasonForSuspension); 61 virtual void resume(); 62 virtual void stop(); 78 63 79 80 81 82 83 84 64 template<class T> void setPendingActivity(T* thisObject) 65 { 66 ASSERT(thisObject == this); 67 thisObject->ref(); 68 m_pendingActivityCount++; 69 } 85 70 86 87 88 89 90 91 71 template<class T> void unsetPendingActivity(T* thisObject) 72 { 73 ASSERT(m_pendingActivityCount > 0); 74 --m_pendingActivityCount; 75 thisObject->deref(); 76 } 92 77 93 94 78 protected: 79 virtual ~ActiveDOMObject(); 95 80 96 97 81 private: 82 unsigned m_pendingActivityCount; 98 83 #if !ASSERT_DISABLED 99 84 bool m_suspendIfNeededCalled; 100 85 #endif 101 86 }; 102 87 103 88 } // namespace WebCore -
trunk/Source/WebCore/dom/DOMAllInOne.cpp
r108034 r108954 44 44 #include "CompositionEvent.cpp" 45 45 #include "ContainerNode.cpp" 46 #include "ContextDestructionObserver.cpp" 46 47 #include "CustomEvent.cpp" 47 48 #include "DOMCoreException.cpp"
Note: See TracChangeset
for help on using the changeset viewer.