summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorSebastian Holtermann <sebholt@xwmw.org>2019-04-06 10:39:33 (GMT)
committerSebastian Holtermann <sebholt@xwmw.org>2019-04-06 15:37:12 (GMT)
commit9710d4aacf801d3dc7ab243bc2c8e051a65871a6 (patch)
treedbead373bfa976cdebdbaec546559ca10b190a7e /Source
parent95e72c0157ecd9c603fc541fa7e9fa246b777969 (diff)
downloadCMake-9710d4aacf801d3dc7ab243bc2c8e051a65871a6.zip
CMake-9710d4aacf801d3dc7ab243bc2c8e051a65871a6.tar.gz
CMake-9710d4aacf801d3dc7ab243bc2c8e051a65871a6.tar.bz2
Autogen: Move libuv loop from cmQtAutoGenerator to cmQtAutoGeneratorMocUic
`cmQtAutoGenerator` automatically started a libuv loop in the constructor. The loop is needed in `cmQtAutoGeneratorMocUic`, but not in `cmQtAutoGeneratorRcc` (anymore). To avoid starting the loop in `cmQtAutoGeneratorRcc`, this patch moves the loop variables and startup code from `cmQtAutoGenerator` to `cmQtAutoGeneratorMocUic`.
Diffstat (limited to 'Source')
-rw-r--r--Source/cmQtAutoGenerator.cxx17
-rw-r--r--Source/cmQtAutoGenerator.h10
-rw-r--r--Source/cmQtAutoGeneratorMocUic.cxx14
-rw-r--r--Source/cmQtAutoGeneratorMocUic.h11
4 files changed, 25 insertions, 27 deletions
diff --git a/Source/cmQtAutoGenerator.cxx b/Source/cmQtAutoGenerator.cxx
index 83a00cf..f115016 100644
--- a/Source/cmQtAutoGenerator.cxx
+++ b/Source/cmQtAutoGenerator.cxx
@@ -657,22 +657,9 @@ void cmQtAutoGenerator::ReadOnlyProcessT::UVTryFinish()
}
}
-cmQtAutoGenerator::cmQtAutoGenerator()
-{
- // Initialize libuv loop
- uv_disable_stdio_inheritance();
-#ifdef CMAKE_UV_SIGNAL_HACK
- UVHackRAII_ = cm::make_unique<cmUVSignalHackRAII>();
-#endif
- UVLoop_ = cm::make_unique<uv_loop_t>();
- uv_loop_init(UVLoop());
-}
+cmQtAutoGenerator::cmQtAutoGenerator() = default;
-cmQtAutoGenerator::~cmQtAutoGenerator()
-{
- // Close libuv loop
- uv_loop_close(UVLoop());
-}
+cmQtAutoGenerator::~cmQtAutoGenerator() = default;
bool cmQtAutoGenerator::Run(std::string const& infoFile,
std::string const& config)
diff --git a/Source/cmQtAutoGenerator.h b/Source/cmQtAutoGenerator.h
index 862b18d..479d357 100644
--- a/Source/cmQtAutoGenerator.h
+++ b/Source/cmQtAutoGenerator.h
@@ -8,7 +8,6 @@
#include "cmFilePathChecksum.h"
#include "cmQtAutoGen.h"
#include "cmUVHandlePtr.h"
-#include "cmUVSignalHackRAII.h" // IWYU pragma: keep
#include "cm_uv.h"
#include <array>
@@ -249,9 +248,6 @@ public:
std::string const& InfoFile() const { return InfoFile_; }
std::string const& InfoDir() const { return InfoDir_; }
std::string const& InfoConfig() const { return InfoConfig_; }
- // libuv loop
- uv_loop_t* UVLoop() { return UVLoop_.get(); }
- cm::uv_async_ptr& UVRequest() { return UVRequest_; }
// -- Utility
static std::string SettingsFind(std::string const& content, const char* key);
@@ -266,12 +262,6 @@ private:
std::string InfoFile_;
std::string InfoDir_;
std::string InfoConfig_;
-// -- libuv loop
-#ifdef CMAKE_UV_SIGNAL_HACK
- std::unique_ptr<cmUVSignalHackRAII> UVHackRAII_;
-#endif
- std::unique_ptr<uv_loop_t> UVLoop_;
- cm::uv_async_ptr UVRequest_;
};
#endif
diff --git a/Source/cmQtAutoGeneratorMocUic.cxx b/Source/cmQtAutoGeneratorMocUic.cxx
index 32e5067..ec1a1aa 100644
--- a/Source/cmQtAutoGeneratorMocUic.cxx
+++ b/Source/cmQtAutoGeneratorMocUic.cxx
@@ -1148,11 +1148,23 @@ cmQtAutoGeneratorMocUic::cmQtAutoGeneratorMocUic()
Uic_.RegExpInclude.compile("(^|\n)[ \t]*#[ \t]*include[ \t]+"
"[\"<](([^ \">]+/)?ui_[^ \">/]+\\.h)[\">]");
+ // Initialize libuv loop
+ uv_disable_stdio_inheritance();
+#ifdef CMAKE_UV_SIGNAL_HACK
+ UVHackRAII_ = cm::make_unique<cmUVSignalHackRAII>();
+#endif
+ UVLoop_ = cm::make_unique<uv_loop_t>();
+ uv_loop_init(UVLoop());
+
// Initialize libuv asynchronous iteration request
UVRequest().init(*UVLoop(), &cmQtAutoGeneratorMocUic::UVPollStage, this);
}
-cmQtAutoGeneratorMocUic::~cmQtAutoGeneratorMocUic() = default;
+cmQtAutoGeneratorMocUic::~cmQtAutoGeneratorMocUic()
+{
+ // Close libuv loop
+ uv_loop_close(UVLoop());
+}
bool cmQtAutoGeneratorMocUic::Init(cmMakefile* makefile)
{
diff --git a/Source/cmQtAutoGeneratorMocUic.h b/Source/cmQtAutoGeneratorMocUic.h
index cc785a7..27d73a7 100644
--- a/Source/cmQtAutoGeneratorMocUic.h
+++ b/Source/cmQtAutoGeneratorMocUic.h
@@ -8,6 +8,7 @@
#include "cmQtAutoGen.h"
#include "cmQtAutoGenerator.h"
#include "cmUVHandlePtr.h"
+#include "cmUVSignalHackRAII.h" // IWYU pragma: keep
#include "cm_uv.h"
#include "cmsys/RegularExpression.hxx"
@@ -390,6 +391,9 @@ private:
// -- Utility accessors
Logger& Log() { return Logger_; }
FileSystem& FileSys() { return FileSys_; }
+ // -- libuv loop accessors
+ uv_loop_t* UVLoop() { return UVLoop_.get(); }
+ cm::uv_async_ptr& UVRequest() { return UVRequest_; }
// -- Abstract processing interface
bool Init(cmMakefile* makefile) override;
bool Process() override;
@@ -417,7 +421,12 @@ private:
BaseSettingsT Base_;
MocSettingsT Moc_;
UicSettingsT Uic_;
- // -- Progress
+ // -- libuv loop
+#ifdef CMAKE_UV_SIGNAL_HACK
+ std::unique_ptr<cmUVSignalHackRAII> UVHackRAII_;
+#endif
+ std::unique_ptr<uv_loop_t> UVLoop_;
+ cm::uv_async_ptr UVRequest_;
StageT Stage_ = StageT::SETTINGS_READ;
// -- Job queues
std::mutex JobsMutex_;