From 34ddfc7ecc2b0450b3d501e65cb4203ac747ed42 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20Mr=C3=A1zek?= Date: Mon, 11 May 2015 22:21:37 +0200 Subject: GH-1053 base process and launch refactor, part 1 --- logic/tools/BaseExternalTool.cpp | 10 ---------- logic/tools/BaseExternalTool.h | 1 - logic/tools/BaseProfiler.cpp | 2 +- logic/tools/BaseProfiler.h | 6 +++--- logic/tools/JProfiler.cpp | 8 ++++---- logic/tools/JVisualVM.cpp | 8 ++++---- 6 files changed, 12 insertions(+), 23 deletions(-) (limited to 'logic/tools') diff --git a/logic/tools/BaseExternalTool.cpp b/logic/tools/BaseExternalTool.cpp index d2931db7..af7f9a3f 100644 --- a/logic/tools/BaseExternalTool.cpp +++ b/logic/tools/BaseExternalTool.cpp @@ -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) { diff --git a/logic/tools/BaseExternalTool.h b/logic/tools/BaseExternalTool.h index 3c0b23ed..be23036d 100644 --- a/logic/tools/BaseExternalTool.h +++ b/logic/tools/BaseExternalTool.h @@ -17,7 +17,6 @@ public: protected: InstancePtr m_instance; SettingsObjectPtr globalSettings; - qint64 pid(QProcess *process); }; class BaseDetachedTool : public BaseExternalTool diff --git a/logic/tools/BaseProfiler.cpp b/logic/tools/BaseProfiler.cpp index 2c9fed9b..cfac47d4 100644 --- a/logic/tools/BaseProfiler.cpp +++ b/logic/tools/BaseProfiler.cpp @@ -7,7 +7,7 @@ BaseProfiler::BaseProfiler(SettingsObjectPtr settings, InstancePtr instance, QOb { } -void BaseProfiler::beginProfiling(BaseProcess *process) +void BaseProfiler::beginProfiling(BaseLauncher *process) { beginProfilingImpl(process); } diff --git a/logic/tools/BaseProfiler.h b/logic/tools/BaseProfiler.h index 56397489..54ba89ce 100644 --- a/logic/tools/BaseProfiler.h +++ b/logic/tools/BaseProfiler.h @@ -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: diff --git a/logic/tools/JProfiler.cpp b/logic/tools/JProfiler.cpp index 2522f2b3..73121239 100644 --- a/logic/tools/JProfiler.cpp +++ b/logic/tools/JProfiler.cpp @@ -4,7 +4,7 @@ #include #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) }; diff --git a/logic/tools/JVisualVM.cpp b/logic/tools/JVisualVM.cpp index e148e7dc..fbfd858a 100644 --- a/logic/tools/JVisualVM.cpp +++ b/logic/tools/JVisualVM.cpp @@ -4,7 +4,7 @@ #include #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(); -- cgit v1.2.3