diff options
author | tfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-09-22 20:37:10 +0000 |
---|---|---|
committer | tfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-09-22 20:37:10 +0000 |
commit | f2078c4fb1f49a5f735f28c32adf0f1e46e7c8d5 (patch) | |
tree | 4f3888dceb5517a8700fe82ef27d1d076ee20f04 | |
parent | fc763b3d5aa4ba7a09cd78b9c370ad80b4b346de (diff) | |
download | chromium_src-f2078c4fb1f49a5f735f28c32adf0f1e46e7c8d5.zip chromium_src-f2078c4fb1f49a5f735f28c32adf0f1e46e7c8d5.tar.gz chromium_src-f2078c4fb1f49a5f735f28c32adf0f1e46e7c8d5.tar.bz2 |
compositor: Add protected virtual destructor to CompositorDelegate.
The use of a protected virtual destructor is to prevent the destruction of a
derived object via a base-class pointer.
That's it, CompositorDelegate should only be deleted through derived class.
Example:
class Delegate {
public:
...
protected:
virtual ~Delegate() {}
};
class Foo : public Delegate {
};
Delegate* delegate = new Foo;
delete delegate; // It should prevent this situation!
R=sky@chromium.org
Review URL: http://codereview.chromium.org/7974010
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@102350 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | ui/gfx/compositor/compositor.h | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/ui/gfx/compositor/compositor.h b/ui/gfx/compositor/compositor.h index c81752c..1874df0 100644 --- a/ui/gfx/compositor/compositor.h +++ b/ui/gfx/compositor/compositor.h @@ -72,6 +72,9 @@ class COMPOSITOR_EXPORT CompositorDelegate { public: // Requests the owner to schedule a paint. virtual void ScheduleCompositorPaint() = 0; + + protected: + virtual ~CompositorDelegate() {} }; // Compositor object to take care of GPU painting. |