diff options
author | ziadh@chromium.org <ziadh@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-07-27 20:13:23 +0000 |
---|---|---|
committer | ziadh@chromium.org <ziadh@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-07-27 20:13:23 +0000 |
commit | c12ecab6d48f359d79312aaae5f535b0f26f8445 (patch) | |
tree | f24c364ea1906bb414d10888ff920feeaa024679 /chrome_frame | |
parent | 28a5e7b166ea0eafa36d7626ad6767a365a7a332 (diff) | |
download | chromium_src-c12ecab6d48f359d79312aaae5f535b0f26f8445.zip chromium_src-c12ecab6d48f359d79312aaae5f535b0f26f8445.tar.gz chromium_src-c12ecab6d48f359d79312aaae5f535b0f26f8445.tar.bz2 |
Add undeclared virtual destructors part 2
Preventative maintainance for abstract classes that do not declare virtual destructors. Base classes that do not declare their destructors as virtual could potentially lead to memory leaks.
r=jar
BUG=47469
Review URL: http://codereview.chromium.org/3032024
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@53831 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome_frame')
-rw-r--r-- | chrome_frame/np_event_listener.h | 13 | ||||
-rw-r--r-- | chrome_frame/test/window_watchdog.h | 3 |
2 files changed, 11 insertions, 5 deletions
diff --git a/chrome_frame/np_event_listener.h b/chrome_frame/np_event_listener.h index 18cb4eb..bb6da66 100644 --- a/chrome_frame/np_event_listener.h +++ b/chrome_frame/np_event_listener.h @@ -33,6 +33,9 @@ class NpEventListener { virtual bool Unsubscribe(NPP instance, const char* event_names[], int event_name_count) = 0; + + protected: + virtual ~NpEventListener() {} }; // A little helper class to implement simple ref counting @@ -40,7 +43,7 @@ class NpEventListener { template <class T> class NpEventListenerBase : public NpEventListener { public: - NpEventListenerBase(NpEventDelegate* delegate) + explicit NpEventListenerBase(NpEventDelegate* delegate) : ref_count_(0), delegate_(delegate) { DCHECK(delegate_); thread_id_ = ::GetCurrentThreadId(); @@ -83,8 +86,8 @@ class DomEventListener : public nsIDOMEventListener, public NpEventListenerBase<DomEventListener> { public: - DomEventListener(NpEventDelegate* delegate); - ~DomEventListener(); + explicit DomEventListener(NpEventDelegate* delegate); + virtual ~DomEventListener(); // Implementation of NpEventListener virtual bool Subscribe(NPP instance, @@ -118,7 +121,7 @@ class DomEventListener class NPObjectEventListener : public NpEventListenerBase<NPObjectEventListener> { public: - NPObjectEventListener(NpEventDelegate* delegate); + explicit NPObjectEventListener(NpEventDelegate* delegate); ~NPObjectEventListener(); // Implementation of NpEventListener @@ -133,7 +136,7 @@ class NPObjectEventListener // NPObject structure which is exposed by NPObjectEventListener. class Npo : public NPObject { public: - Npo(NPP npp) : npp_(npp), listener_(NULL) { + explicit Npo(NPP npp) : npp_(npp), listener_(NULL) { } void Initialize(NPObjectEventListener* listener) { diff --git a/chrome_frame/test/window_watchdog.h b/chrome_frame/test/window_watchdog.h index 700859f..60accda 100644 --- a/chrome_frame/test/window_watchdog.h +++ b/chrome_frame/test/window_watchdog.h @@ -17,6 +17,9 @@ struct FunctionStub; class WindowObserver { // NOLINT public: virtual void OnWindowDetected(HWND hwnd, const std::string& caption) = 0; + + protected: + virtual ~WindowObserver() {} }; // Watch a for window to be shown with the given window class name. |