From 88442dd5788bf7836ab013939cca4a4683560cb0 Mon Sep 17 00:00:00 2001 From: Mark Mentovai Date: Tue, 7 Feb 2017 16:04:41 -0500 Subject: [PATCH] Merge Chromium 294442c0ce05 upstream to Crashpad Remove stl_util from Crashpad. This also updates mini_chromium to 4f3cfc8e7c2b7d77f94f41a32c3ec84a6920f05d to remove stl_util from there as well. 4f3cfc8e7c2b Remove stl_util from mini_chromium BUG=chromium:555865 Change-Id: I8ecb1639a258dd233d524834ed205a4fcc641bac Reviewed-on: https://chromium-review.googlesource.com/438865 Reviewed-by: Scott Graham --- DEPS | 2 +- minidump/minidump_handle_writer.cc | 4 +-- ...inidump_simple_string_dictionary_writer.cc | 4 +-- snapshot/win/thread_snapshot_win.cc | 1 + util/net/http_body.cc | 4 +-- util/stdlib/pointer_container.h | 34 +++++++------------ 6 files changed, 20 insertions(+), 29 deletions(-) diff --git a/DEPS b/DEPS index 8fba79f3..db8c048c 100644 --- a/DEPS +++ b/DEPS @@ -38,7 +38,7 @@ deps = { 'crashpad/third_party/mini_chromium/mini_chromium': Var('chromium_git') + '/chromium/mini_chromium@' + - 'e504d59673e56887a4e837cbeb44b32ec21974f9', + '4f3cfc8e7c2b7d77f94f41a32c3ec84a6920f05d', } hooks = [ diff --git a/minidump/minidump_handle_writer.cc b/minidump/minidump_handle_writer.cc index c5d4659f..098b40a1 100644 --- a/minidump/minidump_handle_writer.cc +++ b/minidump/minidump_handle_writer.cc @@ -17,7 +17,6 @@ #include #include "base/logging.h" -#include "base/stl_util.h" #include "minidump/minidump_extensions.h" #include "util/file/file_writer.h" #include "util/numeric/safe_assignment.h" @@ -29,7 +28,8 @@ MinidumpHandleDataWriter::MinidumpHandleDataWriter() } MinidumpHandleDataWriter::~MinidumpHandleDataWriter() { - base::STLDeleteContainerPairSecondPointers(strings_.begin(), strings_.end()); + for (auto& item : strings_) + delete item.second; } void MinidumpHandleDataWriter::InitializeFromSnapshot( diff --git a/minidump/minidump_simple_string_dictionary_writer.cc b/minidump/minidump_simple_string_dictionary_writer.cc index b4dd722e..ae8bfaba 100644 --- a/minidump/minidump_simple_string_dictionary_writer.cc +++ b/minidump/minidump_simple_string_dictionary_writer.cc @@ -18,7 +18,6 @@ #include "base/logging.h" #include "base/memory/ptr_util.h" -#include "base/stl_util.h" #include "util/file/file_writer.h" #include "util/numeric/safe_assignment.h" @@ -100,7 +99,8 @@ MinidumpSimpleStringDictionaryWriter::MinidumpSimpleStringDictionaryWriter() } MinidumpSimpleStringDictionaryWriter::~MinidumpSimpleStringDictionaryWriter() { - base::STLDeleteContainerPairSecondPointers(entries_.begin(), entries_.end()); + for (auto& item : entries_) + delete item.second; } void MinidumpSimpleStringDictionaryWriter::InitializeFromMap( diff --git a/snapshot/win/thread_snapshot_win.cc b/snapshot/win/thread_snapshot_win.cc index 8b86730c..d737c14b 100644 --- a/snapshot/win/thread_snapshot_win.cc +++ b/snapshot/win/thread_snapshot_win.cc @@ -14,6 +14,7 @@ #include "snapshot/win/thread_snapshot_win.h" +#include #include #include "base/logging.h" diff --git a/util/net/http_body.cc b/util/net/http_body.cc index b1bca19e..96a7cc40 100644 --- a/util/net/http_body.cc +++ b/util/net/http_body.cc @@ -20,7 +20,6 @@ #include #include "base/logging.h" -#include "base/stl_util.h" #include "util/misc/implicit_cast.h" namespace crashpad { @@ -89,7 +88,8 @@ CompositeHTTPBodyStream::CompositeHTTPBodyStream( } CompositeHTTPBodyStream::~CompositeHTTPBodyStream() { - base::STLDeleteContainerPointers(parts_.begin(), parts_.end()); + for (auto& item : parts_) + delete item; } FileOperationResult CompositeHTTPBodyStream::GetBytesBuffer(uint8_t* buffer, diff --git a/util/stdlib/pointer_container.h b/util/stdlib/pointer_container.h index 576270df..7d2d5d06 100644 --- a/util/stdlib/pointer_container.h +++ b/util/stdlib/pointer_container.h @@ -18,30 +18,9 @@ #include #include "base/macros.h" -#include "base/stl_util.h" namespace crashpad { -//! \brief Allows a standard container to “own” pointer elements stored in it. -//! -//! When the container is destroyed, `delete` will be called on its pointer -//! elements. -//! -//! \note No attempt is made to `delete` elements that are removed from the -//! container by other means, such as replacement or `clear()`. -template -class PointerContainer : public ContainerType { - public: - PointerContainer() : ContainerType(), pointer_deleter_(this) {} - - ~PointerContainer() {} - - private: - base::STLElementDeleter pointer_deleter_; - - DISALLOW_COPY_AND_ASSIGN(PointerContainer); -}; - //! \brief Allows a `std::vector` to “own” pointer elements stored in it. //! //! When the vector is destroyed, `delete` will be called on its pointer @@ -50,7 +29,18 @@ class PointerContainer : public ContainerType { //! \note No attempt is made to `delete` elements that are removed from the //! vector by other means, such as replacement or `clear()`. template -using PointerVector = PointerContainer>; +class PointerVector : public std::vector { + public: + PointerVector() : std::vector() {} + + ~PointerVector() { + for (T* item : *this) + delete item; + } + + private: + DISALLOW_COPY_AND_ASSIGN(PointerVector); +}; } // namespace crashpad