Process: Rename QtcProcessPrivate -> ProcessPrivate

Rename the logging category for Process.
Fix inline comments accordingly.
Adapt warning/debug messages accordingly.

Change-Id: I2b1f0f558701def3afa3c1b04adf629833dba9e7
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
Jarek Kobus
2023-05-09 22:49:14 +02:00
parent e206ed5236
commit c75b59f9b4
18 changed files with 57 additions and 57 deletions

View File

@@ -893,7 +893,7 @@ bool ProcessArgs::expandMacros(QString *cmd, AbstractMacroExpander *mx, OsType o
break;
case CrtClosed:
// Two consecutive quotes make a literal quote - and
// still close quoting. See QtcProcess::quoteArg().
// still close quoting. See Process::quoteArg().
crtState = CrtInWord;
break;
case CrtHadQuote:

View File

@@ -73,11 +73,11 @@ QStringList DeviceShell::missingFeatures() const { return m_missingFeatures; }
RunResult DeviceShell::run(const CommandLine &cmd, const QByteArray &stdInData)
{
// If the script failed to install, use QtcProcess directly instead.
// If the script failed to install, use Process directly instead.
bool useProcess = m_shellScriptState == State::Failed;
// Transferring large amounts of stdInData is slow via the shell script.
// Use QtcProcess directly if the size exceeds 100kb.
// Use Process directly if the size exceeds 100kb.
useProcess |= stdInData.size() > (1024 * 100);
if (useProcess) {

View File

@@ -91,7 +91,7 @@ inline bool isWindowsDriveLetter(QChar ch);
executed on the associated OS.
\note The FilePath passed as executable to a CommandLine is typically
not touched by user code. QtcProcess will use it to determine
not touched by user code. The Process will use it to determine
the remote system and apply the necessary conversions internally.
\li FilePath::toFSPathString()

View File

@@ -228,7 +228,7 @@ void CallerHandle::start(const QString &program, const QStringList &arguments)
auto startWhenRunning = [&program, &oldProgram = m_command] {
qWarning() << "Trying to start" << program << "while" << oldProgram
<< "is still running for the same QtcProcess instance."
<< "is still running for the same Process instance."
<< "The current call will be ignored.";
};
QTC_ASSERT(m_processState == QProcess::NotRunning, startWhenRunning(); return);
@@ -622,7 +622,7 @@ void LauncherSocket::handleSocketDataAvailable()
}
} else {
// qDebug() << "No handler for token" << m_packetParser.token() << m_handles;
// in this case the QtcProcess was canceled and deleted
// in this case the Process was canceled and deleted
}
handleSocketDataAvailable();
}

View File

@@ -124,7 +124,7 @@ private:
// Moved to the launcher thread, returned to caller's thread.
// It's assumed that this object will be alive at least
// as long as the corresponding QtcProcess is alive.
// as long as the corresponding Process is alive.
class LauncherHandle : public QObject
{

View File

@@ -196,7 +196,7 @@ using namespace Internal;
you would use the one provided by the variable manager). Mostly the same as
MacroExpander::expandedString(), but also has a variant that does the replacement inline
instead of returning a new string.
\li Using Utils::QtcProcess::expandMacros(). This expands the string while conforming to the
\li Using Utils::CommandLine::expandMacros(). This expands the string while conforming to the
quoting rules of the platform it is run on. Use this function with the variable manager's
macro expander if your string will be passed as a command line parameter string to an
external command.

View File

