loplugin:useuniqueptr in Executor

Change-Id: I3b21b4438f5762aa9960a121ba5826f47d6e9c68
Reviewed-on: https://gerrit.libreoffice.org/53603
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
This commit is contained in:
Noel Grandin
2018-04-24 15:23:22 +02:00
parent 9a2f510071
commit 6676d32077

View File

@@ -386,16 +386,16 @@ namespace drawinglayer
class Executor : public comphelper::ThreadTask class Executor : public comphelper::ThreadTask
{ {
private: private:
processor3d::ZBufferProcessor3D* mpZBufferProcessor3D; std::unique_ptr<processor3d::ZBufferProcessor3D> mpZBufferProcessor3D;
const primitive3d::Primitive3DContainer& mrChildren3D; const primitive3d::Primitive3DContainer& mrChildren3D;
public: public:
explicit Executor( explicit Executor(
std::shared_ptr<comphelper::ThreadTaskTag> const & rTag, std::shared_ptr<comphelper::ThreadTaskTag> const & rTag,
processor3d::ZBufferProcessor3D* pZBufferProcessor3D, std::unique_ptr<processor3d::ZBufferProcessor3D> pZBufferProcessor3D,
const primitive3d::Primitive3DContainer& rChildren3D) const primitive3d::Primitive3DContainer& rChildren3D)
: comphelper::ThreadTask(rTag), : comphelper::ThreadTask(rTag),
mpZBufferProcessor3D(pZBufferProcessor3D), mpZBufferProcessor3D(std::move(pZBufferProcessor3D)),
mrChildren3D(rChildren3D) mrChildren3D(rChildren3D)
{ {
} }
@@ -404,7 +404,7 @@ namespace drawinglayer
{ {
mpZBufferProcessor3D->process(mrChildren3D); mpZBufferProcessor3D->process(mrChildren3D);
mpZBufferProcessor3D->finish(); mpZBufferProcessor3D->finish();
delete mpZBufferProcessor3D; mpZBufferProcessor3D.reset();
} }
}; };
@@ -413,7 +413,7 @@ namespace drawinglayer
for(sal_Int32 a(0); a < nThreadCount; a++) for(sal_Int32 a(0); a < nThreadCount; a++)
{ {
processor3d::ZBufferProcessor3D* pNewZBufferProcessor3D = new processor3d::ZBufferProcessor3D( std::unique_ptr<processor3d::ZBufferProcessor3D> pNewZBufferProcessor3D(new processor3d::ZBufferProcessor3D(
aViewInformation3D, aViewInformation3D,
getSdrSceneAttribute(), getSdrSceneAttribute(),
getSdrLightingAttribute(), getSdrLightingAttribute(),
@@ -423,8 +423,8 @@ namespace drawinglayer
fFullViewSizeY, fFullViewSizeY,
aBZPixelRaster, aBZPixelRaster,
nLinesPerThread * a, nLinesPerThread * a,
a + 1 == nThreadCount ? aBZPixelRaster.getHeight() : nLinesPerThread * (a + 1)); a + 1 == nThreadCount ? aBZPixelRaster.getHeight() : nLinesPerThread * (a + 1)));
Executor* pExecutor = new Executor(aTag, pNewZBufferProcessor3D, getChildren3D()); Executor* pExecutor = new Executor(aTag, std::move(pNewZBufferProcessor3D), getChildren3D());
rThreadPool.pushTask(pExecutor); rThreadPool.pushTask(pExecutor);
} }