mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 677079 - Part o: Expose setActivityCallback in jsfriendapi.h; r=gal
This commit is contained in:
parent
dcc2192b9e
commit
5760a0138f
@ -337,9 +337,6 @@ typedef struct JSPropertyTreeEntry {
|
|||||||
js::Shape *child;
|
js::Shape *child;
|
||||||
} JSPropertyTreeEntry;
|
} JSPropertyTreeEntry;
|
||||||
|
|
||||||
typedef void
|
|
||||||
(* JSActivityCallback)(void *arg, JSBool active);
|
|
||||||
|
|
||||||
namespace js {
|
namespace js {
|
||||||
|
|
||||||
typedef Vector<JSCompartment *, 0, SystemAllocPolicy> CompartmentVector;
|
typedef Vector<JSCompartment *, 0, SystemAllocPolicy> CompartmentVector;
|
||||||
@ -378,18 +375,7 @@ struct JSRuntime
|
|||||||
/* Compartment create/destroy callback. */
|
/* Compartment create/destroy callback. */
|
||||||
JSCompartmentCallback compartmentCallback;
|
JSCompartmentCallback compartmentCallback;
|
||||||
|
|
||||||
/*
|
js::ActivityCallback activityCallback;
|
||||||
* Sets a callback that is run whenever the runtime goes idle - the
|
|
||||||
* last active request ceases - and begins activity - when it was
|
|
||||||
* idle and a request begins. Note: The callback is called under the
|
|
||||||
* GC lock.
|
|
||||||
*/
|
|
||||||
void setActivityCallback(JSActivityCallback cb, void *arg) {
|
|
||||||
activityCallback = cb;
|
|
||||||
activityCallbackArg = arg;
|
|
||||||
}
|
|
||||||
|
|
||||||
JSActivityCallback activityCallback;
|
|
||||||
void *activityCallbackArg;
|
void *activityCallbackArg;
|
||||||
|
|
||||||
/* Garbage collector state, used by jsgc.c. */
|
/* Garbage collector state, used by jsgc.c. */
|
||||||
|
@ -547,4 +547,10 @@ HasUnrootedGlobal(const JSContext *cx)
|
|||||||
return cx->hasRunOption(JSOPTION_UNROOTED_GLOBAL);
|
return cx->hasRunOption(JSOPTION_UNROOTED_GLOBAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
JS_FRIEND_API(void)
|
||||||
|
SetActivityCallback(JSRuntime *rt, ActivityCallback cb, void *arg)
|
||||||
|
{
|
||||||
|
rt->activityCallback = cb;
|
||||||
|
rt->activityCallbackArg = arg;
|
||||||
|
}
|
||||||
} // namespace js
|
} // namespace js
|
||||||
|
@ -464,6 +464,18 @@ GetContextCompartment(const JSContext *cx);
|
|||||||
JS_FRIEND_API(bool)
|
JS_FRIEND_API(bool)
|
||||||
HasUnrootedGlobal(const JSContext *cx);
|
HasUnrootedGlobal(const JSContext *cx);
|
||||||
|
|
||||||
|
typedef void
|
||||||
|
(* ActivityCallback)(void *arg, JSBool active);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Sets a callback that is run whenever the runtime goes idle - the
|
||||||
|
* last active request ceases - and begins activity - when it was
|
||||||
|
* idle and a request begins. Note: The callback is called under the
|
||||||
|
* GC lock.
|
||||||
|
*/
|
||||||
|
JS_FRIEND_API(void)
|
||||||
|
SetActivityCallback(JSRuntime *rt, ActivityCallback cb, void *arg);
|
||||||
|
|
||||||
class JS_FRIEND_API(AutoLockGC)
|
class JS_FRIEND_API(AutoLockGC)
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
@ -70,7 +70,6 @@ JS_LOCK_GC, JS_UNLOCK_GC
|
|||||||
|
|
||||||
js_NextActiveContext, js::TriggerOperationCallback
|
js_NextActiveContext, js::TriggerOperationCallback
|
||||||
mWatchdogWakeup = JS_NEW_CONDVAR(mJSRuntime->gcLock);
|
mWatchdogWakeup = JS_NEW_CONDVAR(mJSRuntime->gcLock);
|
||||||
mJSRuntime->setActivityCallback(ActivityCallback, this);
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
using namespace mozilla;
|
using namespace mozilla;
|
||||||
@ -2001,7 +2000,7 @@ XPCJSRuntime::XPCJSRuntime(nsXPConnect* aXPConnect)
|
|||||||
if (!mWatchdogWakeup)
|
if (!mWatchdogWakeup)
|
||||||
NS_RUNTIMEABORT("JS_NEW_CONDVAR failed.");
|
NS_RUNTIMEABORT("JS_NEW_CONDVAR failed.");
|
||||||
|
|
||||||
mJSRuntime->setActivityCallback(ActivityCallback, this);
|
js::SetActivityCallback(mJSRuntime, ActivityCallback, this);
|
||||||
|
|
||||||
NS_RegisterMemoryReporter(new NS_MEMORY_REPORTER_NAME(XPConnectJSGCHeap));
|
NS_RegisterMemoryReporter(new NS_MEMORY_REPORTER_NAME(XPConnectJSGCHeap));
|
||||||
NS_RegisterMemoryReporter(new NS_MEMORY_REPORTER_NAME(XPConnectJSSystemCompartmentCount));
|
NS_RegisterMemoryReporter(new NS_MEMORY_REPORTER_NAME(XPConnectJSSystemCompartmentCount));
|
||||||
|
Loading…
Reference in New Issue
Block a user