@@ -171,9 +171,9 @@ enum { syncDebug = 0 };
enum { defaultMaxHangTimerCount = 10 };
static Q_LOGGING_CATEGORY(processLog, "qtc.utils.qtcprocess", QtWarningMsg)
static Q_LOGGING_CATEGORY(processStdoutLog, "qtc.utils.qtcprocess.stdout", QtWarningMsg)
static Q_LOGGING_CATEGORY(processStderrLog, "qtc.utils.qtcprocess.stderr", QtWarningMsg)
static Q_LOGGING_CATEGORY(processLog, "qtc.utils.process", QtWarningMsg)
static Q_LOGGING_CATEGORY(processStdoutLog, "qtc.utils.process.stdout", QtWarningMsg)
static Q_LOGGING_CATEGORY(processStderrLog, "qtc.utils.process.stderr", QtWarningMsg)
static DeviceProcessHooks s_deviceHooks;
@@ -454,7 +454,7 @@ private:
void doDefaultStart(const QString &program, const QStringList &arguments) final
{
QTC_ASSERT(QThread::currentThread()->eventDispatcher(),
qWarning("QtcProcess::start(): Starting a process in a non QThread thread "
qWarning("Process::start(): Starting a process in a non QThread thread "
"may cause infinite hang when destroying the running process."));
ProcessStartHandler *handler = m_process->processStartHandler();
handler->setProcessMode(m_setup.m_processMode);
@@ -684,7 +684,7 @@ private:
class GeneralProcessBlockingImpl : public ProcessBlockingInterface
{
public:
GeneralProcessBlockingImpl(QtcProcessPrivate *parent);
GeneralProcessBlockingImpl(ProcessPrivate *parent);
void flush() { flushSignals(takeAllSignals()); }
bool flushFor(ProcessSignalType signalType) {
@@ -708,16 +708,16 @@ private:
void handleReadyReadSignal(const ReadyReadSignal *launcherSignal);
void handleDoneSignal(const DoneSignal *launcherSignal);
QtcProcessPrivate *m_caller = nullptr;
ProcessPrivate *m_caller = nullptr;
std::unique_ptr<ProcessInterfaceHandler> m_processHandler;
mutable QMutex m_mutex;
QList<ProcessInterfaceSignal *> m_signals;
};
class QtcProcessPrivate : public QObject
class ProcessPrivate : public QObject
{
public:
explicit QtcProcessPrivate(Process *parent)
explicit ProcessPrivate(Process *parent)
: QObject(parent)
, q(parent)
, m_killTimer(this)
@@ -754,11 +754,11 @@ public:
m_process.reset(process);
m_process->setParent(this);
connect(m_process.get(), &ProcessInterface::started,
this, &QtcProcessPrivate::handleStarted);
this, &ProcessPrivate::handleStarted);
connect(m_process.get(), &ProcessInterface::readyRead,
this, &QtcProcessPrivate::handleReadyRead);
this, &ProcessPrivate::handleReadyRead);
connect(m_process.get(), &ProcessInterface::done,
this, &QtcProcessPrivate::handleDone);
this, &ProcessPrivate::handleDone);
m_blockingInterface.reset(process->processBlockingInterface());
if (!m_blockingInterface)
@@ -899,7 +899,7 @@ void ProcessInterfaceHandler::appendSignal(ProcessInterfaceSignal *newSignal)
QMetaObject::invokeMethod(m_caller, &GeneralProcessBlockingImpl::flush);
}
GeneralProcessBlockingImpl::GeneralProcessBlockingImpl(QtcProcessPrivate *parent)
GeneralProcessBlockingImpl::GeneralProcessBlockingImpl(ProcessPrivate *parent)
: m_caller(parent)
, m_processHandler(new ProcessInterfaceHandler(this, parent->m_process.get()))
{
@@ -907,7 +907,7 @@ GeneralProcessBlockingImpl::GeneralProcessBlockingImpl(QtcProcessPrivate *parent
parent->m_process.get()->setParent(m_processHandler.get());
m_processHandler->setParent(this);
// So the hierarchy looks like:
// QtcProcessPrivate
// ProcessPrivate
// |
// +- GeneralProcessBlockingImpl
// |
@@ -1021,7 +1021,7 @@ void GeneralProcessBlockingImpl::appendSignal(ProcessInterfaceSignal *newSignal)
m_signals.append(newSignal);
}
bool QtcProcessPrivate::waitForSignal(ProcessSignalType newSignal, int msecs)
bool ProcessPrivate::waitForSignal(ProcessSignalType newSignal, int msecs)
{
const QDeadlineTimer timeout(msecs);
const QDeadlineTimer currentKillTimeout(m_killTimer.remainingTime());
@@ -1037,13 +1037,13 @@ bool QtcProcessPrivate::waitForSignal(ProcessSignalType newSignal, int msecs)
return result;
}
Qt::ConnectionType QtcProcessPrivate::connectionType() const
Qt::ConnectionType ProcessPrivate::connectionType() const
{
return (m_process->thread() == thread()) ? Qt::DirectConnection
: Qt::BlockingQueuedConnection;
}
void QtcProcessPrivate::sendControlSignal(ControlSignal controlSignal)
void ProcessPrivate::sendControlSignal(ControlSignal controlSignal)
{
QTC_ASSERT(QThread::currentThread() == thread(), return);
if (!m_process || (m_state == QProcess::NotRunning))
@@ -1057,7 +1057,7 @@ void QtcProcessPrivate::sendControlSignal(ControlSignal controlSignal)
}, connectionType());
}
void QtcProcessPrivate::clearForRun()
void ProcessPrivate::clearForRun()
{
m_hangTimerCount = 0;
m_stdOut.clearForRun();
@@ -1073,7 +1073,7 @@ void QtcProcessPrivate::clearForRun()
m_resultData = {};
}
ProcessResult QtcProcessPrivate::interpretExitCode(int exitCode)
ProcessResult ProcessPrivate::interpretExitCode(int exitCode)
{
if (m_exitCodeInterpreter)
return m_exitCodeInterpreter(exitCode);
@@ -1085,16 +1085,16 @@ ProcessResult QtcProcessPrivate::interpretExitCode(int exitCode)
} // Internal
/*!
\class Utils::QtcProcess
\class Utils::Process
\brief The QtcProcess class provides functionality for with processes.
\brief The Process class provides functionality for with processes.
\sa Utils::ProcessArgs
*/
Process::Process(QObject *parent)
: QObject(parent),
d(new QtcProcessPrivate(this))
d(new ProcessPrivate(this))
{
qRegisterMetaType<ProcessResultData>("ProcessResultData");
static int qProcessExitStatusMeta = qRegisterMetaType<QProcess::ExitStatus>();
@@ -1105,7 +1105,7 @@ Process::Process(QObject *parent)
Process::~Process()
{
QTC_ASSERT(!d->m_guard.isLocked(), qWarning("Deleting QtcProcess instance directly from "
QTC_ASSERT(!d->m_guard.isLocked(), qWarning("Deleting Process instance directly from "
"one of its signal handlers will lead to crash!"));
if (d->m_process)
d->m_process->disconnect();
@@ -1202,7 +1202,7 @@ void Process::start()
{
QTC_ASSERT(state() == QProcess::NotRunning, return);
QTC_ASSERT(!(d->m_process && d->m_guard.isLocked()),
qWarning("Restarting the QtcProcess directly from one of its signal handlers will "
qWarning("Restarting the Process directly from one of its signal handlers will "
"lead to crash! Consider calling close() prior to direct restart."));
d->clearForRun();
ProcessInterface *processImpl = nullptr;
@@ -1497,7 +1497,7 @@ bool Process::waitForStarted(int msecs)
return true;
if (d->m_state == QProcess::NotRunning)
return false;
return s_waitForStarted.measureAndRun(&QtcProcessPrivate::waitForSignal, d,
return s_waitForStarted.measureAndRun(&ProcessPrivate::waitForSignal, d,
ProcessSignalType::Started, msecs);
}
@@ -1726,7 +1726,7 @@ const QStringList Process::stdErrLines() const
QTCREATOR_UTILS_EXPORT QDebug operator<<(QDebug str, const Process &r)
{
QDebug nsp = str.nospace();
nsp << "QtcProcess: result="
nsp << "Process: result="
<< int(r.d->m_result) << " ex=" << r.exitCode() << '\n'
<< r.d->m_stdOut.rawData.size() << " bytes stdout, stderr=" << r.d->m_stdErr.rawData << '\n';
return str;
@@ -1856,7 +1856,7 @@ void Process::runBlocking(EventLoopMode eventLoopMode)
// Do not start the event loop in that case.
if (state() == QProcess::Starting) {
QTimer timer(this);
connect(&timer, &QTimer::timeout, d, &QtcProcessPrivate::slotTimeout);
connect(&timer, &QTimer::timeout, d, &ProcessPrivate::slotTimeout);
timer.setInterval(1000);
timer.start();
#ifdef QT_GUI_LIB
@@ -1936,7 +1936,7 @@ void Process::setTextChannelMode(Channel channel, TextChannelMode mode)
const TextChannelCallback callback = (channel == Channel::Output) ? outputCb : errorCb;
ChannelBuffer *buffer = channel == Channel::Output ? &d->m_stdOut : &d->m_stdErr;
QTC_ASSERT(buffer->m_textChannelMode == TextChannelMode::Off, qWarning()
<< "QtcProcess::setTextChannelMode(): Changing text channel mode for"
<< "Process::setTextChannelMode(): Changing text channel mode for"
<< (channel == Channel::Output ? "Output": "Error")
<< "channel while it was previously set for this channel.");
buffer->m_textChannelMode = mode;
@@ -1965,7 +1965,7 @@ TextChannelMode Process::textChannelMode(Channel channel) const
return buffer->m_textChannelMode;
}
void QtcProcessPrivate::slotTimeout()
void ProcessPrivate::slotTimeout()
{
if (!m_waitingForUser && (++m_hangTimerCount > m_maxHangTimerCount)) {
if (debug)
@@ -1986,7 +1986,7 @@ void QtcProcessPrivate::slotTimeout()
}
}
void QtcProcessPrivate::handleStarted(qint64 processId, qint64 applicationMainThreadId)
void ProcessPrivate::handleStarted(qint64 processId, qint64 applicationMainThreadId)
{
QTC_CHECK(m_state == QProcess::Starting);
m_state = QProcess::Running;
@@ -1996,7 +1996,7 @@ void QtcProcessPrivate::handleStarted(qint64 processId, qint64 applicationMainTh
emitGuardedSignal(&Process::started);
}
void QtcProcessPrivate::handleReadyRead(const QByteArray &outputData, const QByteArray &errorData)
void ProcessPrivate::handleReadyRead(const QByteArray &outputData, const QByteArray &errorData)
{
QTC_CHECK(m_state == QProcess::Running);
@@ -2025,7 +2025,7 @@ void QtcProcessPrivate::handleReadyRead(const QByteArray &outputData, const QByt
}
}
void QtcProcessPrivate::handleDone(const ProcessResultData &data)
void ProcessPrivate::handleDone(const ProcessResultData &data)
{
m_killTimer.stop();
const bool wasCanceled = m_resultData.m_canceledByUser;
@@ -2091,7 +2091,7 @@ static QString blockingMessage(const QVariant &variant)
return "blocking without event loop";
}
void QtcProcessPrivate::setupDebugLog()
void ProcessPrivate::setupDebugLog()
{
if (!processLog().isDebugEnabled())
return;
@@ -2140,7 +2140,7 @@ void QtcProcessPrivate::setupDebugLog()
});
}
void QtcProcessPrivate::storeEventLoopDebugInfo(const QVariant &value)
void ProcessPrivate::storeEventLoopDebugInfo(const QVariant &value)
{
if (processLog().isDebugEnabled())
setProperty(QTC_PROCESS_BLOCKING_TYPE, value);

View File

@@ -22,7 +22,7 @@ QT_END_NAMESPACE
namespace Utils {
namespace Internal { class QtcProcessPrivate; }
namespace Internal { class ProcessPrivate; }
namespace Pty { class Data; }
class Environment;
@@ -131,7 +131,7 @@ public:
// Other enhancements.
// These (or some of them) may be potentially moved outside of the class.
// For some we may aggregate in another public utils class (or subclass of QtcProcess)?
// Some of them could be aggregated in another public utils class.
// TODO: Unused currently? Should it serve as a compartment for contrary of remoteEnvironment?
static Environment systemEnvironmentForBinary(const FilePath &filePath);
@@ -198,8 +198,8 @@ signals:
private:
friend QTCREATOR_UTILS_EXPORT QDebug operator<<(QDebug str, const Process &r);
friend class Internal::QtcProcessPrivate;
Internal::QtcProcessPrivate *d = nullptr;
friend class Internal::ProcessPrivate;
Internal::ProcessPrivate *d = nullptr;
};
class DeviceProcessHooks

View File

@@ -14,7 +14,7 @@
namespace Utils {
namespace Internal { class QtcProcessPrivate; }
namespace Internal { class ProcessPrivate; }
namespace Pty {
@@ -104,7 +104,7 @@ private:
// - Done is being called in Starting or Running state.
virtual bool waitForSignal(ProcessSignalType signalType, int msecs) = 0;
friend class Internal::QtcProcessPrivate;
friend class Internal::ProcessPrivate;
};
class QTCREATOR_UTILS_EXPORT ProcessInterface : public QObject
@@ -143,7 +143,7 @@ private:
virtual ProcessBlockingInterface *processBlockingInterface() const { return nullptr; }
friend class Process;
friend class Internal::QtcProcessPrivate;
friend class Internal::ProcessPrivate;
};
} // namespace Utils

View File

@@ -33,7 +33,7 @@ never ending running process:
It looks like when you call terminate() for the adb.exe, it won't stop, never, even after
default 30 seconds timeout. The same happens for blocking processes tested in
tst_QtcProcess::killBlockingProcess(). It's hard to say whether any process on Windows can
tst_Process::killBlockingProcess(). It's hard to say whether any process on Windows can
be finished by a call to terminate(). Until now, no such a process has been found.
Further call to kill() (after a call to terminate()) finishes the process quickly.

View File

@@ -258,7 +258,7 @@ bool AndroidAvdManager::startAvdAsync(const QString &avdName) const
return false;
}
// TODO: Here we are potentially leaking QtcProcess instance in case when shutdown happens
// TODO: Here we are potentially leaking Process instance in case when shutdown happens
// after the avdProcess has started and before it has finished. Giving a parent object here
// should solve the issue. However, AndroidAvdManager is not a QObject, so no clue what parent
// would be the most appropriate. Preferably some object taken form android plugin...

View File

@@ -38,7 +38,7 @@ CMakeProcess::~CMakeProcess()
m_parser.flush();
}
static const int failedToStartExitCode = 0xFF; // See QtcProcessPrivate::handleDone() impl
static const int failedToStartExitCode = 0xFF; // See ProcessPrivate::handleDone() impl
void CMakeProcess::run(const BuildDirParameters &parameters, const QStringList &arguments)
{

View File

@@ -74,7 +74,7 @@ void ProcessProgressPrivate::parseProgress(const QString &inputText)
\brief The ProcessProgress class is responsible for showing progress of the running process.
It's possible to cancel the running process automatically after pressing a small 'x'
indicator on progress panel. In this case QtcProcess::stop() method is being called.
indicator on progress panel. In this case Process::stop() method is being called.
*/
ProcessProgress::ProcessProgress(Process *process)

View File

@@ -2468,7 +2468,7 @@ void GitClient::tryLaunchingGitK(const Environment &env,
arguments << "--" << fileName;
VcsOutputWindow::appendCommand(workingDirectory, {binary, arguments});
// This should always use QtcProcess::startDetached (as not to kill
// This should always use Process::startDetached (as not to kill
// the child), but that does not have an environment parameter.
if (!settings().path.value().isEmpty()) {
auto process = new Process(const_cast<GitClient*>(this));

View File

@@ -1375,7 +1375,7 @@ void SimpleTargetRunnerPrivate::start()
Encapsulates processes running in a console or as GUI processes,
captures debug output of GUI processes on Windows (outputDebugString()).
\sa Utils::QtcProcess
\sa Utils::Process
*/
SimpleTargetRunner::SimpleTargetRunner(RunControl *runControl)

View File

@@ -1198,7 +1198,7 @@ bool SquishTools::setupRunnerPath()
void SquishTools::setupAndStartSquishRunnerProcess(const Utils::CommandLine &cmdLine)
{
QTC_ASSERT(m_primaryRunner, return);
// avoid crashes on fast re-usage of QtcProcess
// avoid crashes on fast re-usage of Process
m_primaryRunner->closeProcess();
if (m_request == RunTestRequested) {

View File

@@ -9,7 +9,7 @@ namespace VcsBase {
enum class RunFlags {
None = 0, // Empty.
// QtcProcess related
// Process related
MergeOutputChannels = (1 << 0), // See QProcess::ProcessChannelMode::MergedChannels.
ForceCLocale = (1 << 1), // Force C-locale, sets LANG and LANGUAGE env vars to "C".
UseEventLoop = (1 << 2), // Use event loop when executed in UI thread with

View File

@@ -35,7 +35,7 @@ public:
static void invokeSubProcess();
// Many tests inside tst_qtcprocess need to start a new subprocess with custom code.
// Many tests inside tst_Process need to start a new subprocess with custom code.
// In order to simplify things we produce just one separate executable - processtestapp.
// We embed all our custom subprocesses in processtestapp and enclose them in separate
// classes. We select desired process to run by setting the relevant environment variable.