Closed
Bug 883920
Opened 11 years ago
Closed 11 years ago
Make HoldJSObjects and DropJSObjects work with inheritance
Categories
(Core :: XPCOM, defect)
Core
XPCOM
Tracking
()
RESOLVED
FIXED
mozilla26
People
(Reporter: mccr8, Assigned: mccr8)
References
(Blocks 1 open bug)
Details
Attachments
(1 file, 4 obsolete files)
55.93 KB,
patch
|
peterv
:
review+
|
Details | Diff | Splinter Review |
If an nsISupports class nsFoo has a subtype nsBar with its own participant, and |x| is an instance of nsBar, then |NS_HOLD_JS_OBJECTS(x, nsFoo);| will result in |x| being added with nsFoo's participant, not nsBar's. This is especially tricky if nsBar initially didn't have its own participant, but was later changed.
There should be some kind of nsISupports HOLD/DROP that does all of the proper canonicalization, and leave the existing form for non-nsISupports cycle collected classes, which don't support inheritance right now anyways.
Assignee | ||
Comment 1•11 years ago
|
||
Assignee | ||
Comment 2•11 years ago
|
||
One thing I don't like about this is that it requires adding XPCOM glue functions.
Attachment #789738 -
Attachment is obsolete: true
Assignee | ||
Comment 3•11 years ago
|
||
Attachment #790255 -
Attachment is obsolete: true
Assignee | ||
Comment 4•11 years ago
|
||
I'm not writing the patch for this purpose, but it does let us drop a number of dependencies on nsContentUtils, which is a fairly giant header.
Blocks: includehell
Comment 5•11 years ago
|
||
(In reply to comment #4)
> I'm not writing the patch for this purpose, but it does let us drop a number of
> dependencies on nsContentUtils, which is a fairly giant header.
\o/
Assignee | ||
Comment 6•11 years ago
|
||
Attachment #791045 -
Attachment is obsolete: true
Assignee | ||
Comment 7•11 years ago
|
||
Attachment #791537 -
Attachment is obsolete: true
Assignee | ||
Updated•11 years ago
|
Summary: Make NS_HOLD_JS_OBJECTS and NS_DROP_JS_OBJECTS work with inheritance → Make HoldJSObjects and DropJSObjects work with inheritance
Assignee | ||
Comment 8•11 years ago
|
||
Comment on attachment 792419 [details] [diff] [review]
Use templates for HoldJSObjects and DropJSObjects
Suggestions welcome for naming and namespace for HoldJSObjects and DropJSObjects or whatever. There's a lot of bootlegging for the new header. I'd be happy to fix that if you think it would be better.
The main drawback of this patch is that we're going to QI every time we do hold and maybe drop, but hopefully that's not a big deal.
try run: https://tbpl.mozilla.org/?tree=Try&rev=fe03c887b3fc
Attachment #792419 -
Flags: review?(peterv)
Comment 9•11 years ago
|
||
I'll get to this tomorrow.
Assignee | ||
Comment 10•11 years ago
|
||
In IRC, ms2ger suggests omitting the "ns" from nsCycleCollectionHoldDrop.h, so I can do that if it makes sense.
Comment 11•11 years ago
|
||
Comment on attachment 792419 [details] [diff] [review]
Use templates for HoldJSObjects and DropJSObjects
Review of attachment 792419 [details] [diff] [review]:
-----------------------------------------------------------------
::: dom/indexedDB/IDBCursor.cpp
@@ +321,5 @@
> IDBDatabase* database = aTransaction->Database();
> cursor->mScriptOwner = database->GetScriptOwner();
>
> if (cursor->mScriptOwner) {
> + mozilla::HoldJSObjects(cursor.get());
So without a get, would we end up using the non-nsISupports template? If so, that's a little scary and we might want to add a template for SmartPtr? (|template <template <typename> class SmartPtr, typename T>|, ugh)
Attachment #792419 -
Flags: review?(peterv) → review+
Assignee | ||
Comment 12•11 years ago
|
||
IIRC, it just didn't compile, but I'll double check that.
Comment 13•11 years ago
|
||
Ah, because of the NS_CYCLE_COLLECTION_PARTICIPANT?
Assignee | ||
Comment 14•11 years ago
|
||
(In reply to Peter Van der Beken [:peterv] from comment #13)
> Ah, because of the NS_CYCLE_COLLECTION_PARTICIPANT?
Yeah, probably. And drop fails presumably because it is under the same template abstraction as hold, which I decided to do fairly arbitrarily, but I guess it works out...
Assignee | ||
Comment 15•11 years ago
|
||
Landed with an additional fix for nsXULPDGlobalObject. I ended up leaving the "ns" in the file name, because most of the things in xpcom/glue were doing that and I wasn't sure how it should go exactly.
https://hg.mozilla.org/integration/mozilla-inbound/rev/40b6e7719101
Comment 16•11 years ago
|
||
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla26
You need to log in
before you can comment on or make changes to this bug.
Description
•