summaryrefslogtreecommitdiffstats
path: root/base
diff options
context:
space:
mode:
authorjamesr@chromium.org <jamesr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-12-16 01:01:25 +0000
committerjamesr@chromium.org <jamesr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-12-16 01:01:25 +0000
commit20cb5f48d36abeb25bbf6cdd6a5f6debe014e8b1 (patch)
treec8cf260017c72af1080cdbb5861f1e11a250a271 /base
parent131a86821a98e41d363080d9d7925e514ab57869 (diff)
downloadchromium_src-20cb5f48d36abeb25bbf6cdd6a5f6debe014e8b1.zip
chromium_src-20cb5f48d36abeb25bbf6cdd6a5f6debe014e8b1.tar.gz
chromium_src-20cb5f48d36abeb25bbf6cdd6a5f6debe014e8b1.tar.bz2
Give classes with virtual methods virtual protected destructors instead of implicit non-virtual public destructors.
Was originally: Replace public nonvirtual destructors in classes with virtual members with protected nonvirtual destructors where possible, and with public virtual destructors where destruction of a derived class occurs. (Excluding chrome/browser/...) (Part 4 of http://www.gotw.ca/publications/mill18.htm has a rationale for why public nonvirtual destructors in classes with virtual members is dangerous.) Patch by: Jacob Mandelson (jlmjln@gmail.com) BUG=none TEST=base_unittests & app_unittests Review URL: http://codereview.chromium.org/200106 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@34633 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base')
-rw-r--r--base/file_descriptor_shuffle.h3
-rw-r--r--base/task.h6
-rw-r--r--base/waitable_event.h5
3 files changed, 12 insertions, 2 deletions
diff --git a/base/file_descriptor_shuffle.h b/base/file_descriptor_shuffle.h
index 8ee77409..2592b80 100644
--- a/base/file_descriptor_shuffle.h
+++ b/base/file_descriptor_shuffle.h
@@ -37,6 +37,9 @@ class InjectionDelegate {
virtual bool Move(int src, int dest) = 0;
// Delete an element of the domain.
virtual void Close(int fd) = 0;
+
+ protected:
+ virtual ~InjectionDelegate() {}
};
// An implementation of the InjectionDelegate interface using the file
diff --git a/base/task.h b/base/task.h
index 7c2f393..d71df20 100644
--- a/base/task.h
+++ b/base/task.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
+// Copyright (c) 2009 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -666,6 +666,7 @@ template <typename ReturnValue>
struct CallbackWithReturnValue {
class Type {
public:
+ virtual ~Type() {}
virtual ReturnValue Run() = 0;
};
};
@@ -681,6 +682,9 @@ class CallbackWithReturnValueImpl
virtual ReturnValue Run() {
return (this->obj_->*(this->meth_))();
}
+
+ protected:
+ virtual ~CallbackWithReturnValueImpl() {}
};
template <class T, typename ReturnValue>
diff --git a/base/waitable_event.h b/base/waitable_event.h
index 31aa085..8f5962f 100644
--- a/base/waitable_event.h
+++ b/base/waitable_event.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
+// Copyright (c) 2009 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -121,6 +121,9 @@ class WaitableEvent {
// pointers match then this function is called as a final check. See the
// comments in ~Handle for why.
virtual bool Compare(void* tag) = 0;
+
+ protected:
+ virtual ~Waiter() {}
};
private: