Bug 1257725 part 6. Get rid of ThreadsafeAutoJSContext. r=bholley

This commit is contained in:
Boris Zbarsky 2016-03-23 11:02:57 -04:00
parent ede5a13ec4
commit 08a17f586c
2 changed files with 0 additions and 38 deletions

View File

@ -851,28 +851,6 @@ AutoJSContext::operator JSContext*() const
return mCx;
}
ThreadsafeAutoJSContext::ThreadsafeAutoJSContext(MOZ_GUARD_OBJECT_NOTIFIER_ONLY_PARAM_IN_IMPL)
{
MOZ_GUARD_OBJECT_NOTIFIER_INIT;
if (NS_IsMainThread()) {
mCx = nullptr;
mAutoJSContext.emplace();
} else {
mCx = mozilla::dom::workers::GetCurrentThreadJSContext();
mRequest.emplace(mCx);
}
}
ThreadsafeAutoJSContext::operator JSContext*() const
{
if (mCx) {
return mCx;
} else {
return *mAutoJSContext;
}
}
AutoSafeJSContext::AutoSafeJSContext(MOZ_GUARD_OBJECT_NOTIFIER_ONLY_PARAM_IN_IMPL)
: AutoJSAPI()
{

View File

@ -444,22 +444,6 @@ protected:
MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
};
/**
* Use ThreadsafeAutoJSContext when you want an AutoJSContext but might be
* running on a worker thread.
*/
class MOZ_RAII ThreadsafeAutoJSContext {
public:
explicit ThreadsafeAutoJSContext(MOZ_GUARD_OBJECT_NOTIFIER_ONLY_PARAM);
operator JSContext*() const;
private:
JSContext* mCx; // Used on workers. Null means mainthread.
Maybe<JSAutoRequest> mRequest; // Used on workers.
Maybe<AutoJSContext> mAutoJSContext; // Used on main thread.
MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
};
/**
* AutoSafeJSContext is similar to AutoJSContext but will only return the safe
* JS context. That means it will never call nsContentUtils::GetCurrentJSContext().