Closed
Bug 961551
Opened 10 years ago
Closed 10 years ago
Clean up XPCWrappedJS::GetNewOrUsed some more
Categories
(Core :: XPConnect, defect)
Core
XPConnect
Tracking
()
RESOLVED
FIXED
mozilla29
People
(Reporter: mccr8, Assigned: mccr8)
Details
Attachments
(9 files)
2.21 KB,
patch
|
bholley
:
review+
|
Details | Diff | Splinter Review |
2.27 KB,
patch
|
bholley
:
review+
|
Details | Diff | Splinter Review |
1.97 KB,
patch
|
bholley
:
review+
|
Details | Diff | Splinter Review |
2.59 KB,
patch
|
bholley
:
review+
|
Details | Diff | Splinter Review |
2.92 KB,
patch
|
bholley
:
review+
|
Details | Diff | Splinter Review |
2.88 KB,
patch
|
bholley
:
review+
|
Details | Diff | Splinter Review |
2.38 KB,
patch
|
bholley
:
review+
|
Details | Diff | Splinter Review |
2.41 KB,
patch
|
bholley
:
review+
|
Details | Diff | Splinter Review |
2.63 KB,
patch
|
bholley
:
review+
|
Details | Diff | Splinter Review |
No description provided.
Assignee | ||
Comment 1•10 years ago
|
||
This reduces the length of nsXPCWrappedJS::GetNewOrUsed by 28 lines, and makes the body just barely fit all on my screen at once. https://tbpl.mozilla.org/?tree=Try&rev=e199e1d1446c
Assignee | ||
Comment 2•10 years ago
|
||
Attachment #8362680 -
Flags: review?(bobbyholley+bmo)
Assignee | ||
Comment 3•10 years ago
|
||
This paves the way for smart pointerization.
Attachment #8362681 -
Flags: review?(bobbyholley+bmo)
Assignee | ||
Comment 4•10 years ago
|
||
This is trickier than it looks, because this change causes additional refcount traffic on |root| in the case where FindOrFindInherited succeeds. This is potentially bad because if a WJS has a refcount of 1, and no weak references to it, then if it goes to a refcount of 2 then back to 1 it will be deleted. A WJS can get in this state if it is a root with a refcount of 2, and has a weak reference, then its refcount drops to 1, then later the weak reference goes away. However, in this case, there can be no other WJS in the chain, or the refcount would be greater than 1, so FindOrFindInherited must end up returning |root|, so |wrapper == root|, and the assignment to |wrapper| will make root go to a refcount of 3, so the release of |root| on exit will only cause the refcount to go to 2, so |root| won't be deleted.
Attachment #8362682 -
Flags: review?(bobbyholley+bmo)
Assignee | ||
Comment 5•10 years ago
|
||
GetNewOrUsed now always releases |root| when |root| is non-null, so release_root can be eliminated.
Attachment #8362683 -
Flags: review?(bobbyholley+bmo)
Assignee | ||
Comment 6•10 years ago
|
||
Attachment #8362684 -
Flags: review?(bobbyholley+bmo)
Assignee | ||
Comment 7•10 years ago
|
||
Attachment #8362685 -
Flags: review?(bobbyholley+bmo)
Assignee | ||
Comment 8•10 years ago
|
||
Also, move the declaration of |clasp| down to where it is used.
Attachment #8362686 -
Flags: review?(bobbyholley+bmo)
Assignee | ||
Comment 9•10 years ago
|
||
The code at the end of nsXPCWrappedJS::GetNewOrUsed will now correctly construct a root wrapper when |root == nullptr|, so we can consolidate the two places that construct |wrapper|.
Attachment #8362687 -
Flags: review?(bobbyholley+bmo)
Assignee | ||
Comment 10•10 years ago
|
||
Attachment #8362688 -
Flags: review?(bobbyholley+bmo)
Comment 11•10 years ago
|
||
Comment on attachment 8362680 [details] [diff] [review] part 1 - Add root wrappers to the map in XPCWrappedJS ctor. Review of attachment 8362680 [details] [diff] [review]: ----------------------------------------------------------------- ::: js/xpconnect/src/XPCWrappedJS.cpp @@ +411,5 @@ > NS_ADDREF_THIS(); > > + if (IsRootWrapper()) { > + nsXPConnect::GetRuntimeInstance()->GetWrappedJSMap()->Add(cx, this); > + } else { Indentation
Updated•10 years ago
|
Attachment #8362680 -
Flags: review?(bobbyholley+bmo) → review+
Updated•10 years ago
|
Attachment #8362681 -
Flags: review?(bobbyholley+bmo) → review+
Updated•10 years ago
|
Attachment #8362682 -
Flags: review?(bobbyholley+bmo) → review+
Updated•10 years ago
|
Attachment #8362683 -
Flags: review?(bobbyholley+bmo) → review+
Updated•10 years ago
|
Attachment #8362684 -
Flags: review?(bobbyholley+bmo) → review+
Updated•10 years ago
|
Attachment #8362685 -
Flags: review?(bobbyholley+bmo) → review+
Updated•10 years ago
|
Attachment #8362686 -
Flags: review?(bobbyholley+bmo) → review+
Comment 12•10 years ago
|
||
Comment on attachment 8362687 [details] [diff] [review] part 8 - Use the code at the end of XPCWJS::GetNewOrUsed to build a new root wrapper. Review of attachment 8362687 [details] [diff] [review]: ----------------------------------------------------------------- Clever.
Attachment #8362687 -
Flags: review?(bobbyholley+bmo) → review+
Comment 13•10 years ago
|
||
Comment on attachment 8362688 [details] [diff] [review] part 9 - Split scope of |wrapper|, plus other cleanup. Review of attachment 8362688 [details] [diff] [review]: ----------------------------------------------------------------- ::: js/xpconnect/src/XPCWrappedJS.cpp @@ +368,1 @@ > wrapper = new nsXPCWrappedJS(cx, jsObj, clasp, root); How about combining these two lines into a declare + assign?
Attachment #8362688 -
Flags: review?(bobbyholley+bmo) → review+
Comment 14•10 years ago
|
||
Also - I'm not sure if this is a new thing, but I'm kind of uncomfortable with writing |r=bholley| in the commit message of unreviewed patches that get published on bugzilla, since these things could float around and accidentally get committed. I always add the r= afterwards (using an interactive rebase) as a sanity-check to make sure that all patches I'm committing were r+ed. And I think doing this is important. Thoughts?
Flags: needinfo?(continuation)
Assignee | ||
Comment 15•10 years ago
|
||
> How about combining these two lines into a declare + assign?
It made the line a tiny bit wide, but I can do that.
Flags: needinfo?(continuation)
Assignee | ||
Comment 16•10 years ago
|
||
> Thoughts?
I'm not sure exactly what your concern is. Are you worried that somebody will accidentally commit a patch that is floating around in their git repo or that somebody will commit a patch that somebody else uploaded to bugzilla? I assume the former. Anyways, I'm pretty methodical with my patch landing, so I'm not really concerned about that personally (including looking at each bug and making sure I've addressed all review comments). Though maybe I could write out a more explicit check list to follow.
Assignee | ||
Comment 17•10 years ago
|
||
addressed comments remote: https://hg.mozilla.org/integration/mozilla-inbound/rev/d4bc1ae518c7 remote: https://hg.mozilla.org/integration/mozilla-inbound/rev/e6c31c9c36bb remote: https://hg.mozilla.org/integration/mozilla-inbound/rev/b402626107f8 remote: https://hg.mozilla.org/integration/mozilla-inbound/rev/802f26863b48 remote: https://hg.mozilla.org/integration/mozilla-inbound/rev/ff626945d531 remote: https://hg.mozilla.org/integration/mozilla-inbound/rev/6a0a216f68f6 remote: https://hg.mozilla.org/integration/mozilla-inbound/rev/0dc6b8213fd2 remote: https://hg.mozilla.org/integration/mozilla-inbound/rev/1ad4a8494e6c remote: https://hg.mozilla.org/integration/mozilla-inbound/rev/a8129fa38c35
Comment 18•10 years ago
|
||
https://hg.mozilla.org/mozilla-central/rev/d4bc1ae518c7 https://hg.mozilla.org/mozilla-central/rev/e6c31c9c36bb https://hg.mozilla.org/mozilla-central/rev/b402626107f8 https://hg.mozilla.org/mozilla-central/rev/802f26863b48 https://hg.mozilla.org/mozilla-central/rev/ff626945d531 https://hg.mozilla.org/mozilla-central/rev/6a0a216f68f6 https://hg.mozilla.org/mozilla-central/rev/0dc6b8213fd2 https://hg.mozilla.org/mozilla-central/rev/1ad4a8494e6c https://hg.mozilla.org/mozilla-central/rev/a8129fa38c35
Status: NEW → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla29
You need to log in
before you can comment on or make changes to this bug.
Description
•