mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 901531. Remove the unused RootedJSValue class. r=ms2ger
This commit is contained in:
parent
fd990e273b
commit
504726dd7e
@ -580,66 +580,6 @@ public:
|
||||
{}
|
||||
};
|
||||
|
||||
class RootedJSValue
|
||||
{
|
||||
public:
|
||||
RootedJSValue()
|
||||
: mCx(nullptr)
|
||||
{}
|
||||
|
||||
~RootedJSValue()
|
||||
{
|
||||
if (mCx) {
|
||||
JS_RemoveValueRoot(mCx, &mValue);
|
||||
}
|
||||
}
|
||||
|
||||
bool SetValue(JSContext* aCx, JS::Value aValue)
|
||||
{
|
||||
// We don't go ahead and root if v is null, because we want to allow
|
||||
// null-initialization even when there is no cx.
|
||||
MOZ_ASSERT_IF(!aValue.isNull(), aCx);
|
||||
|
||||
// Be careful to not clobber mCx if it's already set, just in case we're
|
||||
// being null-initialized (with a null cx for some reason) after we have
|
||||
// already been initialized properly with a non-null value.
|
||||
if (!aValue.isNull() && !mCx) {
|
||||
if (!JS_AddNamedValueRoot(aCx, &mValue, "RootedJSValue::mValue")) {
|
||||
return false;
|
||||
}
|
||||
mCx = aCx;
|
||||
}
|
||||
|
||||
mValue = aValue;
|
||||
return true;
|
||||
}
|
||||
|
||||
// Note: This operator can be const because we return by value, not
|
||||
// by reference.
|
||||
operator JS::Value() const
|
||||
{
|
||||
return mValue;
|
||||
}
|
||||
|
||||
JS::Value* operator&()
|
||||
{
|
||||
return &mValue;
|
||||
}
|
||||
|
||||
const JS::Value* operator&() const
|
||||
{
|
||||
return &mValue;
|
||||
}
|
||||
|
||||
private:
|
||||
// Don't allow copy-construction of these objects, because it'll do the wrong
|
||||
// thing with our flag mCx.
|
||||
RootedJSValue(const RootedJSValue&) MOZ_DELETE;
|
||||
|
||||
JS::Value mValue;
|
||||
JSContext* mCx;
|
||||
};
|
||||
|
||||
inline nsWrapperCache*
|
||||
GetWrapperCache(nsWrapperCache* cache)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user