зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1292892 part 7 - Remove unnecessary JSContext arguments from IPC classes. r=bz
This commit is contained in:
Родитель
5149714d22
Коммит
b066365085
|
@ -27,7 +27,7 @@ namespace dom {
|
|||
PJavaScriptChild*
|
||||
nsIContentChild::AllocPJavaScriptChild()
|
||||
{
|
||||
return NewJavaScriptChild(danger::GetJSContext());
|
||||
return NewJavaScriptChild();
|
||||
}
|
||||
|
||||
bool
|
||||
|
|
|
@ -58,7 +58,7 @@ nsIContentParent::AsContentBridgeParent()
|
|||
PJavaScriptParent*
|
||||
nsIContentParent::AllocPJavaScriptParent()
|
||||
{
|
||||
return NewJavaScriptParent(danger::GetJSContext());
|
||||
return NewJavaScriptParent();
|
||||
}
|
||||
|
||||
bool
|
||||
|
|
|
@ -78,13 +78,13 @@ void
|
|||
GetWrappedCPOWTag(JSObject* obj, nsACString& out);
|
||||
|
||||
PJavaScriptParent*
|
||||
NewJavaScriptParent(JSContext* cx);
|
||||
NewJavaScriptParent();
|
||||
|
||||
void
|
||||
ReleaseJavaScriptParent(PJavaScriptParent* parent);
|
||||
|
||||
PJavaScriptChild*
|
||||
NewJavaScriptChild(JSContext* cx);
|
||||
NewJavaScriptChild();
|
||||
|
||||
void
|
||||
ReleaseJavaScriptChild(PJavaScriptChild* child);
|
||||
|
|
|
@ -22,11 +22,6 @@ class JavaScriptBase : public WrapperOwner, public WrapperAnswer, public Base
|
|||
typedef WrapperAnswer Answer;
|
||||
|
||||
public:
|
||||
explicit JavaScriptBase(JSContext* cx)
|
||||
: JavaScriptShared(cx),
|
||||
WrapperOwner(cx),
|
||||
WrapperAnswer(cx)
|
||||
{}
|
||||
virtual ~JavaScriptBase() {}
|
||||
|
||||
virtual void ActorDestroy(WrapperOwner::ActorDestroyReason why) {
|
||||
|
|
|
@ -26,15 +26,10 @@ UpdateChildWeakPointersBeforeSweepingZoneGroup(JSContext* cx, void* data)
|
|||
static_cast<JavaScriptChild*>(data)->updateWeakPointers();
|
||||
}
|
||||
|
||||
JavaScriptChild::JavaScriptChild(JSContext* cx)
|
||||
: JavaScriptShared(cx),
|
||||
JavaScriptBase<PJavaScriptChild>(cx)
|
||||
{
|
||||
}
|
||||
|
||||
JavaScriptChild::~JavaScriptChild()
|
||||
{
|
||||
JS_RemoveWeakPointerZoneGroupCallback(cx_, UpdateChildWeakPointersBeforeSweepingZoneGroup);
|
||||
JSContext* cx = dom::danger::GetJSContext();
|
||||
JS_RemoveWeakPointerZoneGroupCallback(cx, UpdateChildWeakPointersBeforeSweepingZoneGroup);
|
||||
}
|
||||
|
||||
bool
|
||||
|
@ -45,7 +40,8 @@ JavaScriptChild::init()
|
|||
if (!WrapperAnswer::init())
|
||||
return false;
|
||||
|
||||
JS_AddWeakPointerZoneGroupCallback(cx_, UpdateChildWeakPointersBeforeSweepingZoneGroup, this);
|
||||
JSContext* cx = dom::danger::GetJSContext();
|
||||
JS_AddWeakPointerZoneGroupCallback(cx, UpdateChildWeakPointersBeforeSweepingZoneGroup, this);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -66,9 +62,9 @@ JavaScriptChild::scopeForTargetObjects()
|
|||
}
|
||||
|
||||
PJavaScriptChild*
|
||||
mozilla::jsipc::NewJavaScriptChild(JSContext* cx)
|
||||
mozilla::jsipc::NewJavaScriptChild()
|
||||
{
|
||||
JavaScriptChild* child = new JavaScriptChild(cx);
|
||||
JavaScriptChild* child = new JavaScriptChild();
|
||||
if (!child->init()) {
|
||||
delete child;
|
||||
return nullptr;
|
||||
|
|
|
@ -17,7 +17,6 @@ namespace jsipc {
|
|||
class JavaScriptChild : public JavaScriptBase<PJavaScriptChild>
|
||||
{
|
||||
public:
|
||||
explicit JavaScriptChild(JSContext* cx);
|
||||
virtual ~JavaScriptChild();
|
||||
|
||||
bool init();
|
||||
|
|
|
@ -30,15 +30,9 @@ TraceParent(JSTracer* trc, void* data)
|
|||
static_cast<JavaScriptParent*>(data)->trace(trc);
|
||||
}
|
||||
|
||||
JavaScriptParent::JavaScriptParent(JSContext* cx)
|
||||
: JavaScriptShared(cx),
|
||||
JavaScriptBase<PJavaScriptParent>(cx)
|
||||
{
|
||||
}
|
||||
|
||||
JavaScriptParent::~JavaScriptParent()
|
||||
{
|
||||
JS_RemoveExtraGCRootsTracer(cx_, TraceParent, this);
|
||||
JS_RemoveExtraGCRootsTracer(danger::GetJSContext(), TraceParent, this);
|
||||
}
|
||||
|
||||
bool
|
||||
|
@ -47,7 +41,7 @@ JavaScriptParent::init()
|
|||
if (!WrapperOwner::init())
|
||||
return false;
|
||||
|
||||
JS_AddExtraGCRootsTracer(cx_, TraceParent, this);
|
||||
JS_AddExtraGCRootsTracer(danger::GetJSContext(), TraceParent, this);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -190,9 +184,9 @@ JavaScriptParent::CloneProtocol(Channel* aChannel, ProtocolCloneContext* aCtx)
|
|||
}
|
||||
|
||||
PJavaScriptParent*
|
||||
mozilla::jsipc::NewJavaScriptParent(JSContext* cx)
|
||||
mozilla::jsipc::NewJavaScriptParent()
|
||||
{
|
||||
JavaScriptParent* parent = new JavaScriptParent(cx);
|
||||
JavaScriptParent* parent = new JavaScriptParent();
|
||||
if (!parent->init()) {
|
||||
delete parent;
|
||||
return nullptr;
|
||||
|
|
|
@ -17,7 +17,6 @@ namespace jsipc {
|
|||
class JavaScriptParent : public JavaScriptBase<PJavaScriptParent>
|
||||
{
|
||||
public:
|
||||
explicit JavaScriptParent(JSContext* cx);
|
||||
virtual ~JavaScriptParent();
|
||||
|
||||
bool init();
|
||||
|
|
|
@ -132,9 +132,8 @@ bool JavaScriptShared::sLoggingInitialized;
|
|||
bool JavaScriptShared::sLoggingEnabled;
|
||||
bool JavaScriptShared::sStackLoggingEnabled;
|
||||
|
||||
JavaScriptShared::JavaScriptShared(JSContext* cx)
|
||||
: cx_(cx),
|
||||
refcount_(1),
|
||||
JavaScriptShared::JavaScriptShared()
|
||||
: refcount_(1),
|
||||
nextSerialNumber_(1)
|
||||
{
|
||||
if (!sLoggingInitialized) {
|
||||
|
|
|
@ -130,7 +130,7 @@ class Logging;
|
|||
class JavaScriptShared : public CPOWManager
|
||||
{
|
||||
public:
|
||||
explicit JavaScriptShared(JSContext* cx);
|
||||
JavaScriptShared();
|
||||
virtual ~JavaScriptShared();
|
||||
|
||||
bool init();
|
||||
|
@ -183,7 +183,6 @@ class JavaScriptShared : public CPOWManager
|
|||
virtual JSObject* scopeForTargetObjects() = 0;
|
||||
|
||||
protected:
|
||||
JSContext* cx_;
|
||||
uintptr_t refcount_;
|
||||
|
||||
IdToObjectMap objects_;
|
||||
|
|
|
@ -21,8 +21,6 @@ namespace jsipc {
|
|||
class WrapperAnswer : public virtual JavaScriptShared
|
||||
{
|
||||
public:
|
||||
explicit WrapperAnswer(JSContext* cx) : JavaScriptShared(cx) {}
|
||||
|
||||
bool RecvPreventExtensions(const ObjectId& objId, ReturnStatus* rs);
|
||||
bool RecvGetPropertyDescriptor(const ObjectId& objId, const JSIDVariant& id,
|
||||
ReturnStatus* rs,
|
||||
|
|
|
@ -50,9 +50,8 @@ struct AuxCPOWData
|
|||
{}
|
||||
};
|
||||
|
||||
WrapperOwner::WrapperOwner(JSContext* cx)
|
||||
: JavaScriptShared(cx),
|
||||
inactive_(false)
|
||||
WrapperOwner::WrapperOwner()
|
||||
: inactive_(false)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@ class WrapperOwner : public virtual JavaScriptShared
|
|||
mozilla::ipc::IProtocol>::ActorDestroyReason
|
||||
ActorDestroyReason;
|
||||
|
||||
explicit WrapperOwner(JSContext* cx);
|
||||
WrapperOwner();
|
||||
bool init();
|
||||
|
||||
// Standard internal methods.
|
||||
|
|
Загрузка…
Ссылка в новой задаче