Closed Bug 1541684 Opened 5 years ago Closed 5 years ago

Turn nsXPCWrappedJSClass into a refcounted shell around an nsXPTInterfaceInfo

Categories

(Core :: XPConnect, task, P2)

task

Tracking

()

RESOLVED FIXED
mozilla68
Tracking Status
firefox68 --- fixed

People

(Reporter: mccr8, Assigned: mccr8)

References

Details

Attachments

(4 files)

nsXPCWrappedJSClass has a number of fields, but only the nsXPTInterfaceInfo* is really necessary. Removing the other fields will make it easier to avoid dynamic allocations in bug 1540301.

uint32_t* mDescriptors: This is used to cache the result of calling XPCConvert::IsMethodReflectable() on the nsXPTMethodInfo for this interface. However, we can just compute that ahead of time and store it in nsXPTMethodInfo. mNotXPCOM and mHidden are only used to compute this value, so we can remove those at the same time to avoid making nsXPTMethodInfo any bigger.

XPCJSRuntime* mRuntime: Fortunately, we only have a single XPCJSRuntime nowadays, so we can just grab it via a static helper method instead of storing a pointer to it in every class.

nsIID mIID: This is literally just a field on nsXPTInterfaceInfo.

There is only a single XPC JS runtime now, so there's no need to keep a
special pointer around.

This is already stored on mInfo.

PCConvert::IsMethodReflectable() is derived entirely from
nsXPTMethodInfo, so we can compute it at build time and include it in
nsXPTMethodInfo. It is the only use of mNotXPCOM and mHidden, so we
can get rid of those fields at the same time.

This paves the way for getting rid of XPCWrappedJSClass::mDescriptors
in the next patch.

This field now just caches the IsReflectable() field from the method
info, so get rid of it.

Pushed by amccreight@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/900f639d72a3
part 1 - Remove XPCWrappedJSClass::mRuntime. r=bzbarsky
https://hg.mozilla.org/integration/autoland/rev/a37029984f13
part 2 - Remove nsXPCWrappedJSClass::mIID. r=nika
https://hg.mozilla.org/integration/autoland/rev/16d5f0b792d4
part 3 - Statically compute if a method is reflectable. r=nika
https://hg.mozilla.org/integration/autoland/rev/b021ea89cf04
part 4 - Remove nsXPCWrappedJSClass:mDescriptors. r=nika

I've made the trivial fix, but I can't reland it because Lando thinks the landing yesterday never happened. I filed bug 1542247 for this.

Depends on: 1542247
Flags: needinfo?(continuation)
Pushed by amccreight@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/bed1eb89f503
part 1 - Remove XPCWrappedJSClass::mRuntime. r=bzbarsky
https://hg.mozilla.org/integration/autoland/rev/c83c13b0c0ae
part 2 - Remove nsXPCWrappedJSClass::mIID. r=nika
https://hg.mozilla.org/integration/autoland/rev/6af7c0f7383b
part 3 - Statically compute if a method is reflectable. r=nika
https://hg.mozilla.org/integration/autoland/rev/977637ae4f70
part 4 - Remove nsXPCWrappedJSClass:mDescriptors. r=nika
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: