Cache the contents of systemlib.php for use by the debugger, if debugging.

Instead of calling get_systemlib every time the debugger client needs to list source from systemlib.php, use a cached copy of the source string. Only do this if debugging is enabled.
Esse commit está contido em:
Herman Venter
2013-06-13 14:20:45 -07:00
commit de Sara Golemon
commit af0f28532a
4 arquivos alterados com 6 adições e 2 exclusões
+3 -1
Ver Arquivo
@@ -1199,7 +1199,9 @@ string get_systemlib(string* hhas) {
ifs.seekg(desc.m_start, std::ios::beg);
std::unique_ptr<char[]> data(new char[desc.m_len]);
ifs.read(data.get(), desc.m_len);
return systemlib_split(string(data.get(), desc.m_len), hhas);
string ret = systemlib_split(string(data.get(), desc.m_len), hhas);
if (RuntimeOption::EnableDebugger) SystemLib::s_source = ret;
return ret;
}
///////////////////////////////////////////////////////////////////////////////
+1 -1
Ver Arquivo
@@ -350,7 +350,7 @@ bool CmdList::onServer(DebuggerProxy &proxy) {
}
RuntimeOption::WarningFrequency = savedWarningFrequency;
if (!m_code && m_file == "systemlib.php") {
m_code = get_systemlib();
m_code = SystemLib::s_source;
}
return proxy.sendToClient((DebuggerCommand*)this);
}
+1
Ver Arquivo
@@ -33,6 +33,7 @@ namespace HPHP {
}
bool SystemLib::s_inited = false;
string SystemLib::s_source = "";
HPHP::Unit* SystemLib::s_unit = nullptr;
HPHP::Unit* SystemLib::s_hhas_unit = nullptr;
HPHP::Unit* SystemLib::s_nativeFuncUnit = nullptr;
+1
Ver Arquivo
@@ -68,6 +68,7 @@ namespace Eval {
class SystemLib {
public:
static bool s_inited;
static string s_source;
static HPHP::Unit* s_unit;
static HPHP::Unit* s_hhas_unit;
static HPHP::Unit* s_nativeFuncUnit;