From 4ee00568b72e2aa25c262f2d46aacca36bddcffb Mon Sep 17 00:00:00 2001 From: Mark Mentovai Date: Wed, 29 Oct 2014 17:31:23 -0400 Subject: [PATCH] snapshot: Make destructors of interface classes public and virtual. R=rsesek@chromium.org Review URL: https://codereview.chromium.org/689483003 --- snapshot/exception_snapshot.h | 5 ++--- snapshot/mac/exception_snapshot_mac.h | 2 +- snapshot/mac/memory_snapshot_mac.h | 2 +- snapshot/mac/module_snapshot_mac.h | 2 +- snapshot/mac/process_snapshot_mac.h | 2 +- snapshot/mac/system_snapshot_mac.h | 2 +- snapshot/mac/thread_snapshot_mac.h | 2 +- snapshot/memory_snapshot.h | 10 ++++------ snapshot/module_snapshot.h | 5 ++--- snapshot/process_snapshot.h | 5 ++--- snapshot/system_snapshot.h | 5 ++--- snapshot/test/test_module_snapshot.h | 2 +- snapshot/thread_snapshot.h | 5 ++--- 13 files changed, 21 insertions(+), 28 deletions(-) diff --git a/snapshot/exception_snapshot.h b/snapshot/exception_snapshot.h index 5788468a..20598332 100644 --- a/snapshot/exception_snapshot.h +++ b/snapshot/exception_snapshot.h @@ -27,6 +27,8 @@ struct CPUContext; //! snapshot process sustained and triggered the snapshot being taken. class ExceptionSnapshot { public: + virtual ~ExceptionSnapshot() {} + //! \brief Returns a CPUContext object corresponding to the exception thread’s //! CPU context at the time of the exception. //! @@ -86,9 +88,6 @@ class ExceptionSnapshot { //! and the values of `code[0]` and `code[1]` as received by a Mach exception //! handler. virtual const std::vector& Codes() const = 0; - - protected: - ~ExceptionSnapshot() {} }; } // namespace crashpad diff --git a/snapshot/mac/exception_snapshot_mac.h b/snapshot/mac/exception_snapshot_mac.h index 51df8224..fd0eab01 100644 --- a/snapshot/mac/exception_snapshot_mac.h +++ b/snapshot/mac/exception_snapshot_mac.h @@ -37,7 +37,7 @@ namespace internal { class ExceptionSnapshotMac final : public ExceptionSnapshot { public: ExceptionSnapshotMac(); - ~ExceptionSnapshotMac(); + ~ExceptionSnapshotMac() override; //! \brief Initializes the object. //! diff --git a/snapshot/mac/memory_snapshot_mac.h b/snapshot/mac/memory_snapshot_mac.h index 618cd1f7..2f190824 100644 --- a/snapshot/mac/memory_snapshot_mac.h +++ b/snapshot/mac/memory_snapshot_mac.h @@ -31,7 +31,7 @@ namespace internal { class MemorySnapshotMac final : public MemorySnapshot { public: MemorySnapshotMac(); - ~MemorySnapshotMac(); + ~MemorySnapshotMac() override; //! \brief Initializes the object. //! diff --git a/snapshot/mac/module_snapshot_mac.h b/snapshot/mac/module_snapshot_mac.h index 11cc7f8c..e86ed432 100644 --- a/snapshot/mac/module_snapshot_mac.h +++ b/snapshot/mac/module_snapshot_mac.h @@ -39,7 +39,7 @@ namespace internal { class ModuleSnapshotMac final : public ModuleSnapshot { public: ModuleSnapshotMac(); - ~ModuleSnapshotMac(); + ~ModuleSnapshotMac() override; //! \brief Initializes the object. //! diff --git a/snapshot/mac/process_snapshot_mac.h b/snapshot/mac/process_snapshot_mac.h index 2edf32ce..4c1278e7 100644 --- a/snapshot/mac/process_snapshot_mac.h +++ b/snapshot/mac/process_snapshot_mac.h @@ -43,7 +43,7 @@ namespace crashpad { class ProcessSnapshotMac final : public ProcessSnapshot { public: ProcessSnapshotMac(); - ~ProcessSnapshotMac(); + ~ProcessSnapshotMac() override; //! \brief Initializes the object. //! diff --git a/snapshot/mac/system_snapshot_mac.h b/snapshot/mac/system_snapshot_mac.h index b364688f..edbd74fb 100644 --- a/snapshot/mac/system_snapshot_mac.h +++ b/snapshot/mac/system_snapshot_mac.h @@ -34,7 +34,7 @@ namespace internal { class SystemSnapshotMac final : public SystemSnapshot { public: SystemSnapshotMac(); - ~SystemSnapshotMac(); + ~SystemSnapshotMac() override; //! \brief Initializes the object. //! diff --git a/snapshot/mac/thread_snapshot_mac.h b/snapshot/mac/thread_snapshot_mac.h index 2467944e..a59678cc 100644 --- a/snapshot/mac/thread_snapshot_mac.h +++ b/snapshot/mac/thread_snapshot_mac.h @@ -37,7 +37,7 @@ namespace internal { class ThreadSnapshotMac final : public ThreadSnapshot { public: ThreadSnapshotMac(); - ~ThreadSnapshotMac(); + ~ThreadSnapshotMac() override; //! \brief Initializes the object. //! diff --git a/snapshot/memory_snapshot.h b/snapshot/memory_snapshot.h index e7d83166..f0061081 100644 --- a/snapshot/memory_snapshot.h +++ b/snapshot/memory_snapshot.h @@ -32,6 +32,8 @@ class MemorySnapshot { //! data is read, it will be passed to a delegate method. class Delegate { public: + virtual ~Delegate() {} + //! \brief Called by MemorySnapshot::Read() to provide data requested by a //! call to that method. //! @@ -43,11 +45,10 @@ class MemorySnapshot { //! \return `true` on success, `false` on failure. MemoryDelegate::Read() //! will use this as its own return value. virtual bool MemorySnapshotDelegateRead(void* data, size_t size) = 0; - - protected: - ~Delegate() {} }; + virtual ~MemorySnapshot() {} + //! \brief The base address of the memory snapshot in the snapshot process’ //! address space. virtual uint64_t Address() const = 0; @@ -68,9 +69,6 @@ class MemorySnapshot { //! Delegate::MemorySnapshotDelegateRead(), which should be `true` on //! success and `false` on failure. virtual bool Read(Delegate* delegate) const = 0; - - protected: - ~MemorySnapshot() {} }; } // namespace crashpad diff --git a/snapshot/module_snapshot.h b/snapshot/module_snapshot.h index b7e27707..ef2a9c1f 100644 --- a/snapshot/module_snapshot.h +++ b/snapshot/module_snapshot.h @@ -30,6 +30,8 @@ namespace crashpad { //! (binary image) loaded into a snapshot process. class ModuleSnapshot { public: + virtual ~ModuleSnapshot() {} + //! \brief A module’s type. enum ModuleType { //! \brief The module’s type is unknown. @@ -145,9 +147,6 @@ class ModuleSnapshot { //! The annotations returned by this method do not duplicate those returned by //! AnnotationsVector(). virtual std::map AnnotationsSimpleMap() const = 0; - - protected: - ~ModuleSnapshot() {} }; } // namespace crashpad diff --git a/snapshot/process_snapshot.h b/snapshot/process_snapshot.h index 5138f83b..3fe317fa 100644 --- a/snapshot/process_snapshot.h +++ b/snapshot/process_snapshot.h @@ -38,6 +38,8 @@ class ThreadSnapshot; //! objects corresponding to thread stacks. class ProcessSnapshot { public: + virtual ~ProcessSnapshot() {} + //! \brief Returns the snapshot process’ process ID. virtual pid_t ProcessID() const = 0; @@ -106,9 +108,6 @@ class ProcessSnapshot { //! object that it was obtained from. If the snapshot is not a result of //! an exception, returns `nullptr`. virtual const ExceptionSnapshot* Exception() const = 0; - - protected: - ~ProcessSnapshot() {} }; } // namespace crashpad diff --git a/snapshot/system_snapshot.h b/snapshot/system_snapshot.h index 393bd271..6dfede68 100644 --- a/snapshot/system_snapshot.h +++ b/snapshot/system_snapshot.h @@ -29,6 +29,8 @@ namespace crashpad { //! other characteristics. class SystemSnapshot { public: + virtual ~SystemSnapshot() {} + //! \brief A system’s operating system family. enum OperatingSystem { //! \brief The snapshot system’s operating system is unknown. @@ -255,9 +257,6 @@ class SystemSnapshot { int* daylight_offset_seconds, std::string* standard_name, std::string* daylight_name) const = 0; - - protected: - ~SystemSnapshot() {} }; } // namespace crashpad diff --git a/snapshot/test/test_module_snapshot.h b/snapshot/test/test_module_snapshot.h index fdaabca5..7aa5df3f 100644 --- a/snapshot/test/test_module_snapshot.h +++ b/snapshot/test/test_module_snapshot.h @@ -33,7 +33,7 @@ namespace test { class TestModuleSnapshot final : public ModuleSnapshot { public: TestModuleSnapshot(); - ~TestModuleSnapshot(); + ~TestModuleSnapshot() override; void SetName(const std::string& name) { name_ = name; } void SetAddressAndSize(uint64_t address, uint64_t size) { diff --git a/snapshot/thread_snapshot.h b/snapshot/thread_snapshot.h index 5203c2a0..7ae88314 100644 --- a/snapshot/thread_snapshot.h +++ b/snapshot/thread_snapshot.h @@ -26,6 +26,8 @@ class MemorySnapshot; //! (lightweight process) present in a snapshot process. class ThreadSnapshot { public: + virtual ~ThreadSnapshot() {} + //! \brief Returns a CPUContext object corresponding to the thread’s CPU //! context. //! @@ -59,9 +61,6 @@ class ThreadSnapshot { //! \brief Returns the base address of a region used to store thread-specific //! data. virtual uint64_t ThreadSpecificDataAddress() const = 0; - - protected: - ~ThreadSnapshot() {} }; } // namespace crashpad