WinRt: Avoid use of global object pool

Change-Id: I875122569f4e78750993caa11b8635b68d0fc8da
Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
hjk
2018-02-02 10:48:05 +01:00
parent cbcbaaa2f3
commit 204d8d141e
2 changed files with 25 additions and 20 deletions

View File

@@ -34,38 +34,44 @@
#include "winrtruncontrol.h" #include "winrtruncontrol.h"
#include "winrtdebugsupport.h" #include "winrtdebugsupport.h"
#include <coreplugin/icore.h>
#include <extensionsystem/pluginmanager.h>
#include <projectexplorer/devicesupport/devicemanager.h> #include <projectexplorer/devicesupport/devicemanager.h>
#include <projectexplorer/devicesupport/idevice.h> #include <projectexplorer/devicesupport/idevice.h>
#include <projectexplorer/kitinformation.h> #include <projectexplorer/kitinformation.h>
#include <projectexplorer/target.h> #include <projectexplorer/target.h>
#include <QtPlugin>
#include <QSysInfo>
using namespace ProjectExplorer; using namespace ProjectExplorer;
namespace WinRt { namespace WinRt {
namespace Internal { namespace Internal {
class WinRtPluginRunData
{
public:
WinRtRunConfigurationFactory runConfigFactory;
WinRtQtVersionFactory qtVersionFactory;
WinRtAppDeployConfigurationFactory appDeployConfigFactory;
WinRtPhoneDeployConfigurationFactory phoneDeployConfigFactory;
WinRtEmulatorDeployConfigurationFactory emulatorDeployFactory;
WinRtDeployStepFactory deployStepFactory;
WinRtDeviceFactory deviceFactory;
};
WinRtPlugin::WinRtPlugin() WinRtPlugin::WinRtPlugin()
{ {
setObjectName(QLatin1String("WinRtPlugin")); setObjectName(QLatin1String("WinRtPlugin"));
} }
WinRtPlugin::~WinRtPlugin()
{
delete m_runData;
}
bool WinRtPlugin::initialize(const QStringList &arguments, QString *errorMessage) bool WinRtPlugin::initialize(const QStringList &arguments, QString *errorMessage)
{ {
Q_UNUSED(arguments) Q_UNUSED(arguments)
Q_UNUSED(errorMessage) Q_UNUSED(errorMessage)
addAutoReleasedObject(new Internal::WinRtRunConfigurationFactory); m_runData = new WinRtPluginRunData;
addAutoReleasedObject(new Internal::WinRtQtVersionFactory);
addAutoReleasedObject(new Internal::WinRtAppDeployConfigurationFactory);
addAutoReleasedObject(new Internal::WinRtPhoneDeployConfigurationFactory);
addAutoReleasedObject(new Internal::WinRtEmulatorDeployConfigurationFactory);
addAutoReleasedObject(new Internal::WinRtDeployStepFactory);
auto runConstraint = [](RunConfiguration *runConfig) { auto runConstraint = [](RunConfiguration *runConfig) {
IDevice::ConstPtr device = DeviceKitInformation::device(runConfig->target()->kit()); IDevice::ConstPtr device = DeviceKitInformation::device(runConfig->target()->kit());
@@ -91,10 +97,5 @@ bool WinRtPlugin::initialize(const QStringList &arguments, QString *errorMessage
return true; return true;
} }
void WinRtPlugin::extensionsInitialized()
{
addAutoReleasedObject(new Internal::WinRtDeviceFactory);
}
} // namespace Internal } // namespace Internal
} // namespace WinRt } // namespace WinRt

View File

@@ -30,7 +30,7 @@
namespace WinRt { namespace WinRt {
namespace Internal { namespace Internal {
class WinRtDeviceFactory; class WinRtPluginRunData;
class WinRtPlugin : public ExtensionSystem::IPlugin class WinRtPlugin : public ExtensionSystem::IPlugin
{ {
@@ -39,9 +39,13 @@ class WinRtPlugin : public ExtensionSystem::IPlugin
public: public:
WinRtPlugin(); WinRtPlugin();
~WinRtPlugin() final;
bool initialize(const QStringList &arguments, QString *errorMessage); private:
void extensionsInitialized(); bool initialize(const QStringList &arguments, QString *errorMessage) final;
void extensionsInitialized() final {}
WinRtPluginRunData *m_runData = nullptr;
}; };
} // namespace Internal } // namespace Internal