Closed
Bug 904826
Opened 12 years ago
Closed 12 years ago
Remove nsLayoutStatics::AddRef/Release calls that are no longer needed
Categories
(Core :: XPCOM, defect)
Core
XPCOM
Tracking
()
RESOLVED
FIXED
mozilla26
People
(Reporter: mccr8, Assigned: mccr8)
References
(Blocks 1 open bug)
Details
Attachments
(2 files, 1 obsolete file)
|
17.23 KB,
patch
|
smaug
:
review+
bholley
:
review+
|
Details | Diff | Splinter Review |
|
926 bytes,
patch
|
bzbarsky
:
review+
|
Details | Diff | Splinter Review |
These used to be needed to make sure XPConnect didn't go away while things were still in nsJSHolders, but khuey's refactoring for CC in workers means that isn't needed any more for that purpose.
Bonus points if we create an RAII class for addref/releasing layout statics and replace all the needed references with that.
| Assignee | ||
Comment 2•12 years ago
|
||
nsDOMFileReader looks like it may do this
file reader, xhr, websocket, event source, archive reader, and archive request were the ones I saw that looked like they could obviously go.
(In reply to Kyle Huey [:khuey] (khuey@mozilla.com) from comment #1)
> Bonus points if we create an RAII class for addref/releasing layout statics
> and replace all the needed references with that.
There already exists one in nsLayoutStatics.h - nsLayoutStaticsRef
| Assignee | ||
Comment 5•12 years ago
|
||
Here's a basic patch, fwiw. I think the Lazy Content Unbinder one can also go.
Mine was a little overreaching than yours, and things went really wrong.
https://tbpl.mozilla.org/?tree=Try&rev=84ab17c6f16a
Do you want to push to try?
Flags: needinfo?(continuation)
| Assignee | ||
Comment 7•12 years ago
|
||
Sure, I'll do that. Looking at a few of the stacks, it looks like the problem with your push was just the WorkerRunnable thing.
Flags: needinfo?(continuation)
| Assignee | ||
Comment 8•12 years ago
|
||
| Assignee | ||
Comment 9•12 years ago
|
||
nsContentUtils::WrapNative can certainly be cleaned up a bit. I'm pretty sure that AddRefing XPConnect from off the main thread is verboten now, so that whole codepath can go. I also expect that the reason the statics stuff exists is for the CC, so maybe that will be okay to remove, too.
| Assignee | ||
Updated•12 years ago
|
Assignee: nobody → continuation
| Assignee | ||
Comment 10•12 years ago
|
||
Good point about the unused includes. I've removed them locally, too. I'll upload an updated patch when I'm sure it compiles.
| Assignee | ||
Updated•12 years ago
|
Blocks: includehell
| Assignee | ||
Comment 11•12 years ago
|
||
This removes layout statics from a few headers, but ends up having to add nsThreadUtils to some other header, so maybe that's not a win over all. I might be able to track down the files that use the macros and directly include there, though that's a bit gross.
Attachment #792494 -
Attachment is obsolete: true
| Assignee | ||
Comment 12•12 years ago
|
||
I left the AddRef/Release calls in nsNodeInfoManager, though maybe they can be eliminated, too.
I also left them being in nsGlobalWindow and workers/RuntimeService.cpp, as those seem like fairly "top level" structures that may legitimately want to hold layout statics stuff alive. Nikhil attempted to remove the latter in his try run, and it make things quite orange. The problem seemed to be dom::workers::WorkerRunnable::Run() calling nsContentUtils::GetSafeJSContext() during shutdown.
I left behind the uses in nsStyleSheetService.cpp and nsLayoutModule.cpp because I didn't understand them, and that is actually in the layout directory, so maybe it is related.
| Assignee | ||
Comment 13•12 years ago
|
||
| Assignee | ||
Comment 14•12 years ago
|
||
Comment on attachment 793104 [details] [diff] [review]
remove some more
try run is green. bholley for the changes in nsContentUtils.cpp, smaug for the rest.
Attachment #793104 -
Flags: review?(bugs)
Attachment #793104 -
Flags: review?(bobbyholley+bmo)
Comment 15•12 years ago
|
||
Comment on attachment 793104 [details] [diff] [review]
remove some more
Review of attachment 793104 [details] [diff] [review]:
-----------------------------------------------------------------
XPConnect is definitely alive until we invoke DestroyXPConnectSingleton() in the xpc module destructor, which should be invoked relatively late in XPCOM shutdown. So this should be fine.
r=bholley on the nsContentUtils changes.
Attachment #793104 -
Flags: review?(bobbyholley+bmo) → review+
Comment 16•12 years ago
|
||
Comment on attachment 793104 [details] [diff] [review]
remove some more
This is somewhat risky, so please push try: -a
Attachment #793104 -
Flags: review?(bugs) → review+
| Assignee | ||
Comment 17•12 years ago
|
||
| Assignee | ||
Comment 18•12 years ago
|
||
Thanks for the reviews.
https://hg.mozilla.org/integration/mozilla-inbound/rev/365053e73efa
| Assignee | ||
Comment 19•12 years ago
|
||
backed out: https://hg.mozilla.org/integration/mozilla-inbound/rev/baba4649d3b3
Bindings code stopped building, due to NS_IsMainThread not being declared, so I assume some recent header changes caused some code to start bootlegging through one of the layout statics headers I removed... Some bindings codegen will need to include nsThreadUtils now.
| Assignee | ||
Comment 20•12 years ago
|
||
There are three places in Codegen.py that generate NS_IsMainThread. I'll try to figure out under what conditions they are generated, and extend the include generation stuff to include nsThreadUtils in those cases.
| Assignee | ||
Comment 21•12 years ago
|
||
Maybe I'll just include nsThreadUtils in BindingUtils.h, and deal with improving CodeGen in a followup.
| Assignee | ||
Comment 22•12 years ago
|
||
The problem here is that various bindings code uses NS_IsMainThread(), but with my removal of the include of nsLayoutStatics from CallbackObject.h, nothing defines that. This patch just adds an include of nsThreadUtils.h to BindingUtils.h, which seems a little more precise than CallbackObject.h, and includes the latter anyways, so it isn't any worse.
bz, you've been looking at bindings include code, so I'm flagging you for review on this. I'll land this folded with the previous patch. I can file a followup about being smarter in .cpp codegen about when we should include nsThreadUtils or not, but it didn't look trivial, and I'd like to get this landed before it bitrots further with the current #includeapalooza.
Attachment #796258 -
Flags: review?(bzbarsky)
Comment 23•12 years ago
|
||
Comment on attachment 796258 [details] [diff] [review]
fix bindings build problems in a hacky way
Yeah, r=me.
We're going to need this for any .cpp file with non-worker descriptors that have any methods or attributes, and for any file with chromeonly stuff, and any file with a dictionary. Followup for narrowing this down further is fine, especially because it'll be easier once bug 909639 lands.
Attachment #796258 -
Flags: review?(bzbarsky) → review+
Comment 24•12 years ago
|
||
Actually, the other simple option is to throw this into the always-included headers in codegen and thus hide from non-codegen includers of BindingUtils. The only issue with that is that it'll conflict with bug 909639. So just make sure a followup is filed?
| Assignee | ||
Comment 25•12 years ago
|
||
Filed 909971 for removing the include from BindingUtils.
https://hg.mozilla.org/integration/mozilla-inbound/rev/e4863a504838
Comment 26•12 years ago
|
||
Status: NEW → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla26
You need to log in
before you can comment on or make changes to this bug.
Description
•