XPCOMGC/Stack Pointers: Difference between revisions

no edit summary
No edit summary
No edit summary
 
Line 36: Line 36:
sed 's/.home.tglek.work.actionmonkey.//' /tmp/nsgenerichtmlelement.diff |filterdiff -x xpcom/glue/nsCOMPtr.h -x xpcom/glue/nsIWeakReferenceUtils.h -x xpcom/glue/nsThreadUtils.h -x xpcom/threads/nsThread.h -x /\* |patch -p0 --dry-run</pre>
sed 's/.home.tglek.work.actionmonkey.//' /tmp/nsgenerichtmlelement.diff |filterdiff -x xpcom/glue/nsCOMPtr.h -x xpcom/glue/nsIWeakReferenceUtils.h -x xpcom/glue/nsThreadUtils.h -x xpcom/threads/nsThread.h -x /\* |patch -p0 --dry-run</pre>


Functions that take COMPtr& parameters make life difficult(especially if those are templated).
[https://bugzilla.mozilla.org/show_bug.cgi?id=409088 Attribute-based rewrites]
Given <pre>template<class T> void getter(nsCOMPtr<T>& ptr) </pre>
 
rewrite it to <pre>template<class T> void getter(T*& ptr) </pre>
Functions that take COMPtr& parameters make life difficult(especially if those are templated). COMPtr& gets the & converted to a *, a couple of other funky cases exist.
Then rewrite code in the function as usual.
However callers now turn into 2 cases.
a) Being called with a stack variable -> change code as usual
b) Called with a heap var -> wrap with getter_AddRefs (This way write barrier will be triggered).
Confirmed users
381

edits