mirror of
https://gitea.wildfiregames.com/0ad/0ad.git
synced 2026-09-21 20:06:40 +00:00
Actually remove trailing tabs from source/.
This was SVN commit r18991.
This commit is contained in:
@@ -405,7 +405,7 @@ template<typename T> static bool FromJSVal_vector(JSContext* cx, JS::HandleValue
|
||||
obj = &v.toObject();
|
||||
if (!(JS_IsArrayObject(cx, obj) || JS_IsTypedArrayObject(obj)))
|
||||
FAIL("Argument must be an array");
|
||||
|
||||
|
||||
u32 length;
|
||||
if (!JS_GetArrayLength(cx, obj, &length))
|
||||
FAIL("Failed to get array length");
|
||||
|
||||
@@ -409,7 +409,7 @@ ScriptInterface::ScriptInterface(const char* nativeScopeName, const char* debugN
|
||||
if (g_ScriptStatsTable)
|
||||
g_ScriptStatsTable->Add(this, debugName);
|
||||
}
|
||||
|
||||
|
||||
m_CxPrivate.pScriptInterface = this;
|
||||
JS_SetContextPrivate(m->m_cx, (void*)&m_CxPrivate);
|
||||
}
|
||||
@@ -575,7 +575,7 @@ bool ScriptInterface::CallFunction_(JS::HandleValue val, const char* name, JS::H
|
||||
JS::RootedObject obj(m->m_cx);
|
||||
if (!JS_ValueToObject(m->m_cx, val, &obj) || !obj)
|
||||
return false;
|
||||
|
||||
|
||||
// Check that the named function actually exists, to avoid ugly JS error reports
|
||||
// when calling an undefined value
|
||||
bool found;
|
||||
@@ -708,7 +708,7 @@ bool ScriptInterface::GetProperty_(JS::HandleValue obj, const char* name, JS::Mu
|
||||
if (!obj.isObject())
|
||||
return false;
|
||||
JS::RootedObject object(m->m_cx, &obj.toObject());
|
||||
|
||||
|
||||
if (!JS_GetProperty(m->m_cx, object, name, out))
|
||||
return false;
|
||||
return true;
|
||||
@@ -721,7 +721,7 @@ bool ScriptInterface::GetPropertyInt_(JS::HandleValue obj, int name, JS::Mutable
|
||||
if (!obj.isObject())
|
||||
return false;
|
||||
JS::RootedObject object(m->m_cx, &obj.toObject());
|
||||
|
||||
|
||||
if (!JS_GetPropertyById(m->m_cx, object, nameId, out))
|
||||
return false;
|
||||
return true;
|
||||
@@ -744,16 +744,16 @@ bool ScriptInterface::HasProperty(JS::HandleValue obj, const char* name)
|
||||
bool ScriptInterface::EnumeratePropertyNamesWithPrefix(JS::HandleValue objVal, const char* prefix, std::vector<std::string>& out)
|
||||
{
|
||||
JSAutoRequest rq(m->m_cx);
|
||||
|
||||
|
||||
if (!objVal.isObjectOrNull())
|
||||
{
|
||||
LOGERROR("EnumeratePropertyNamesWithPrefix expected object type!");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
if (objVal.isNull())
|
||||
return true; // reached the end of the prototype chain
|
||||
|
||||
|
||||
JS::RootedObject obj(m->m_cx, &objVal.toObject());
|
||||
JS::AutoIdArray props(m->m_cx, JS_Enumerate(m->m_cx, obj));
|
||||
if (!props)
|
||||
@@ -823,7 +823,7 @@ bool ScriptInterface::FreezeObject(JS::HandleValue objVal, bool deep)
|
||||
JSAutoRequest rq(m->m_cx);
|
||||
if (!objVal.isObject())
|
||||
return false;
|
||||
|
||||
|
||||
JS::RootedObject obj(m->m_cx, &objVal.toObject());
|
||||
|
||||
if (deep)
|
||||
@@ -926,7 +926,7 @@ bool ScriptInterface::Eval_(const char* code, JS::MutableHandleValue rval)
|
||||
JSAutoRequest rq(m->m_cx);
|
||||
JS::RootedObject global(m->m_cx, m->m_glob);
|
||||
utf16string codeUtf16(code, code+strlen(code));
|
||||
|
||||
|
||||
JS::CompileOptions opts(m->m_cx);
|
||||
opts.setFileAndLine("(eval)", 1);
|
||||
return JS::Evaluate(m->m_cx, global, opts, reinterpret_cast<const char16_t*>(codeUtf16.c_str()), (uint)codeUtf16.length(), rval);
|
||||
|
||||
@@ -70,21 +70,21 @@ void GCSliceCallbackHook(JSRuntime* UNUSED(rt), JS::GCProgress progress, const J
|
||||
|
||||
const char16_t* str = desc.formatMessage(rt);
|
||||
int len = 0;
|
||||
|
||||
|
||||
for(int i = 0; i < 10000; i++)
|
||||
{
|
||||
len++;
|
||||
if(!str[i])
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
wchar_t outstring[len];
|
||||
|
||||
|
||||
for(int i = 0; i < len; i++)
|
||||
{
|
||||
outstring[i] = (wchar_t)str[i];
|
||||
}
|
||||
|
||||
|
||||
printf("---------------------------------------\n: %ls \n---------------------------------------\n", outstring);
|
||||
#endif
|
||||
}
|
||||
@@ -155,7 +155,7 @@ void ScriptRuntime::UnRegisterContext(JSContext* cx)
|
||||
void ScriptRuntime::MaybeIncrementalGC(double delay)
|
||||
{
|
||||
PROFILE2("MaybeIncrementalGC");
|
||||
|
||||
|
||||
if (JS::IsIncrementalGCEnabled(m_rt))
|
||||
{
|
||||
// The idea is to get the heap size after a completed GC and trigger the next GC when the heap size has
|
||||
@@ -165,22 +165,22 @@ void ScriptRuntime::MaybeIncrementalGC(double delay)
|
||||
// While the sweeping is happening we already run scripts again and produce new garbage.
|
||||
|
||||
const int GCSliceTimeBudget = 30; // Milliseconds an incremental slice is allowed to run
|
||||
|
||||
|
||||
// Have a minimum time in seconds to wait between GC slices and before starting a new GC to distribute the GC
|
||||
// load and to hopefully make it unnoticeable for the player. This value should be high enough to distribute
|
||||
// the load well enough and low enough to make sure we don't run out of memory before we can start with the
|
||||
// sweeping.
|
||||
if (timer_Time() - m_LastGCCheck < delay)
|
||||
return;
|
||||
|
||||
|
||||
m_LastGCCheck = timer_Time();
|
||||
|
||||
|
||||
int gcBytes = JS_GetGCParameter(m_rt, JSGC_BYTES);
|
||||
|
||||
|
||||
#if GC_DEBUG_PRINT
|
||||
std::cout << "gcBytes: " << gcBytes / 1024 << " KB" << std::endl;
|
||||
#endif
|
||||
|
||||
|
||||
if (m_LastGCBytes > gcBytes || m_LastGCBytes == 0)
|
||||
{
|
||||
#if GC_DEBUG_PRINT
|
||||
@@ -193,7 +193,7 @@ void ScriptRuntime::MaybeIncrementalGC(double delay)
|
||||
// ... or
|
||||
// start a new incremental GC if the JS heap size has grown enough for a GC to make sense
|
||||
if (JS::IsIncrementalGCInProgress(m_rt) || (gcBytes - m_LastGCBytes > m_HeapGrowthBytesGCTrigger))
|
||||
{
|
||||
{
|
||||
#if GC_DEBUG_PRINT
|
||||
if (JS::IsIncrementalGCInProgress(m_rt))
|
||||
printf("An incremental GC cycle is in progress. \n");
|
||||
@@ -204,7 +204,7 @@ void ScriptRuntime::MaybeIncrementalGC(double delay)
|
||||
m_LastGCBytes / 1024,
|
||||
m_HeapGrowthBytesGCTrigger / 1024);
|
||||
#endif
|
||||
|
||||
|
||||
// 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)
|
||||
|
||||
Reference in New Issue
Block a user