mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 677079 - Part r: Provide AutoSkipConservativeScan in jsfriendapi.h; r=luke
This commit is contained in:
parent
a68763cbfd
commit
47fef8e488
@ -539,6 +539,26 @@ GetRuntimeGCLock(const JSRuntime *rt)
|
||||
{
|
||||
return rt->gcLock;
|
||||
}
|
||||
|
||||
AutoSkipConservativeScan::AutoSkipConservativeScan(JSContext *cx
|
||||
MOZ_GUARD_OBJECT_NOTIFIER_PARAM_IN_IMPL)
|
||||
: context(cx)
|
||||
{
|
||||
MOZ_GUARD_OBJECT_NOTIFIER_INIT;
|
||||
|
||||
ThreadData &threadData = context->thread()->data;
|
||||
JS_ASSERT(threadData.requestDepth >= 1);
|
||||
JS_ASSERT(!threadData.conservativeGC.requestThreshold);
|
||||
if (threadData.requestDepth == 1)
|
||||
threadData.conservativeGC.requestThreshold = 1;
|
||||
}
|
||||
|
||||
AutoSkipConservativeScan::~AutoSkipConservativeScan()
|
||||
{
|
||||
ThreadData &threadData = context->thread()->data;
|
||||
if (threadData.requestDepth == 1)
|
||||
threadData.conservativeGC.requestThreshold = 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
JS_FRIEND_API(JSCompartment *)
|
||||
|
@ -461,6 +461,17 @@ GetContextOutstandingRequests(const JSContext *cx);
|
||||
|
||||
JS_FRIEND_API(PRLock *)
|
||||
GetRuntimeGCLock(const JSRuntime *rt);
|
||||
|
||||
class JS_FRIEND_API(AutoSkipConservativeScan)
|
||||
{
|
||||
public:
|
||||
AutoSkipConservativeScan(JSContext *cx MOZ_GUARD_OBJECT_NOTIFIER_PARAM);
|
||||
~AutoSkipConservativeScan();
|
||||
|
||||
private:
|
||||
JSContext *context;
|
||||
MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
|
||||
};
|
||||
#endif
|
||||
|
||||
JS_FRIEND_API(JSCompartment *)
|
||||
|
@ -69,8 +69,7 @@
|
||||
|
||||
#include "nsWrapperCacheInlines.h"
|
||||
|
||||
#include "jscntxt.h" // js::ThreadData, JS_TRACER_INIT, context->stackLimit,
|
||||
// sizeof(JSContext), js::CompartmentVector, cx->stack.empty()
|
||||
#include "jscntxt.h" // JS_TRACER_INIT, context->stackLimit, sizeof(JSContext), js::CompartmentVector, cx->stack.empty()
|
||||
|
||||
NS_IMPL_THREADSAFE_ISUPPORTS7(nsXPConnect,
|
||||
nsIXPConnect,
|
||||
@ -404,17 +403,11 @@ nsXPConnect::Collect(bool shrinkingGC)
|
||||
// cycle collection. So to compensate for JS_BeginRequest in
|
||||
// XPCCallContext::Init we disable the conservative scanner if that call
|
||||
// has started the request on this thread.
|
||||
js::ThreadData &threadData = cx->thread()->data;
|
||||
JS_ASSERT(threadData.requestDepth >= 1);
|
||||
JS_ASSERT(!threadData.conservativeGC.requestThreshold);
|
||||
if (threadData.requestDepth == 1)
|
||||
threadData.conservativeGC.requestThreshold = 1;
|
||||
js::AutoSkipConservativeScan ascs(cx);
|
||||
if (shrinkingGC)
|
||||
JS_ShrinkingGC(cx);
|
||||
else
|
||||
JS_GC(cx);
|
||||
if (threadData.requestDepth == 1)
|
||||
threadData.conservativeGC.requestThreshold = 0;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
Loading…
Reference in New Issue
Block a user