Commit aa7203ef by Frank Henigman Committed by Commit Bot

Inherit privately from angle::NonCopyable.

Make all inheritance from angle::NonCopyable private so the compiler complains about this (admittedly unlikely) code: class Foo: angle::NonCopyable { virtual ~Foo() { ... } }; angle::NonCopyable *p = new Foo; delete p; In the above code ~Foo() is not called, only ~NonCopyable(), because the latter is not virtual. Making it virtual would add overhead to all derived classes which don't already have a virtual method. Also tighten access in NonCopyable, because we can. BUG=angleproject:2026 Change-Id: Id0dc4d959cfb7bb82cf49382118129abb1d3a4f0 Reviewed-on: https://chromium-review.googlesource.com/495352Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org> Reviewed-by: 's avatarCorentin Wallez <cwallez@chromium.org> Commit-Queue: Frank Henigman <fjhenigman@chromium.org>
parent 6a1d2f93
......@@ -29,10 +29,11 @@ using Microsoft::WRL::ComPtr;
class NonCopyable
{
public:
protected:
NonCopyable() = default;
~NonCopyable() = default;
protected:
private:
NonCopyable(const NonCopyable&) = delete;
void operator=(const NonCopyable&) = delete;
};
......
......@@ -19,7 +19,7 @@ class DirectiveHandler;
struct PreprocessorImpl;
struct Token;
struct PreprocessorSettings : angle::NonCopyable
struct PreprocessorSettings : private angle::NonCopyable
{
PreprocessorSettings() : maxMacroExpansionDepth(1000) {}
int maxMacroExpansionDepth;
......
......@@ -25,7 +25,7 @@ namespace angle
namespace
{
struct LibPCI : angle::NonCopyable
struct LibPCI : private angle::NonCopyable
{
LibPCI()
{
......
......@@ -34,7 +34,7 @@ static constexpr Version ES_3_1 = Version(3, 1);
using ContextID = uintptr_t;
class ContextState final : public angle::NonCopyable
class ContextState final : angle::NonCopyable
{
public:
ContextState(ContextID context,
......
......@@ -41,7 +41,7 @@ class Stream;
using SurfaceSet = std::set<Surface *>;
struct DisplayState final : angle::NonCopyable
struct DisplayState final : private angle::NonCopyable
{
SurfaceSet surfaceSet;
};
......
......@@ -57,7 +57,7 @@ class ImageSibling : public RefCountObject, public gl::FramebufferAttachmentObje
BindingPointer<Image> mTargetOf;
};
struct ImageState : angle::NonCopyable
struct ImageState : private angle::NonCopyable
{
ImageState(EGLenum target, ImageSibling *buffer, const AttributeMap &attribs);
......
......@@ -37,7 +37,7 @@ class AttributeMap;
class Display;
struct Config;
struct SurfaceState final : angle::NonCopyable
struct SurfaceState final : private angle::NonCopyable
{
SurfaceState(const egl::Config *configIn);
......
......@@ -82,7 +82,7 @@ struct SwizzleState final
};
// State from Table 6.9 (state per texture object) in the OpenGL ES 3.0.2 spec.
struct TextureState final : public angle::NonCopyable
struct TextureState final : private angle::NonCopyable
{
TextureState(GLenum target);
......
......@@ -27,7 +27,7 @@ struct Caps;
class Context;
class Program;
class TransformFeedbackState final : public angle::NonCopyable
class TransformFeedbackState final : angle::NonCopyable
{
public:
TransformFeedbackState(size_t maxIndexedBuffers);
......
......@@ -31,7 +31,7 @@ namespace gl
{
class Buffer;
class VertexArrayState final : public angle::NonCopyable
class VertexArrayState final : angle::NonCopyable
{
public:
VertexArrayState(size_t maxAttribs, size_t maxBindings);
......
......@@ -18,7 +18,7 @@ class VertexArray;
//
// Implementation of Generic Vertex Attribute Bindings for ES3.1
//
struct VertexBinding final : angle::NonCopyable
struct VertexBinding final : private angle::NonCopyable
{
VertexBinding();
explicit VertexBinding(VertexBinding &&binding);
......@@ -34,7 +34,7 @@ struct VertexBinding final : angle::NonCopyable
//
// Implementation of Generic Vertex Attributes for ES3.1
//
struct VertexAttribute final : angle::NonCopyable
struct VertexAttribute final : private angle::NonCopyable
{
explicit VertexAttribute(GLuint bindingIndex);
explicit VertexAttribute(VertexAttribute &&attrib);
......
......@@ -289,7 +289,7 @@ enum VertexFormatType
typedef std::vector<VertexFormatType> InputLayout;
struct VertexFormat : angle::NonCopyable
struct VertexFormat : private angle::NonCopyable
{
VertexFormat(GLenum typeIn, GLboolean normalizedIn, GLuint componentsIn, bool pureIntegerIn);
......
......@@ -18,7 +18,7 @@
namespace angle
{
struct Format final : angle::NonCopyable
struct Format final : private angle::NonCopyable
{
enum class ID;
......
......@@ -14,7 +14,7 @@
namespace rx
{
class SamplerImpl : public angle::NonCopyable
class SamplerImpl : angle::NonCopyable
{
public:
SamplerImpl() {}
......
......@@ -55,7 +55,7 @@ struct PixelShaderOutputVariable
size_t outputIndex = 0;
};
struct BuiltinVarying final : angle::NonCopyable
struct BuiltinVarying final : private angle::NonCopyable
{
BuiltinVarying();
......
......@@ -32,7 +32,7 @@ class ShaderExecutableD3D;
#endif
// Helper struct representing a single shader uniform
struct D3DUniform : angle::NonCopyable
struct D3DUniform : private angle::NonCopyable
{
D3DUniform(GLenum typeIn,
const std::string &nameIn,
......
......@@ -42,7 +42,7 @@ class Clear11 : angle::NonCopyable
const gl::FramebufferState &fboData);
private:
class ShaderManager final : public angle::NonCopyable
class ShaderManager final : angle::NonCopyable
{
public:
ShaderManager();
......
......@@ -36,7 +36,7 @@ class Query11 : public QueryImpl
gl::Error resume();
private:
struct QueryState final : public angle::NonCopyable
struct QueryState final : private angle::NonCopyable
{
QueryState();
~QueryState();
......
......@@ -41,7 +41,7 @@ struct DXGIFormatSize
};
const DXGIFormatSize &GetDXGIFormatSizeInfo(DXGI_FORMAT format);
struct VertexFormat : angle::NonCopyable
struct VertexFormat : private angle::NonCopyable
{
constexpr VertexFormat();
constexpr VertexFormat(VertexConversionType conversionType,
......
......@@ -223,7 +223,7 @@ ID3D11PixelShader *CompilePS(ID3D11Device *device, const BYTE (&byteCode)[N], co
}
template <typename ResourceType>
class LazyResource : public angle::NonCopyable
class LazyResource : angle::NonCopyable
{
public:
LazyResource() : mResource(nullptr), mAssociatedDevice(nullptr) {}
......
......@@ -30,7 +30,7 @@ namespace d3d11
// on device capabilities.
// This structure allows querying for the DXGI texture formats to use for textures, SRVs, RTVs and
// DSVs given a GL internal format.
struct Format final : angle::NonCopyable
struct Format final : private angle::NonCopyable
{
constexpr Format();
constexpr Format(GLenum internalFormat,
......
......@@ -53,7 +53,7 @@ gl::Error CheckLinkStatus(const rx::FunctionsGL *functions, GLuint program)
return gl::NoError();
}
class ScopedGLState : public angle::NonCopyable
class ScopedGLState : angle::NonCopyable
{
public:
enum
......
......@@ -28,7 +28,7 @@ class StateManagerGL;
class TextureGL;
struct WorkaroundsGL;
class BlitGL : public angle::NonCopyable
class BlitGL : angle::NonCopyable
{
public:
BlitGL(const FunctionsGL *functions,
......
......@@ -20,7 +20,7 @@ namespace rx
namespace vk
{
struct Format final : angle::NonCopyable
struct Format final : private angle::NonCopyable
{
constexpr Format(GLenum internalFormat,
angle::Format::ID formatID,
......
......@@ -69,7 +69,7 @@ class VertexAttributeTest : public ANGLETest
IMMEDIATE,
};
struct TestData final : angle::NonCopyable
struct TestData final : private angle::NonCopyable
{
TestData(GLenum typeIn,
GLboolean normalizedIn,
......
......@@ -18,7 +18,7 @@ using namespace testing;
namespace
{
// Only applies to D3D11
struct Captures final : angle::NonCopyable
struct Captures final : private angle::NonCopyable
{
Timer *timer = CreateTimer();
size_t loadDLLsMS = 0;
......
......@@ -187,7 +187,7 @@ class EGLWindow;
class OSWindow;
class ANGLETest;
struct TestPlatformContext final : angle::NonCopyable
struct TestPlatformContext final : private angle::NonCopyable
{
bool ignoreMessages = false;
ANGLETest *currentTest = nullptr;
......
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