mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-07-08 08:40:55 +00:00
Batch up output callbacks, instead of calling for every write
* If it's called every write then it risks spamming the system with signals and locking the UI thread with constant writes. Checking and flushing output every 100ms is sufficient.
This commit is contained in:
@@ -24,6 +24,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <QMutex>
|
||||
#include <QObject>
|
||||
#include <QString>
|
||||
#include <QWidget>
|
||||
@@ -44,7 +45,8 @@ private:
|
||||
// don't allow destruction from outside, you must heap-allocate the context and let it delete
|
||||
// itself when all references are done. This handles the case where e.g. some Async work is going
|
||||
// on and needs to finish executing after the external code is done with the context
|
||||
~PythonContext() {}
|
||||
~PythonContext();
|
||||
|
||||
public:
|
||||
explicit PythonContext(QObject *parent = NULL);
|
||||
void Finish();
|
||||
@@ -121,6 +123,13 @@ private:
|
||||
|
||||
static PyObject *QtObjectToPython(const char *typeName, QObject *object);
|
||||
|
||||
QTimer *outputTicker;
|
||||
QMutex outputMutex;
|
||||
QString outstr, errstr;
|
||||
|
||||
void outputTick();
|
||||
void addText(bool isStdError, const QString &output);
|
||||
|
||||
// Python callbacks
|
||||
static void outstream_del(PyObject *self);
|
||||
static PyObject *outstream_write(PyObject *self, PyObject *args);
|
||||
|
||||
Reference in New Issue
Block a user