GH-1053 base process and launch refactor, part 1
This commit is contained in:
@ -19,16 +19,6 @@ BaseExternalTool::~BaseExternalTool()
|
||||
{
|
||||
}
|
||||
|
||||
qint64 BaseExternalTool::pid(QProcess *process)
|
||||
{
|
||||
#ifdef Q_OS_WIN
|
||||
struct _PROCESS_INFORMATION *procinfo = process->pid();
|
||||
return procinfo->dwProcessId;
|
||||
#else
|
||||
return process->pid();
|
||||
#endif
|
||||
}
|
||||
|
||||
BaseDetachedTool::BaseDetachedTool(SettingsObjectPtr settings, InstancePtr instance, QObject *parent)
|
||||
: BaseExternalTool(settings, instance, parent)
|
||||
{
|
||||
|
@ -17,7 +17,6 @@ public:
|
||||
protected:
|
||||
InstancePtr m_instance;
|
||||
SettingsObjectPtr globalSettings;
|
||||
qint64 pid(QProcess *process);
|
||||
};
|
||||
|
||||
class BaseDetachedTool : public BaseExternalTool
|
||||
|
@ -7,7 +7,7 @@ BaseProfiler::BaseProfiler(SettingsObjectPtr settings, InstancePtr instance, QOb
|
||||
{
|
||||
}
|
||||
|
||||
void BaseProfiler::beginProfiling(BaseProcess *process)
|
||||
void BaseProfiler::beginProfiling(BaseLauncher *process)
|
||||
{
|
||||
beginProfilingImpl(process);
|
||||
}
|
||||
|
@ -4,7 +4,7 @@
|
||||
|
||||
class BaseInstance;
|
||||
class SettingsObject;
|
||||
class BaseProcess;
|
||||
class BaseLauncher;
|
||||
class QProcess;
|
||||
|
||||
class BaseProfiler : public BaseExternalTool
|
||||
@ -15,13 +15,13 @@ public:
|
||||
|
||||
public
|
||||
slots:
|
||||
void beginProfiling(BaseProcess *process);
|
||||
void beginProfiling(BaseLauncher *process);
|
||||
void abortProfiling();
|
||||
|
||||
protected:
|
||||
QProcess *m_profilerProcess;
|
||||
|
||||
virtual void beginProfilingImpl(BaseProcess *process) = 0;
|
||||
virtual void beginProfilingImpl(BaseLauncher *process) = 0;
|
||||
virtual void abortProfilingImpl();
|
||||
|
||||
signals:
|
||||
|
@ -4,7 +4,7 @@
|
||||
#include <QMessageBox>
|
||||
|
||||
#include "settings/SettingsObject.h"
|
||||
#include "BaseProcess.h"
|
||||
#include "BaseLauncher.h"
|
||||
#include "BaseInstance.h"
|
||||
|
||||
class JProfiler : public BaseProfiler
|
||||
@ -18,7 +18,7 @@ private slots:
|
||||
void profilerFinished(int exit, QProcess::ExitStatus status);
|
||||
|
||||
protected:
|
||||
void beginProfilingImpl(BaseProcess *process);
|
||||
void beginProfilingImpl(BaseLauncher *process);
|
||||
|
||||
private:
|
||||
int listeningPort = 0;
|
||||
@ -48,13 +48,13 @@ void JProfiler::profilerFinished(int exit, QProcess::ExitStatus status)
|
||||
}
|
||||
}
|
||||
|
||||
void JProfiler::beginProfilingImpl(BaseProcess *process)
|
||||
void JProfiler::beginProfilingImpl(BaseLauncher *process)
|
||||
{
|
||||
listeningPort = globalSettings->get("JProfilerPort").toInt();
|
||||
QProcess *profiler = new QProcess(this);
|
||||
QStringList profilerArgs =
|
||||
{
|
||||
"-d", QString::number(pid(process)),
|
||||
"-d", QString::number(process->pid()),
|
||||
"--gui",
|
||||
"-p", QString::number(listeningPort)
|
||||
};
|
||||
|
@ -4,7 +4,7 @@
|
||||
#include <QStandardPaths>
|
||||
|
||||
#include "settings/SettingsObject.h"
|
||||
#include "BaseProcess.h"
|
||||
#include "BaseLauncher.h"
|
||||
#include "BaseInstance.h"
|
||||
|
||||
class JVisualVM : public BaseProfiler
|
||||
@ -18,7 +18,7 @@ private slots:
|
||||
void profilerFinished(int exit, QProcess::ExitStatus status);
|
||||
|
||||
protected:
|
||||
void beginProfilingImpl(BaseProcess *process);
|
||||
void beginProfilingImpl(BaseLauncher *process);
|
||||
};
|
||||
|
||||
|
||||
@ -45,12 +45,12 @@ void JVisualVM::profilerFinished(int exit, QProcess::ExitStatus status)
|
||||
}
|
||||
}
|
||||
|
||||
void JVisualVM::beginProfilingImpl(BaseProcess *process)
|
||||
void JVisualVM::beginProfilingImpl(BaseLauncher *process)
|
||||
{
|
||||
QProcess *profiler = new QProcess(this);
|
||||
QStringList profilerArgs =
|
||||
{
|
||||
"--openpid", QString::number(pid(process))
|
||||
"--openpid", QString::number(process->pid())
|
||||
};
|
||||
auto programPath = globalSettings->get("JVisualVMPath").toString();
|
||||
|
||||
|
Reference in New Issue
Block a user