Bug 21642

Summary: Abstract out active object tracking
Product: WebKit Reporter: Alexey Proskuryakov <ap>
Component: WebCore JavaScriptAssignee: Alexey Proskuryakov <ap>
Status: RESOLVED FIXED    
Severity: Normal    
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Mac   
OS: OS X 10.5   
Attachments:
Description Flags
proposed patch sam: review+

Description Alexey Proskuryakov 2008-10-16 09:57:42 PDT
Currently there are two kinds of active objects (XMLHttpRequest and MessagePort), but there will be more in the near future.

We should abstract out as much code as possible to avoid tracking them all separately in Document.
Comment 1 Alexey Proskuryakov 2008-10-17 00:18:46 PDT
Created attachment 24454 [details]
proposed patch

MessagePort is a special case, because these need to be tracked for cross-heap GC.
Comment 2 Sam Weinig 2008-10-17 00:53:18 PDT
Comment on attachment 24454 [details]
proposed patch

+        ActiveDOMObject(Document* document, void* upcastPointer);
The document parameter name here is not needed.

+        template<class T> void setPendingActivity(T* This)
+        {
+            ASSERT(This == this);
We don't usually have variables that start with a capital letter.  Perhaps thisObject?

+} // namespace WebCore
+
+#endif // MessagePort_h

You meant ActiveDOMObject_h I think.

My main concern with this patch is the name ActiveDOMObject, which I don't think conveys the idea intended.  I also think it may be cleaner to store the upcaster pointer in the ActiveDOMObject instead of the HashMap.  

r=me.
Comment 3 Alexey Proskuryakov 2008-10-17 01:12:38 PDT
Committed revision 37649.

Discussed suggestions on IRC - sadly, we don't have an idea for a better name.