Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(95)

Unified Diff: minidump/minidump_module_writer.h

Issue 674153002: minidump: Change the ownership model (Closed) Base URL: https://chromium.googlesource.com/crashpad/crashpad@master
Patch Set: Address review feedback Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « minidump/minidump_module_crashpad_info_writer_test.cc ('k') | minidump/minidump_module_writer.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: minidump/minidump_module_writer.h
diff --git a/minidump/minidump_module_writer.h b/minidump/minidump_module_writer.h
index 6cef8ad98c5b736fc40e5a2e13ed7b6146feba0a..4ec6ed4634510fcd7910ee009d30ef2e086e5d57 100644
--- a/minidump/minidump_module_writer.h
+++ b/minidump/minidump_module_writer.h
@@ -28,6 +28,7 @@
#include "minidump/minidump_extensions.h"
#include "minidump/minidump_stream_writer.h"
#include "minidump/minidump_writable.h"
+#include "util/stdlib/pointer_container.h"
namespace crashpad {
@@ -39,7 +40,7 @@ class MinidumpUTF16StringWriter;
//! MINIDUMP_MODULE::CvRecord in minidump files.
class MinidumpModuleCodeViewRecordWriter : public internal::MinidumpWritable {
public:
- virtual ~MinidumpModuleCodeViewRecordWriter();
+ ~MinidumpModuleCodeViewRecordWriter() override;
protected:
MinidumpModuleCodeViewRecordWriter() : MinidumpWritable() {}
@@ -134,7 +135,7 @@ class MinidumpModuleMiscDebugRecordWriter final
: public internal::MinidumpWritable {
public:
MinidumpModuleMiscDebugRecordWriter();
- ~MinidumpModuleMiscDebugRecordWriter() {}
+ ~MinidumpModuleMiscDebugRecordWriter() override;
//! \brief Sets IMAGE_DEBUG_MISC::DataType.
void SetDataType(uint32_t data_type) {
@@ -173,7 +174,7 @@ class MinidumpModuleMiscDebugRecordWriter final
class MinidumpModuleWriter final : public internal::MinidumpWritable {
public:
MinidumpModuleWriter();
- ~MinidumpModuleWriter();
+ ~MinidumpModuleWriter() override;
//! \brief Returns a MINIDUMP_MODULE referencing this object’s data.
//!
@@ -194,21 +195,22 @@ class MinidumpModuleWriter final : public internal::MinidumpWritable {
//! \brief Arranges for MINIDUMP_MODULE::CvRecord to point to a CodeView
//! record to be written by \a codeview_record.
//!
- //! \a codeview_record will become a child of this object in the overall tree
- //! of internal::MinidumpWritable objects.
+ //! This object takes ownership of \a codeview_record and becomes its parent
+ //! in the overall tree of internal::MinidumpWritable objects.
//!
//! \note Valid in #kStateMutable.
- void SetCodeViewRecord(MinidumpModuleCodeViewRecordWriter* codeview_record);
+ void SetCodeViewRecord(
+ scoped_ptr<MinidumpModuleCodeViewRecordWriter> codeview_record);
//! \brief Arranges for MINIDUMP_MODULE::MiscRecord to point to an
//! IMAGE_DEBUG_MISC object to be written by \a misc_debug_record.
//!
- //! \a misc_debug_record will become a child of this object in the overall
- //! tree of internal::MinidumpWritable objects.
+ //! This object takes ownership of \a misc_debug_record and becomes its parent
+ //! in the overall tree of internal::MinidumpWritable objects.
//!
//! \note Valid in #kStateMutable.
void SetMiscDebugRecord(
- MinidumpModuleMiscDebugRecordWriter* misc_debug_record);
+ scoped_ptr<MinidumpModuleMiscDebugRecordWriter> misc_debug_record);
//! \brief Sets IMAGE_DEBUG_MISC::BaseOfImage.
void SetImageBaseAddress(uint64_t image_base_address) {
@@ -279,8 +281,8 @@ class MinidumpModuleWriter final : public internal::MinidumpWritable {
private:
MINIDUMP_MODULE module_;
scoped_ptr<internal::MinidumpUTF16StringWriter> name_;
- MinidumpModuleCodeViewRecordWriter* codeview_record_; // weak
- MinidumpModuleMiscDebugRecordWriter* misc_debug_record_; // weak
+ scoped_ptr<MinidumpModuleCodeViewRecordWriter> codeview_record_;
+ scoped_ptr<MinidumpModuleMiscDebugRecordWriter> misc_debug_record_;
DISALLOW_COPY_AND_ASSIGN(MinidumpModuleWriter);
};
@@ -290,15 +292,15 @@ class MinidumpModuleWriter final : public internal::MinidumpWritable {
class MinidumpModuleListWriter final : public internal::MinidumpStreamWriter {
public:
MinidumpModuleListWriter();
- ~MinidumpModuleListWriter();
+ ~MinidumpModuleListWriter() override;
//! \brief Adds a MinidumpModuleWriter to the MINIDUMP_MODULE_LIST.
//!
- //! \a module will become a child of this object in the overall tree of
- //! internal::MinidumpWritable objects.
+ //! This object takes ownership of \a module and becomes its parent in the
+ //! overall tree of internal::MinidumpWritable objects.
//!
//! \note Valid in #kStateMutable.
- void AddModule(MinidumpModuleWriter* module);
+ void AddModule(scoped_ptr<MinidumpModuleWriter> module);
protected:
// MinidumpWritable:
@@ -312,7 +314,7 @@ class MinidumpModuleListWriter final : public internal::MinidumpStreamWriter {
private:
MINIDUMP_MODULE_LIST module_list_base_;
- std::vector<MinidumpModuleWriter*> modules_; // weak
+ PointerVector<MinidumpModuleWriter> modules_;
DISALLOW_COPY_AND_ASSIGN(MinidumpModuleListWriter);
};
« no previous file with comments | « minidump/minidump_module_crashpad_info_writer_test.cc ('k') | minidump/minidump_module_writer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698