...and make the constructor private so that only Shared
instances can be created.

Signed-off-by: U. Artie Eoff <ullysses.a.e...@intel.com>
---
 test/i965_jpeg_encode_test.cpp | 2 +-
 test/i965_jpeg_test_data.cpp   | 8 +++++++-
 test/i965_jpeg_test_data.h     | 6 +++++-
 3 files changed, 13 insertions(+), 3 deletions(-)

diff --git a/test/i965_jpeg_encode_test.cpp b/test/i965_jpeg_encode_test.cpp
index c794bf935ebf..25302888b81f 100644
--- a/test/i965_jpeg_encode_test.cpp
+++ b/test/i965_jpeg_encode_test.cpp
@@ -85,7 +85,7 @@ TEST_F(JPEGEncodeTest, Entrypoint)
 const TestInput::Shared NV12toI420(const TestInput::SharedConst& nv12)
 {
     TestInput::Shared i420(
-        new TestInput(VA_FOURCC_I420, nv12->width(), nv12->height()));
+        TestInput::create(VA_FOURCC_I420, nv12->width(), nv12->height()));
 
     i420->bytes = nv12->bytes;
 
diff --git a/test/i965_jpeg_test_data.cpp b/test/i965_jpeg_test_data.cpp
index 0c1f0d3eebed..0cf3d23f1a55 100644
--- a/test/i965_jpeg_test_data.cpp
+++ b/test/i965_jpeg_test_data.cpp
@@ -773,6 +773,12 @@ namespace Decode {
 namespace JPEG {
 namespace Encode {
 
+    TestInput::Shared TestInput::create(
+        const unsigned fourcc, const unsigned w, const unsigned h)
+    {
+        return Shared(new TestInput(fourcc, w, h));
+    }
+
     TestInput::TestInput(
         const unsigned fourcc, const unsigned w, const unsigned h)
         : bytes() // caller must fill this in after instantiation
@@ -858,7 +864,7 @@ namespace Encode {
     {
         const std::array<unsigned, 2> res = getResolution();
 
-        TestInput::Shared input(new TestInput(fourcc, res[0], res[1]));
+        TestInput::Shared input(TestInput::create(fourcc, res[0], res[1]));
         ByteData& bytes = input->bytes;
 
         RandomValueGenerator<uint8_t> rg(0x00, 0xff);
diff --git a/test/i965_jpeg_test_data.h b/test/i965_jpeg_test_data.h
index cde0cfe8258e..698385ae3eea 100644
--- a/test/i965_jpeg_test_data.h
+++ b/test/i965_jpeg_test_data.h
@@ -392,12 +392,13 @@ namespace Encode {
     };
 
     class TestInput
+        : public std::enable_shared_from_this<TestInput>
     {
     public:
         typedef std::shared_ptr<TestInput> Shared;
         typedef std::shared_ptr<const TestInput> SharedConst;
 
-        TestInput(const unsigned, const unsigned, const unsigned);
+        static Shared create(const unsigned, const unsigned, const unsigned);
 
         const unsigned width() const;
         const unsigned height() const;
@@ -420,6 +421,9 @@ namespace Encode {
         std::array<size_t, 3> heights;
         std::array<size_t, 3> offsets;
         std::array<size_t, 3> sizes;
+
+    private:
+        TestInput(const unsigned, const unsigned, const unsigned);
     };
 
     class TestInputCreator
-- 
2.4.11

_______________________________________________
Libva mailing list
Libva@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libva

Reply via email to