Changes ToJSVal to take JS::MutableHandleValue instead of JS::Value&.

JS::MutableHandleValue is similar to JS::HandleValue, but the whole
JS::Value it points to can be replaced.
This change is needed for support of exact stack rooting and moving GC.
Contains a few other trivial API adjustments and style improvements too.

Refs #2462
Refs #2415

This was SVN commit r15534.
This commit is contained in:
Yves
2014-07-14 19:52:35 +00:00
parent 17634d7507
commit 52f4cda439
13 changed files with 193 additions and 179 deletions
+5 -2
View File
@@ -177,6 +177,9 @@ static InReaction MainInputHandler(const SDL_Event_* ev)
// dispatch all pending events to the various receivers.
static void PumpEvents()
{
JSContext* cx = g_GUI->GetScriptInterface()->GetContext();
JSAutoRequest rq(cx);
PROFILE3("dispatch events");
SDL_Event_ ev;
@@ -185,8 +188,8 @@ static void PumpEvents()
PROFILE2("event");
if (g_GUI)
{
JS::Value tmpVal;
ScriptInterface::ToJSVal(g_GUI->GetScriptInterface()->GetContext(), tmpVal, ev);
JS::RootedValue tmpVal(cx);
ScriptInterface::ToJSVal(cx, &tmpVal, ev);
std::string data = g_GUI->GetScriptInterface()->StringifyJSON(tmpVal);
PROFILE2_ATTR("%s", data.c_str());
}