Changeset 98787 in webkit
- Timestamp:
- Oct 28, 2011, 5:30:00 PM (15 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 6 edited
-
ChangeLog (modified) (1 diff)
-
dom/ActiveDOMObject.h (modified) (1 diff)
-
dom/ScriptExecutionContext.cpp (modified) (2 diffs)
-
dom/ScriptExecutionContext.h (modified) (2 diffs)
-
html/DOMURL.cpp (modified) (1 diff)
-
html/DOMURL.h (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r98784 r98787 1 2011-10-28 Adam Barth <abarth@webkit.org> 2 3 Make DOMURL a ContextDestructionObserver 4 https://bugs.webkit.org/show_bug.cgi?id=71162 5 6 Reviewed by Eric Seidel. 7 8 This removes a bunch of hand-rolled ifdefed code. 9 10 * dom/ActiveDOMObject.h: 11 - One-argument constructors should be explicit. 12 * dom/ScriptExecutionContext.cpp: 13 (WebCore::ScriptExecutionContext::~ScriptExecutionContext): 14 * dom/ScriptExecutionContext.h: 15 * html/DOMURL.cpp: 16 (WebCore::DOMURL::DOMURL): 17 (WebCore::DOMURL::~DOMURL): 18 * html/DOMURL.h: 19 1 20 2011-10-28 Adam Barth <abarth@webkit.org> 2 21 -
trunk/Source/WebCore/dom/ActiveDOMObject.h
r98784 r98787 37 37 class ContextDestructionObserver { 38 38 public: 39 ContextDestructionObserver(ScriptExecutionContext*);39 explicit ContextDestructionObserver(ScriptExecutionContext*); 40 40 virtual void contextDestroyed(); 41 41 -
trunk/Source/WebCore/dom/ScriptExecutionContext.cpp
r98784 r98787 135 135 for (HashSet<String>::iterator iter = m_publicBlobURLs.begin(); iter != publicBlobURLsEnd; ++iter) 136 136 ThreadableBlobRegistry::unregisterBlobURL(KURL(ParsedURLString, *iter)); 137 138 HashSet<DOMURL*>::iterator domUrlsEnd = m_domUrls.end();139 for (HashSet<DOMURL*>::iterator iter = m_domUrls.begin(); iter != domUrlsEnd; ++iter) {140 ASSERT((*iter)->scriptExecutionContext() == this);141 (*iter)->contextDestroyed();142 }143 137 #endif 144 138 … … 220 214 m_messagePorts.remove(port); 221 215 } 222 223 #if ENABLE(BLOB)224 void ScriptExecutionContext::createdDomUrl(DOMURL* url)225 {226 ASSERT(url);227 m_domUrls.add(url);228 }229 230 void ScriptExecutionContext::destroyedDomUrl(DOMURL* url)231 {232 ASSERT(url);233 m_domUrls.remove(url);234 }235 #endif236 216 237 217 bool ScriptExecutionContext::canSuspendActiveDOMObjects() -
trunk/Source/WebCore/dom/ScriptExecutionContext.h
r98784 r98787 134 134 const HashSet<MessagePort*>& messagePorts() const { return m_messagePorts; } 135 135 136 #if ENABLE(BLOB)137 void createdDomUrl(DOMURL*);138 void destroyedDomUrl(DOMURL*);139 const HashSet<DOMURL*>& domUrls() const { return m_domUrls; }140 #endif141 136 void ref() { refScriptExecutionContext(); } 142 137 void deref() { derefScriptExecutionContext(); } … … 215 210 HashSet<String> m_publicBlobURLs; 216 211 HashSet<String> m_publicStreamURLs; 217 HashSet<DOMURL*> m_domUrls;218 212 #endif 219 213 -
trunk/Source/WebCore/html/DOMURL.cpp
r95901 r98787 36 36 37 37 DOMURL::DOMURL(ScriptExecutionContext* scriptExecutionContext) 38 : m_scriptExecutionContext(scriptExecutionContext)38 : ContextDestructionObserver(scriptExecutionContext) 39 39 { 40 if (m_scriptExecutionContext)41 m_scriptExecutionContext->createdDomUrl(this);42 40 } 43 41 44 42 DOMURL::~DOMURL() 45 43 { 46 if (m_scriptExecutionContext)47 m_scriptExecutionContext->destroyedDomUrl(this);48 }49 50 void DOMURL::contextDestroyed()51 {52 ASSERT(m_scriptExecutionContext);53 m_scriptExecutionContext = 0;54 44 } 55 45 -
trunk/Source/WebCore/html/DOMURL.h
r95901 r98787 29 29 #if ENABLE(BLOB) 30 30 31 #include "ActiveDOMObject.h" 31 32 #include "PlatformString.h" 32 33 #include <wtf/PassRefPtr.h> … … 39 40 class ScriptExecutionContext; 40 41 41 class DOMURL : public RefCounted<DOMURL> {42 class DOMURL : public RefCounted<DOMURL>, public ContextDestructionObserver { 42 43 public: 43 44 static PassRefPtr<DOMURL> create(ScriptExecutionContext* scriptExecutionContext) { return adoptRef(new DOMURL(scriptExecutionContext)); } … … 50 51 void revokeObjectURL(const String&); 51 52 52 void contextDestroyed();53 ScriptExecutionContext* scriptExecutionContext() const { return m_scriptExecutionContext; }54 55 53 private: 56 54 explicit DOMURL(ScriptExecutionContext*); 57 58 ScriptExecutionContext* m_scriptExecutionContext;59 55 }; 60 56
Note:
See TracChangeset
for help on using the changeset viewer.