16 Commits

Author SHA1 Message Date
Lei Zhang
c63c073d27 Do IWYU for check_op.h
Include check_op.h directly, instead of relying on the transitive
include from logging.h. This transitive include does not exist in
Chromium's //base.

Change-Id: I15962a9cdc26ac206032157b8d2659cf263ad695
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/4950200
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
2023-10-18 20:01:37 +00:00
Mark Mentovai
6278690abe Update copyright boilerplate, 2022 edition (Crashpad)
sed -i '' -E -e 's/Copyright (.+) The Crashpad Authors\. All rights reserved\.$/Copyright \1 The Crashpad Authors/' $(git grep -El 'Copyright (.+) The Crashpad Authors\. All rights reserved\.$')

Bug: chromium:1098010
Change-Id: I8d6138469ddbe3d281a5d83f64cf918ec2491611
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/3878262
Reviewed-by: Joshua Peraza <jperaza@chromium.org>
Commit-Queue: Mark Mentovai <mark@chromium.org>
2022-09-06 23:54:07 +00:00
Mark Mentovai
7a849482ea Switch the language standard to C++14 and use std::make_unique
Update mini_chromium to 7d6697ceb5cb5ca02fde3813496f48b9b1d76d0c

47ff9691450e Switch the language standard to C++14
7d6697ceb5cb Remove base/memory/ptr_util.h and base::WrapUnique

base::WrapUnique and std::make_unique are similar, but the latter is
standardized and preferred.

Most of the mechanical changes were made with this sed:

for f in $(git grep -l base::WrapUnique | uniq); do
  sed -E \
      -e 's%base::WrapUnique\(new ([^(]+)\((.*)\)\);%std::make_unique<\1>(\2);%g' \
      -e 's%base::WrapUnique\(new ([^(]+)\);%std::make_unique<\1>();%g' \
      -e 's%^#include "base/memory/ptr_util.h"$%#include <memory>%' \
      -i '' "${f}"
done

Several uses of base::WrapUnique that did not fit on a single line and
were not matched by this sed were adjusted manually. All #include
changes were audited manually, to at least move <memory> into the
correct section. Where <memory> was already #included by a file (or its
corresponding header), the extra #include was removed. Where <memory>
should have been #included by a header, it was added. Other similar
adjustments to other #includes were also made.

Change-Id: Id4e0baad8b3652646bede4c3f30f41fcabfdbd4f
Reviewed-on: https://chromium-review.googlesource.com/714658
Commit-Queue: Mark Mentovai <mark@chromium.org>
Reviewed-by: Leonard Mosescu <mosescu@chromium.org>
2017-10-12 19:07:13 +00:00
Mark Mentovai
88442dd578 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 <scottmg@chromium.org>
2017-02-07 21:04:42 +00:00
Mark Mentovai
5b14b41992 GCC fix: Don’t name a method exactly the same as its return type
While compiling, for example,
minidump_simple_string_dictionary_writer.cc:

In file included from
../../minidump/minidump_module_crashpad_info_writer.cc:21:0:
../../minidump/minidump_simple_string_dictionary_writer.h:55:45: error:
declaration of ‘const crashpad::MinidumpSimpleStringDictionaryEntry*
crashpad::MinidumpSimpleStringDictionaryEntryWriter::MinidumpSimpleStringDictionaryEntry()
const’ [-fpermissive]
       MinidumpSimpleStringDictionaryEntry() const;
                                             ^~~~~
In file included from
../../minidump/minidump_module_crashpad_info_writer.h:25:0,
                 from
