diff --git a/minidump/minidump_location_descriptor_list_writer.cc b/minidump/minidump_location_descriptor_list_writer.cc index b3f6d9e8..f4f23a94 100644 --- a/minidump/minidump_location_descriptor_list_writer.cc +++ b/minidump/minidump_location_descriptor_list_writer.cc @@ -19,6 +19,7 @@ #include "util/numeric/safe_assignment.h" namespace crashpad { +namespace internal { MinidumpLocationDescriptorListWriter::MinidumpLocationDescriptorListWriter() : MinidumpWritable(), @@ -31,7 +32,7 @@ MinidumpLocationDescriptorListWriter::~MinidumpLocationDescriptorListWriter() { } void MinidumpLocationDescriptorListWriter::AddChild( - scoped_ptr child) { + scoped_ptr child) { DCHECK_EQ(state(), kStateMutable); children_.push_back(child.release()); @@ -67,7 +68,7 @@ size_t MinidumpLocationDescriptorListWriter::SizeOfObject() { children_.size() * sizeof(MINIDUMP_LOCATION_DESCRIPTOR); } -std::vector +std::vector MinidumpLocationDescriptorListWriter::Children() { DCHECK_GE(state(), kStateFrozen); @@ -99,4 +100,5 @@ bool MinidumpLocationDescriptorListWriter::WriteObject( return file_writer->WriteIoVec(&iovecs); } +} // namespace internal } // namespace crashpad diff --git a/minidump/minidump_location_descriptor_list_writer.h b/minidump/minidump_location_descriptor_list_writer.h index 59bbb249..b7212aeb 100644 --- a/minidump/minidump_location_descriptor_list_writer.h +++ b/minidump/minidump_location_descriptor_list_writer.h @@ -27,24 +27,24 @@ #include "util/stdlib/pointer_container.h" namespace crashpad { +namespace internal { //! \brief The writer for a MinidumpLocationDescriptorList object in a minidump //! file, containing a list of MINIDUMP_LOCATION_DESCRIPTOR objects. -class MinidumpLocationDescriptorListWriter : public internal::MinidumpWritable { +class MinidumpLocationDescriptorListWriter : public MinidumpWritable { protected: MinidumpLocationDescriptorListWriter(); ~MinidumpLocationDescriptorListWriter() override; - //! \brief Adds a MINIDUMP_LOCATION_DESCRIPTOR referencing an - //! internal::MinidumpWritable to the MinidumpLocationDescriptorList. + //! \brief Adds a MINIDUMP_LOCATION_DESCRIPTOR referencing a MinidumpWritable + //! to the MinidumpLocationDescriptorList. //! //! This object takes ownership of \a child and becomes its parent in the - //! overall tree of internal::MinidumpWritable objects. + //! overall tree of MinidumpWritable objects. //! //! To provide type-correctness, subclasses are expected to provide a public //! method that accepts a `scoped_ptr`-wrapped argument of the proper - //! internal::MinidumpWritable subclass, and call this method with that - //! argument. + //! MinidumpWritable subclass, and call this method with that argument. //! //! \note Valid in #kStateMutable. void AddChild(scoped_ptr child); @@ -77,6 +77,7 @@ class MinidumpLocationDescriptorListWriter : public internal::MinidumpWritable { DISALLOW_COPY_AND_ASSIGN(MinidumpLocationDescriptorListWriter); }; +} // namespace internal } // namespace crashpad #endif // CRASHPAD_MINIDUMP_LOCATION_DESCRIPTOR_LIST_WRITER_H_ diff --git a/minidump/minidump_location_descriptor_list_writer_test.cc b/minidump/minidump_location_descriptor_list_writer_test.cc index f831083c..53a1272a 100644 --- a/minidump/minidump_location_descriptor_list_writer_test.cc +++ b/minidump/minidump_location_descriptor_list_writer_test.cc @@ -25,7 +25,7 @@ namespace test { namespace { class TestMinidumpLocationDescriptorListWriter final - : public MinidumpLocationDescriptorListWriter { + : public internal::MinidumpLocationDescriptorListWriter { public: TestMinidumpLocationDescriptorListWriter() : MinidumpLocationDescriptorListWriter() { diff --git a/minidump/minidump_module_crashpad_info_writer.cc b/minidump/minidump_module_crashpad_info_writer.cc index d8568583..08f1ed7c 100644 --- a/minidump/minidump_module_crashpad_info_writer.cc +++ b/minidump/minidump_module_crashpad_info_writer.cc @@ -48,8 +48,7 @@ void MinidumpModuleCrashpadInfoWriter::InitializeFromSnapshot( } SetMinidumpModuleListIndex(module_list_index_u32); - auto list_annotations = - make_scoped_ptr(new internal::MinidumpUTF8StringListWriter()); + auto list_annotations = make_scoped_ptr(new MinidumpUTF8StringListWriter()); list_annotations->InitializeFromVector(module_snapshot->AnnotationsVector()); if (list_annotations->IsUseful()) { SetListAnnotations(list_annotations.Pass()); @@ -65,7 +64,7 @@ void MinidumpModuleCrashpadInfoWriter::InitializeFromSnapshot( } void MinidumpModuleCrashpadInfoWriter::SetListAnnotations( - scoped_ptr list_annotations) { + scoped_ptr list_annotations) { DCHECK_EQ(state(), kStateMutable); list_annotations_ = list_annotations.Pass(); diff --git a/minidump/minidump_module_crashpad_info_writer.h b/minidump/minidump_module_crashpad_info_writer.h index b2c54c76..2e56a011 100644 --- a/minidump/minidump_module_crashpad_info_writer.h +++ b/minidump/minidump_module_crashpad_info_writer.h @@ -72,7 +72,7 @@ class MinidumpModuleCrashpadInfoWriter final //! //! \note Valid in #kStateMutable. void SetListAnnotations( - scoped_ptr list_annotations); + scoped_ptr list_annotations); //! \brief Arranges for MinidumpModuleCrashpadInfo::simple_annotations to //! point to the MinidumpSimpleStringDictionaryWriter object to be written @@ -103,7 +103,7 @@ class MinidumpModuleCrashpadInfoWriter final private: MinidumpModuleCrashpadInfo module_; - scoped_ptr list_annotations_; + scoped_ptr list_annotations_; scoped_ptr simple_annotations_; DISALLOW_COPY_AND_ASSIGN(MinidumpModuleCrashpadInfoWriter); @@ -112,7 +112,7 @@ class MinidumpModuleCrashpadInfoWriter final //! \brief The writer for a MinidumpModuleCrashpadInfoList object in a minidump //! file, containing a list of MinidumpModuleCrashpadInfo objects. class MinidumpModuleCrashpadInfoListWriter final - : public MinidumpLocationDescriptorListWriter { + : public internal::MinidumpLocationDescriptorListWriter { public: MinidumpModuleCrashpadInfoListWriter(); ~MinidumpModuleCrashpadInfoListWriter() override; diff --git a/minidump/minidump_module_crashpad_info_writer_test.cc b/minidump/minidump_module_crashpad_info_writer_test.cc index a798f03f..e92695df 100644 --- a/minidump/minidump_module_crashpad_info_writer_test.cc +++ b/minidump/minidump_module_crashpad_info_writer_test.cc @@ -93,8 +93,7 @@ TEST(MinidumpModuleCrashpadInfoWriter, FullModule) { auto module_writer = make_scoped_ptr(new MinidumpModuleCrashpadInfoWriter()); module_writer->SetMinidumpModuleListIndex(kMinidumpModuleListIndex); - auto string_list_writer = - make_scoped_ptr(new internal::MinidumpUTF8StringListWriter()); + auto string_list_writer = make_scoped_ptr(new MinidumpUTF8StringListWriter()); string_list_writer->InitializeFromVector(vector); module_writer->SetListAnnotations(string_list_writer.Pass()); auto simple_string_dictionary_writer = diff --git a/minidump/minidump_rva_list_writer.cc b/minidump/minidump_rva_list_writer.cc index af4f5824..70ffe4f0 100644 --- a/minidump/minidump_rva_list_writer.cc +++ b/minidump/minidump_rva_list_writer.cc @@ -19,6 +19,7 @@ #include "util/numeric/safe_assignment.h" namespace crashpad { +namespace internal { MinidumpRVAListWriter::MinidumpRVAListWriter() : MinidumpWritable(), @@ -30,8 +31,7 @@ MinidumpRVAListWriter::MinidumpRVAListWriter() MinidumpRVAListWriter::~MinidumpRVAListWriter() { } -void MinidumpRVAListWriter::AddChild( - scoped_ptr child) { +void MinidumpRVAListWriter::AddChild(scoped_ptr child) { DCHECK_EQ(state(), kStateMutable); children_.push_back(child.release()); @@ -65,7 +65,7 @@ size_t MinidumpRVAListWriter::SizeOfObject() { return sizeof(rva_list_base_) + children_.size() * sizeof(RVA); } -std::vector MinidumpRVAListWriter::Children() { +std::vector MinidumpRVAListWriter::Children() { DCHECK_GE(state(), kStateFrozen); std::vector children; @@ -94,4 +94,5 @@ bool MinidumpRVAListWriter::WriteObject(FileWriterInterface* file_writer) { return file_writer->WriteIoVec(&iovecs); } +} // namespace internal } // namespace crashpad diff --git a/minidump/minidump_rva_list_writer.h b/minidump/minidump_rva_list_writer.h index 5d27794d..257f2c0c 100644 --- a/minidump/minidump_rva_list_writer.h +++ b/minidump/minidump_rva_list_writer.h @@ -27,24 +27,24 @@ #include "util/stdlib/pointer_container.h" namespace crashpad { +namespace internal { //! \brief The writer for a MinidumpRVAList object in a minidump file, //! containing a list of ::RVA pointers. -class MinidumpRVAListWriter : public internal::MinidumpWritable { +class MinidumpRVAListWriter : public MinidumpWritable { protected: MinidumpRVAListWriter(); ~MinidumpRVAListWriter() override; - //! \brief Adds an ::RVA referencing an internal::MinidumpWritable to the + //! \brief Adds an ::RVA referencing an MinidumpWritable to the //! MinidumpRVAList. //! //! This object takes ownership of \a child and becomes its parent in the - //! overall tree of internal::MinidumpWritable objects. + //! overall tree of MinidumpWritable objects. //! //! To provide type-correctness, subclasses are expected to provide a public //! method that accepts a `scoped_ptr`-wrapped argument of the proper - //! internal::MinidumpWritable subclass, and call this method with that - //! argument. + //! MinidumpWritable subclass, and call this method with that argument. //! //! \note Valid in #kStateMutable. void AddChild(scoped_ptr child); @@ -73,6 +73,7 @@ class MinidumpRVAListWriter : public internal::MinidumpWritable { DISALLOW_COPY_AND_ASSIGN(MinidumpRVAListWriter); }; +} // namespace internal } // namespace crashpad #endif // CRASHPAD_MINIDUMP_RVA_LIST_WRITER_H_ diff --git a/minidump/minidump_rva_list_writer_test.cc b/minidump/minidump_rva_list_writer_test.cc index 368f8a72..e2b7d122 100644 --- a/minidump/minidump_rva_list_writer_test.cc +++ b/minidump/minidump_rva_list_writer_test.cc @@ -24,7 +24,7 @@ namespace crashpad { namespace test { namespace { -class TestMinidumpRVAListWriter final : public MinidumpRVAListWriter { +class TestMinidumpRVAListWriter final : public internal::MinidumpRVAListWriter { public: TestMinidumpRVAListWriter() : MinidumpRVAListWriter() {} ~TestMinidumpRVAListWriter() override {} diff --git a/minidump/minidump_string_writer.cc b/minidump/minidump_string_writer.cc index effc0183..eea4eec4 100644 --- a/minidump/minidump_string_writer.cc +++ b/minidump/minidump_string_writer.cc @@ -95,17 +95,18 @@ void MinidumpUTF16StringWriter::SetUTF8(const std::string& string_utf8) { MinidumpUTF8StringWriter::~MinidumpUTF8StringWriter() { } -template -MinidumpStringListWriter::MinidumpStringListWriter() +template +MinidumpStringListWriter::MinidumpStringListWriter() : MinidumpRVAListWriter() { } -template -MinidumpStringListWriter::~MinidumpStringListWriter() { +template +MinidumpStringListWriter< + MinidumpStringWriterType>::~MinidumpStringListWriter() { } -template -void MinidumpStringListWriter::InitializeFromVector( +template +void MinidumpStringListWriter::InitializeFromVector( const std::vector& vector) { DCHECK_EQ(state(), kStateMutable); DCHECK(IsEmpty()); @@ -115,23 +116,23 @@ void MinidumpStringListWriter::InitializeFromVector( } } -template -void MinidumpStringListWriter::AddStringUTF8( +template +void MinidumpStringListWriter::AddStringUTF8( const std::string& string_utf8) { auto string_writer = make_scoped_ptr(new MinidumpStringWriterType()); string_writer->SetUTF8(string_utf8); AddChild(string_writer.Pass()); } -template -bool MinidumpStringListWriter::IsUseful() const { +template +bool MinidumpStringListWriter::IsUseful() const { return !IsEmpty(); } // Explicit template instantiation of the forms of MinidumpStringListWriter<> // used as type aliases. -template class MinidumpStringListWriter; -template class MinidumpStringListWriter; +template class MinidumpStringListWriter; +template class MinidumpStringListWriter; } // namespace internal } // namespace crashpad diff --git a/minidump/minidump_string_writer.h b/minidump/minidump_string_writer.h index 319f507b..a12885cd 100644 --- a/minidump/minidump_string_writer.h +++ b/minidump/minidump_string_writer.h @@ -126,25 +126,11 @@ class MinidumpUTF8StringWriter final DISALLOW_COPY_AND_ASSIGN(MinidumpUTF8StringWriter); }; -//! \cond - -struct MinidumpStringListWriterUTF16Traits { - using MinidumpStringWriterType = MinidumpUTF16StringWriter; -}; - -struct MinidumpStringListWriterUTF8Traits { - using MinidumpStringWriterType = MinidumpUTF8StringWriter; -}; - -//! \endcond - //! \brief The writer for a MinidumpRVAList object in a minidump file, -//! containing a list of \a Traits::MinidumpStringWriterType objects. -template -class MinidumpStringListWriter : public MinidumpRVAListWriter { +//! containing a list of \a MinidumpStringWriterType objects. +template +class MinidumpStringListWriter final : public MinidumpRVAListWriter { public: - using MinidumpStringWriterType = typename Traits::MinidumpStringWriterType; - MinidumpStringListWriter(); ~MinidumpStringListWriter() override; @@ -165,7 +151,7 @@ class MinidumpStringListWriter : public MinidumpRVAListWriter { //! //! This object creates a new string writer with string value \a string_utf8, //! takes ownership of it, and becomes its parent in the overall tree of - //! internal::MinidumpWritable objects. + //! MinidumpWritable objects. //! //! \note Valid in #kStateMutable. void AddStringUTF8(const std::string& string_utf8); @@ -183,12 +169,13 @@ class MinidumpStringListWriter : public MinidumpRVAListWriter { DISALLOW_COPY_AND_ASSIGN(MinidumpStringListWriter); }; -using MinidumpUTF16StringListWriter = - MinidumpStringListWriter; -using MinidumpUTF8StringListWriter = - MinidumpStringListWriter; - } // namespace internal + +using MinidumpUTF16StringListWriter = internal::MinidumpStringListWriter< + internal::MinidumpUTF16StringWriter>; +using MinidumpUTF8StringListWriter = internal::MinidumpStringListWriter< + internal::MinidumpUTF8StringWriter>; + } // namespace crashpad #endif // CRASHPAD_MINIDUMP_MINIDUMP_STRING_WRITER_H_ diff --git a/minidump/minidump_string_writer_test.cc b/minidump/minidump_string_writer_test.cc index 8854f444..ab09b6e6 100644 --- a/minidump/minidump_string_writer_test.cc +++ b/minidump/minidump_string_writer_test.cc @@ -198,7 +198,7 @@ TEST(MinidumpStringWriter, MinidumpUTF8StringWriter) { } struct MinidumpUTF16StringListWriterTraits { - using MinidumpStringListWriterType = internal::MinidumpUTF16StringListWriter; + using MinidumpStringListWriterType = MinidumpUTF16StringListWriter; static string16 ExpectationForUTF8(const std::string& utf8) { return base::UTF8ToUTF16(utf8); } @@ -208,7 +208,7 @@ struct MinidumpUTF16StringListWriterTraits { }; struct MinidumpUTF8StringListWriterTraits { - using MinidumpStringListWriterType = internal::MinidumpUTF8StringListWriter; + using MinidumpStringListWriterType = MinidumpUTF8StringListWriter; static std::string ExpectationForUTF8(const std::string& utf8) { return utf8; }