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:
@@ -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;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
Referência em uma Nova Issue
Bloquear um usuário