../../minidump/minidump_module_crashpad_info_writer.cc:15:
../../minidump/minidump_extensions.h:255:26: error: changes meaning of
‘MinidumpSimpleStringDictionaryEntry’ from ‘struct
crashpad::MinidumpSimpleStringDictionaryEntry’ [-fpermissive]
 struct ALIGNAS(4) PACKED MinidumpSimpleStringDictionaryEntry {
                          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Tested with:
 - GCC 4.9 from NDK r13 targeting arm with SDK 16
 - GCC 4.9 from NDK r13 targeting arm64 with SDK 21
 - GCC 6.2 targeting x86_64

BUG=crashpad:30

Change-Id: I1e5e6a21a24f19eef7602e4123459ce15f3b089e
Reviewed-on: https://chromium-review.googlesource.com/409624
Reviewed-by: Robert Sesek <rsesek@chromium.org>
2016-11-11 17:36:17 +00:00
Sami Kyostila
e45024b083 Use stl utilities from the base namespace
The utilities in base/stl_util.h have been moved from the global
into the base namespace. This patch updates the call sites accordingly.

No functional changes.

Change-Id: I059d5d6299f947b1135672da170427d23ac4775e
Reviewed-on: https://chromium-review.googlesource.com/368640
Reviewed-by: Mark Mentovai <mark@chromium.org>
2016-08-12 14:31:53 +00:00
Scott Graham
a02ba24006 Convert from scoped_ptr to std::unique_ptr
Follows https://codereview.chromium.org/1911823002/ but fixes includes
that were messed up there.

Change-Id: Ic4bad7d095ee6f5a1c9f8ca2d11ac9e67d55a626
Reviewed-on: https://chromium-review.googlesource.com/340497
Reviewed-by: Robert Sesek <rsesek@chromium.org>
2016-04-25 19:16:26 +00:00
Mark Mentovai
583d1dc3ef Provide std::move() in compat instead of using crashpad::move()
This more-natural spelling doesn’t require Crashpad developers to have
to remember anything special when writing code in Crashpad. It’s easier
to grep for and it’s easier to remove the “compat” part when pre-C++11
libraries are no longer relevant.

R=scottmg@chromium.org

Review URL: https://codereview.chromium.org/1513573005 .
2015-12-09 17:36:32 -05:00
Dana Jansens
6bebb10829 Replace use of .Pass() with crashpad::move().
Since C++11 library support isn't available everywhere crashpad is
compiled, add our own move() method in the crashpad namespace to replace
std::move() for now. Replace uses of .Pass() with this method.

R=mark@chromium.org, scottmg@chromium.org
BUG=chromium:557422

Review URL: https://codereview.chromium.org/1483073004 .
2015-11-30 14:20:54 -08:00
Scott Graham
3162f1259c win: convert MinidumpSimpleStringDictionaryWriter to scoped_ptr
Had to move this one out to a scoped_ptr too, otherwise when
it's instantiated in test code on the stack,

d:\src\crashpad\crashpad\minidump\minidump_simple_string_dictionary_writer_test.cc(45) : warning C4815: 'dictionary_writer' : zero-sized array in stack object will have no elements (unless the object is an aggregate that has been aggregate initialized)

R=mark@chromium.org
BUG=crashpad:1

Review URL: https://codereview.chromium.org/895313004
2015-02-05 08:41:16 -08:00
Scott Graham
74a34e9c4b win: Resolve zero-length array errors on MSVC
In some cases, it's sufficient to move the zero-length array to the end of the
structure. When the struct is used inside a class that is derived from however,
this fails. In that case, switch to holding the object in a scoped_ptr.

Longer winded version: https://groups.google.com/a/chromium.org/d/msg/crashpad-dev/NGZ6LwRMORM/nKcXKQ7inIEJ

R=mark@chromium.org
BUG=crashpad:1

Review URL: https://codereview.chromium.org/896663006
2015-02-04 17:34:43 -08:00
Mark Mentovai
765e428321 minidump: Add InitializeFromSnapshot() for
MinidumpModuleCrashpadInfoListWriter and everything downstream.

TEST=minidump_test
R=rsesek@chromium.org

Review URL: https://codereview.chromium.org/683143003
2014-10-28 17:00:46 -04:00
Mark Mentovai
0a4ea0b52d minidump: Change the ownership model.
All minidump objects now own their all of their children, rather than
having them maintain weak pointers and requiring callers to maintain
ownership.

The only weak object in the entire tree now is the “extra memory” added
to a MinidumpMemoryListWriter by its AddExtraMemory() method. Extra
memory aliases objects owned elsewhere in the tree, typically by a
MinidumpThreadWriter as stack memory. Non-“extra” memory added to a
MinidumpMemoryListWriter by its AddMemory() method is strongly owned.

Many objects are now deleted through base pointers, and in those cases,
the base classes now have public virtual destructors. The ultimate base,
MinidumpWritable, is still protected to guard against direct
instantiation and deletion, and thus its destructor does not need to be
virtual.

This updates mini_chromium to eeb3b6a4f020 specifically for that
revision, which includes necessary updates to scoped_ptr. It also picks
up:

eeb3b6a4f020 Update base/move.h and base/memory/scoped_ptr.h to match
67ad2efafaba More porting to Windows
be27a006421e AUTHORS: Fix link post-git migration flag day.
05f5b1503230 Add codereview.settings to mini_chromium.
a32c2b199811 Beginnings of Windows support in mini_chromium

TEST=minidump_test
R=rsesek@chromium.org

Review URL: https://codereview.chromium.org/674153002
2014-10-27 15:01:39 -04:00
Mark Mentovai
38aeadc1c1 minidump: Use forward declarations in more places.
TEST=minidump_test
R=rsesek@chromium.org

Review URL: https://codereview.chromium.org/679443002
2014-10-23 18:47:27 -04:00
Mark Mentovai
dcdbd2098f minidump: Be consistent about setting the fields of WritableIoVec.
The iov_base field appears before the iov_len field, but for some
reason, sometimes the fields were being set in the reverse order.

TEST=minidump_test
R=rsesek@chromium.org

Review URL: https://codereview.chromium.org/678473003
2014-10-23 17:25:20 -04:00
Mark Mentovai
c9db1b1d19 Add MinidumpSimpleStringDictionaryWriter and its test.
TEST=minidump_test MinidumpSimpleStringDictionaryWriter.*
R=rsesek@chromium.org

Review URL: https://codereview.chromium.org/656173003
2014-10-16 18:09:18 -04:00