Fix lag on OOS with AIs

Following 9fc6c3c897, the OOS debugSerializer would try to serialize AI
objects entirely. This is extremely slow (might be an infinite loop in
some cases).
Instead, it should print the result of Serialize() in those cases.

(The original idea was that it would print more debugging information,
but in practice it seems to mostly print things that show up when
diffing but aren't actually sources of OOS, so essentially garbage).

Fixes #5917

Differential Revision: https://code.wildfiregames.com/D3361
This was SVN commit r24641.
This commit is contained in:
wraitii
2021-01-16 10:33:00 +00:00
parent 925170f600
commit e2ff38453f
2 changed files with 4 additions and 5 deletions
@@ -154,12 +154,11 @@ void CDebugSerializer::PutScriptVal(const char* name, JS::MutableHandleValue val
JS::RootedValue serialize(rq.cx);
if (m_ScriptInterface.GetProperty(value, "Serialize", &serialize) && !serialize.isNullOrUndefined())
{
// If the value has a Serialize property, pretty-parse that and return the value as a raw string.
// This gives more debug data for components in case of OOS.
// If the value has a Serialize property, pretty-parse that instead.
// (this gives more accurate OOS reports).
m_ScriptInterface.CallFunction(value, "Serialize", &serialize);
std::string serialized_source = m_ScriptInterface.ToString(&serialize, true);
std::string source = m_ScriptInterface.ToString(value, false);
m_Stream << INDENT << name << ": " << serialized_source << " (raw: " << source << ")\n";
m_Stream << INDENT << name << ": " << serialized_source << "\n";
}
else
{