mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-09-04 11:45:18 +02:00
Debugger: Poll frequently after stepping.
This will make us listen for events slightly less often, so we don't want to sustain it.
This commit is contained in:
@@ -129,6 +129,8 @@ void HandleDebuggerRequest(const http::Request &request) {
|
||||
subscriberData.push_back(info.init(eventHandlers));
|
||||
}
|
||||
|
||||
// There's a tradeoff between responsiveness to incoming events, and polling for changes.
|
||||
int highActivity = 0;
|
||||
ws->SetTextHandler([&](const std::string &t) {
|
||||
JsonReader reader(t.c_str(), t.size());
|
||||
if (!reader.ok()) {
|
||||
@@ -148,7 +150,10 @@ void HandleDebuggerRequest(const http::Request &request) {
|
||||
if (eventFunc != eventHandlers.end()) {
|
||||
std::lock_guard<std::mutex> guard(lifecycleLock);
|
||||
eventFunc->second(req);
|
||||
req.Finish();
|
||||
if (!req.Finish()) {
|
||||
// Poll more frequently for a second in case this triggers something.
|
||||
highActivity = 1000;
|
||||
}
|
||||
} else {
|
||||
req.Fail("Bad message: unknown event");
|
||||
}
|
||||
@@ -157,7 +162,7 @@ void HandleDebuggerRequest(const http::Request &request) {
|
||||
ws->Send(DebuggerErrorEvent("Bad message", LogTypes::LERROR));
|
||||
});
|
||||
|
||||
while (ws->Process(1.0f / 60.0f)) {
|
||||
while (ws->Process(highActivity ? 1.0f / 1000.0f : 1.0f / 60.0f)) {
|
||||
std::lock_guard<std::mutex> guard(lifecycleLock);
|
||||
// These send events that aren't just responses to requests.
|
||||
logger.Broadcast(ws);
|
||||
@@ -167,6 +172,9 @@ void HandleDebuggerRequest(const http::Request &request) {
|
||||
if (stopRequested) {
|
||||
ws->Close(net::WebSocketClose::GOING_AWAY);
|
||||
}
|
||||
if (highActivity > 0) {
|
||||
highActivity--;
|
||||
}
|
||||
}
|
||||
|
||||
std::lock_guard<std::mutex> guard(lifecycleLock);
|
||||
|
||||
Reference in New Issue
Block a user