Changeset View
Changeset View
Standalone View
Standalone View
ps/trunk/source/network/NetClient.h
Show First 20 Lines • Show All 150 Lines • ▼ Show 20 Lines | public: | ||||
/** | /** | ||||
* Add a message to the queue, to be read by GuiPoll. | * Add a message to the queue, to be read by GuiPoll. | ||||
* The script value must be in the GetScriptInterface() JS context. | * The script value must be in the GetScriptInterface() JS context. | ||||
*/ | */ | ||||
template<typename... Args> | template<typename... Args> | ||||
void PushGuiMessage(Args const&... args) | void PushGuiMessage(Args const&... args) | ||||
{ | { | ||||
JSContext* cx = GetScriptInterface().GetContext(); | ScriptInterface::Request rq(GetScriptInterface()); | ||||
JSAutoRequest rq(cx); | |||||
JS::RootedValue message(cx); | JS::RootedValue message(rq.cx); | ||||
ScriptInterface::CreateObject(cx, &message, args...); | ScriptInterface::CreateObject(rq, &message, args...); | ||||
m_GuiMessageQueue.push_back(JS::Heap<JS::Value>(message)); | m_GuiMessageQueue.push_back(JS::Heap<JS::Value>(message)); | ||||
} | } | ||||
/** | /** | ||||
* Return a concatenation of all messages in the GUI queue, | * Return a concatenation of all messages in the GUI queue, | ||||
* for test cases to easily verify the queue contents. | * for test cases to easily verify the queue contents. | ||||
*/ | */ | ||||
std::string TestReadGuiMessages(); | std::string TestReadGuiMessages(); | ||||
▲ Show 20 Lines • Show All 141 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator