Commit 514df7f7 by Jamie Madill

Remove uses of std::unique_ptr in perftests.

This is disallowed in Chromium because it isn't currently portable. We can put it back later if the rules change. BUG=angleproject:956 Change-Id: I5be28590f494719b8cc995739dde26726283fced Reviewed-on: https://chromium-review.googlesource.com/262777Tested-by: 's avatarJamie Madill <jmadill@chromium.org> Reviewed-by: 's avatarBrandon Jones <bajones@chromium.org>
parent 2d1eea09
...@@ -15,9 +15,15 @@ ANGLEPerfTest::ANGLEPerfTest(const std::string &name, const std::string &suffix) ...@@ -15,9 +15,15 @@ ANGLEPerfTest::ANGLEPerfTest(const std::string &name, const std::string &suffix)
: mName(name), : mName(name),
mSuffix(suffix), mSuffix(suffix),
mRunning(false), mRunning(false),
mTimer(nullptr),
mNumFrames(0) mNumFrames(0)
{ {
mTimer.reset(CreateTimer()); mTimer = CreateTimer();
}
ANGLEPerfTest::~ANGLEPerfTest()
{
SafeDelete(mTimer);
} }
void ANGLEPerfTest::run() void ANGLEPerfTest::run()
...@@ -81,8 +87,16 @@ ANGLERenderTest::ANGLERenderTest(const std::string &name, const RenderTestParams ...@@ -81,8 +87,16 @@ ANGLERenderTest::ANGLERenderTest(const std::string &name, const RenderTestParams
: ANGLEPerfTest(name, testParams.suffix()), : ANGLEPerfTest(name, testParams.suffix()),
mTestParams(testParams), mTestParams(testParams),
mDrawIterations(10), mDrawIterations(10),
mRunTimeSeconds(5.0) mRunTimeSeconds(5.0),
mEGLWindow(nullptr),
mOSWindow(nullptr)
{
}
ANGLERenderTest::~ANGLERenderTest()
{ {
SafeDelete(mOSWindow);
SafeDelete(mEGLWindow);
} }
void ANGLERenderTest::SetUp() void ANGLERenderTest::SetUp()
...@@ -92,11 +106,11 @@ void ANGLERenderTest::SetUp() ...@@ -92,11 +106,11 @@ void ANGLERenderTest::SetUp()
EGL_DONT_CARE, EGL_DONT_CARE,
mTestParams.deviceType); mTestParams.deviceType);
mOSWindow.reset(CreateOSWindow()); mOSWindow = CreateOSWindow();
mEGLWindow.reset(new EGLWindow(mTestParams.widowWidth, mEGLWindow = new EGLWindow(mTestParams.widowWidth,
mTestParams.windowHeight, mTestParams.windowHeight,
mTestParams.glesMajorVersion, mTestParams.glesMajorVersion,
platformParams)); platformParams);
mEGLWindow->setSwapInterval(0); mEGLWindow->setSwapInterval(0);
if (!mOSWindow->initialize(mName, mEGLWindow->getWidth(), mEGLWindow->getHeight())) if (!mOSWindow->initialize(mName, mEGLWindow->getWidth(), mEGLWindow->getHeight()))
...@@ -105,7 +119,7 @@ void ANGLERenderTest::SetUp() ...@@ -105,7 +119,7 @@ void ANGLERenderTest::SetUp()
return; return;
} }
if (!mEGLWindow->initializeGL(mOSWindow.get())) if (!mEGLWindow->initializeGL(mOSWindow))
{ {
FAIL() << "Failed initializing EGLWindow"; FAIL() << "Failed initializing EGLWindow";
return; return;
...@@ -180,5 +194,5 @@ bool ANGLERenderTest::popEvent(Event *event) ...@@ -180,5 +194,5 @@ bool ANGLERenderTest::popEvent(Event *event)
OSWindow *ANGLERenderTest::getWindow() OSWindow *ANGLERenderTest::getWindow()
{ {
return mOSWindow.get(); return mOSWindow;
} }
...@@ -11,11 +11,10 @@ ...@@ -11,11 +11,10 @@
#define PERF_TESTS_ANGLE_PERF_TEST_H_ #define PERF_TESTS_ANGLE_PERF_TEST_H_
#include <gtest/gtest.h> #include <gtest/gtest.h>
#include <memory> #include <string>
#include <vector> #include <vector>
#include <EGL/egl.h> #include <EGL/egl.h>
#include <EGL/eglext.h> #include <EGL/eglext.h>
#include <string>
#include "EGLWindow.h" #include "EGLWindow.h"
#include "OSWindow.h" #include "OSWindow.h"
...@@ -28,7 +27,7 @@ class ANGLEPerfTest : public testing::Test, angle::NonCopyable ...@@ -28,7 +27,7 @@ class ANGLEPerfTest : public testing::Test, angle::NonCopyable
{ {
public: public:
ANGLEPerfTest(const std::string &name, const std::string &suffix); ANGLEPerfTest(const std::string &name, const std::string &suffix);
virtual ~ANGLEPerfTest() { }; virtual ~ANGLEPerfTest();
virtual void step(float dt, double totalTime) = 0; virtual void step(float dt, double totalTime) = 0;
...@@ -43,7 +42,7 @@ class ANGLEPerfTest : public testing::Test, angle::NonCopyable ...@@ -43,7 +42,7 @@ class ANGLEPerfTest : public testing::Test, angle::NonCopyable
std::string mSuffix; std::string mSuffix;
bool mRunning; bool mRunning;
std::unique_ptr<Timer> mTimer; Timer *mTimer;
int mNumFrames; int mNumFrames;
}; };
...@@ -62,6 +61,7 @@ class ANGLERenderTest : public ANGLEPerfTest ...@@ -62,6 +61,7 @@ class ANGLERenderTest : public ANGLEPerfTest
{ {
public: public:
ANGLERenderTest(const std::string &name, const RenderTestParams &testParams); ANGLERenderTest(const std::string &name, const RenderTestParams &testParams);
~ANGLERenderTest();
virtual bool initializeBenchmark() { return true; } virtual bool initializeBenchmark() { return true; }
virtual void destroyBenchmark() { } virtual void destroyBenchmark() { }
...@@ -88,8 +88,8 @@ class ANGLERenderTest : public ANGLEPerfTest ...@@ -88,8 +88,8 @@ class ANGLERenderTest : public ANGLEPerfTest
void step(float dt, double totalTime) override; void step(float dt, double totalTime) override;
void draw(); void draw();
std::unique_ptr<EGLWindow> mEGLWindow; EGLWindow *mEGLWindow;
std::unique_ptr<OSWindow> mOSWindow; OSWindow *mOSWindow;
}; };
#endif // PERF_TESTS_ANGLE_PERF_TEST_H_ #endif // PERF_TESTS_ANGLE_PERF_TEST_H_
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment