forked from mirrors/0ad
Style cleanup by leper, preparing the SpiderMonkey update. Refs #3708
This was SVN commit r18579.
This commit is contained in:
@@ -376,11 +376,9 @@ ScriptInterface_impl::ScriptInterface_impl(const char* nativeScopeName, const sh
|
||||
JS::RootedValue ret(m_cx);
|
||||
JS_CallFunctionName(m_cx, testingFunctionsObj, "gcPreserveCode", JS::HandleValueArray::empty(), &ret);
|
||||
|
||||
JS_DefineProperty(m_cx, m_glob, "global", globalRootedVal, JSPROP_ENUMERATE | JSPROP_READONLY
|
||||
| JSPROP_PERMANENT);
|
||||
JS_DefineProperty(m_cx, m_glob, "global", globalRootedVal, JSPROP_ENUMERATE | JSPROP_READONLY | JSPROP_PERMANENT);
|
||||
|
||||
m_nativeScope = JS_DefineObject(m_cx, m_glob, nativeScopeName, NULL, NULL, JSPROP_ENUMERATE | JSPROP_READONLY
|
||||
| JSPROP_PERMANENT);
|
||||
m_nativeScope = JS_DefineObject(m_cx, m_glob, nativeScopeName, NULL, NULL, JSPROP_ENUMERATE | JSPROP_READONLY | JSPROP_PERMANENT);
|
||||
|
||||
JS_DefineFunction(m_cx, globalRootedVal, "print", ::print, 0, JSPROP_ENUMERATE | JSPROP_READONLY | JSPROP_PERMANENT);
|
||||
JS_DefineFunction(m_cx, globalRootedVal, "log", ::logmsg, 1, JSPROP_ENUMERATE | JSPROP_READONLY | JSPROP_PERMANENT);
|
||||
@@ -651,7 +649,7 @@ bool ScriptInterface::SetProperty_(JS::HandleValue obj, const char* name, JS::Ha
|
||||
return false;
|
||||
JS::RootedObject object(m->m_cx, &obj.toObject());
|
||||
|
||||
if (! JS_DefineProperty(m->m_cx, object, name, value, attrs))
|
||||
if (!JS_DefineProperty(m->m_cx, object, name, value, attrs))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
@@ -688,7 +686,7 @@ bool ScriptInterface::SetPropertyInt_(JS::HandleValue obj, int name, JS::HandleV
|
||||
return false;
|
||||
JS::RootedObject object(m->m_cx, &obj.toObject());
|
||||
|
||||
if (! JS_DefinePropertyById(m->m_cx, object, INT_TO_JSID(name), value, NULL, NULL, attrs))
|
||||
if (!JS_DefinePropertyById(m->m_cx, object, INT_TO_JSID(name), value, NULL, NULL, attrs))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
@@ -769,7 +767,7 @@ bool ScriptInterface::EnumeratePropertyNamesWithPrefix(JS::HandleValue objVal, c
|
||||
return false;
|
||||
}
|
||||
|
||||
if(objVal.isNull())
|
||||
if (objVal.isNull())
|
||||
return true; // reached the end of the prototype chain
|
||||
|
||||
JS::RootedObject obj(m->m_cx, &objVal.toObject());
|
||||
@@ -793,7 +791,7 @@ bool ScriptInterface::EnumeratePropertyNamesWithPrefix(JS::HandleValue objVal, c
|
||||
size_t prefixLen = strlen(prefix) * sizeof(char);
|
||||
JS_EncodeStringToBuffer(m->m_cx, name, &buf[0], prefixLen);
|
||||
buf[len-1]= '\0';
|
||||
if(0 == strcmp(&buf[0], prefix))
|
||||
if (0 == strcmp(&buf[0], prefix))
|
||||
{
|
||||
size_t len;
|
||||
const char16_t* chars = JS_GetStringCharsAndLength(m->m_cx, name, &len);
|
||||
@@ -806,7 +804,7 @@ bool ScriptInterface::EnumeratePropertyNamesWithPrefix(JS::HandleValue objVal, c
|
||||
if (JS_GetPrototype(m->m_cx, obj, &prototype))
|
||||
{
|
||||
JS::RootedValue prototypeVal(m->m_cx, JS::ObjectOrNullValue(prototype));
|
||||
if (! EnumeratePropertyNamesWithPrefix(prototypeVal, prefix, out))
|
||||
if (!EnumeratePropertyNamesWithPrefix(prototypeVal, prefix, out))
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -421,8 +421,8 @@ private:
|
||||
}
|
||||
|
||||
DefPersistentRooted<JSObject*> m_Prototype;
|
||||
JSClass* m_Class;
|
||||
JSNative m_Constructor;
|
||||
JSClass* m_Class;
|
||||
JSNative m_Constructor;
|
||||
};
|
||||
void Register(const char* name, JSNative fptr, size_t nargs);
|
||||
|
||||
|
||||
@@ -227,7 +227,7 @@ void ScriptRuntime::MaybeIncrementalGC(double delay)
|
||||
|
||||
// A hack to make sure we never exceed the runtime size because we can't collect the memory
|
||||
// fast enough.
|
||||
if(gcBytes > m_RuntimeSize / 2)
|
||||
if (gcBytes > m_RuntimeSize / 2)
|
||||
{
|
||||
if (JS::IsIncrementalGCInProgress(m_rt))
|
||||
{
|
||||
|
||||
@@ -53,10 +53,10 @@ public:
|
||||
*/
|
||||
void MaybeIncrementalGC(double delay);
|
||||
void ShrinkingGC();
|
||||
|
||||
|
||||
void RegisterContext(JSContext* cx);
|
||||
void UnRegisterContext(JSContext* cx);
|
||||
|
||||
|
||||
/**
|
||||
* Registers an object to be freed/finalized by the ScriptRuntime. Freeing is
|
||||
* guaranteed to happen after the next minor GC has completed, but might also
|
||||
@@ -70,7 +70,7 @@ public:
|
||||
JSRuntime* m_rt;
|
||||
|
||||
private:
|
||||
|
||||
|
||||
void PrepareContextsForIncrementalGC();
|
||||
void GCCallbackMember();
|
||||
|
||||
@@ -80,7 +80,7 @@ private:
|
||||
std::list<JSContext*> m_Contexts;
|
||||
std::vector<std::shared_ptr<void> > m_FinalizationListObjectIdCache;
|
||||
static bool m_Initialized;
|
||||
|
||||
|
||||
int m_RuntimeSize;
|
||||
int m_HeapGrowthBytesGCTrigger;
|
||||
int m_LastGCBytes;
|
||||
|
||||
Reference in New Issue
Block a user