mirror of
https://github.com/chromium/crashpad.git
synced 2025-01-14 01:08:01 +08:00
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>
This commit is contained in:
parent
4c4e67952c
commit
7a849482ea
2
DEPS
2
DEPS
@ -38,7 +38,7 @@ deps = {
|
||||
|
||||
'crashpad/third_party/mini_chromium/mini_chromium':
|
||||
Var('chromium_git') + '/chromium/mini_chromium@' +
|
||||
'068fe690218f03a02c1cd34c9a0eb4bf3c814a6a',
|
||||
'7d6697ceb5cb5ca02fde3813496f48b9b1d76d0c',
|
||||
'crashpad/third_party/zlib/zlib':
|
||||
Var('chromium_git') + '/chromium/src/third_party/zlib@' +
|
||||
'13dc246a58e4b72104d35f9b1809af95221ebda7',
|
||||
|
@ -59,14 +59,14 @@ def main(args):
|
||||
|
||||
crashpad_dir_or_dot = crashpad_dir if crashpad_dir is not '' else os.curdir
|
||||
|
||||
(dependencies, mini_chromium_dir) = (ChooseDependencyPath(
|
||||
(dependencies, mini_chromium_common_gypi) = (ChooseDependencyPath(
|
||||
os.path.join(crashpad_dir, 'third_party', 'mini_chromium',
|
||||
'mini_chromium', 'build', 'common.gypi'),
|
||||
os.path.join(crashpad_dir, os.pardir, os.pardir, 'mini_chromium',
|
||||
'mini_chromium', 'build', 'common.gypi')))
|
||||
if dependencies is not None:
|
||||
args.extend(['-D', 'crashpad_dependencies=%s' % dependencies])
|
||||
args.extend(['--include', mini_chromium_dir])
|
||||
args.extend(['--include', mini_chromium_common_gypi])
|
||||
args.extend(['--depth', crashpad_dir_or_dot])
|
||||
args.append(os.path.join(crashpad_dir, 'crashpad.gyp'))
|
||||
|
||||
|
@ -18,7 +18,6 @@
|
||||
|
||||
#include "base/files/file_path.h"
|
||||
#include "base/macros.h"
|
||||
#include "base/memory/ptr_util.h"
|
||||
#include "base/logging.h"
|
||||
#include "gtest/gtest.h"
|
||||
#include "test/test_paths.h"
|
||||
|
@ -20,7 +20,6 @@
|
||||
#include <vector>
|
||||
|
||||
#include "base/logging.h"
|
||||
#include "base/memory/ptr_util.h"
|
||||
#include "build/build_config.h"
|
||||
|
||||
namespace crashpad {
|
||||
@ -70,10 +69,10 @@ void PruneCrashReportDatabase(CrashReportDatabase* database,
|
||||
std::unique_ptr<PruneCondition> PruneCondition::GetDefault() {
|
||||
// DatabaseSizePruneCondition must be the LHS so that it is always evaluated,
|
||||
// due to the short-circuting behavior of BinaryPruneCondition.
|
||||
return base::WrapUnique(
|
||||
new BinaryPruneCondition(BinaryPruneCondition::OR,
|
||||
new DatabaseSizePruneCondition(1024 * 128),
|
||||
new AgePruneCondition(365)));
|
||||
return std::make_unique<BinaryPruneCondition>(
|
||||
BinaryPruneCondition::OR,
|
||||
new DatabaseSizePruneCondition(1024 * 128),
|
||||
new AgePruneCondition(365));
|
||||
}
|
||||
|
||||
static const time_t kSecondsInDay = 60 * 60 * 24;
|
||||
|
@ -12,8 +12,9 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include "base/macros.h"
|
||||
#include "base/memory/ptr_util.h"
|
||||
#include "build/build_config.h"
|
||||
#include "handler/handler_main.h"
|
||||
#include "minidump/test/minidump_user_extension_stream_util.h"
|
||||
@ -41,14 +42,14 @@ TestUserStreamDataSource::ProduceStreamData(
|
||||
crashpad::ProcessSnapshot* process_snapshot) {
|
||||
static constexpr char kTestData[] = "Injected extension stream!";
|
||||
|
||||
return base::WrapUnique(new crashpad::test::BufferExtensionStreamDataSource(
|
||||
0xCAFEBABE, kTestData, sizeof(kTestData)));
|
||||
return std::make_unique<crashpad::test::BufferExtensionStreamDataSource>(
|
||||
0xCAFEBABE, kTestData, sizeof(kTestData));
|
||||
}
|
||||
|
||||
int ExtendedHandlerMain(int argc, char* argv[]) {
|
||||
crashpad::UserStreamDataSources user_stream_data_sources;
|
||||
user_stream_data_sources.push_back(
|
||||
base::WrapUnique(new TestUserStreamDataSource()));
|
||||
std::make_unique<TestUserStreamDataSource>());
|
||||
|
||||
return crashpad::HandlerMain(argc, argv, &user_stream_data_sources);
|
||||
}
|
||||
|
@ -17,7 +17,6 @@
|
||||
#include <utility>
|
||||
|
||||
#include "base/logging.h"
|
||||
#include "base/memory/ptr_util.h"
|
||||
#include "minidump/minidump_module_crashpad_info_writer.h"
|
||||
#include "minidump/minidump_simple_string_dictionary_writer.h"
|
||||
#include "snapshot/process_snapshot.h"
|
||||
@ -50,14 +49,14 @@ void MinidumpCrashpadInfoWriter::InitializeFromSnapshot(
|
||||
SetClientID(client_id);
|
||||
|
||||
auto simple_annotations =
|
||||
base::WrapUnique(new MinidumpSimpleStringDictionaryWriter());
|
||||
std::make_unique<MinidumpSimpleStringDictionaryWriter>();
|
||||
simple_annotations->InitializeFromMap(
|
||||
process_snapshot->AnnotationsSimpleMap());
|
||||
if (simple_annotations->IsUseful()) {
|
||||
SetSimpleAnnotations(std::move(simple_annotations));
|
||||
}
|
||||
|
||||
auto modules = base::WrapUnique(new MinidumpModuleCrashpadInfoListWriter());
|
||||
auto modules = std::make_unique<MinidumpModuleCrashpadInfoListWriter>();
|
||||
modules->InitializeFromSnapshot(process_snapshot->Modules());
|
||||
|
||||
if (modules->IsUseful()) {
|
||||
|
@ -21,7 +21,6 @@
|
||||
#include <string>
|
||||
#include <utility>
|
||||
|
||||
#include "base/memory/ptr_util.h"
|
||||
#include "gtest/gtest.h"
|
||||
#include "minidump/minidump_extensions.h"
|
||||
#include "minidump/minidump_file_writer.h"
|
||||
@ -66,8 +65,7 @@ void GetCrashpadInfoStream(
|
||||
|
||||
TEST(MinidumpCrashpadInfoWriter, Empty) {
|
||||
MinidumpFileWriter minidump_file_writer;
|
||||
auto crashpad_info_writer =
|
||||
base::WrapUnique(new MinidumpCrashpadInfoWriter());
|
||||
auto crashpad_info_writer = std::make_unique<MinidumpCrashpadInfoWriter>();
|
||||
EXPECT_FALSE(crashpad_info_writer->IsUseful());
|
||||
|
||||
ASSERT_TRUE(minidump_file_writer.AddStream(std::move(crashpad_info_writer)));
|
||||
@ -91,8 +89,7 @@ TEST(MinidumpCrashpadInfoWriter, Empty) {
|
||||
|
||||
TEST(MinidumpCrashpadInfoWriter, ReportAndClientID) {
|
||||
MinidumpFileWriter minidump_file_writer;
|
||||
auto crashpad_info_writer =
|
||||
base::WrapUnique(new MinidumpCrashpadInfoWriter());
|
||||
auto crashpad_info_writer = std::make_unique<MinidumpCrashpadInfoWriter>();
|
||||
|
||||
UUID report_id;
|
||||
ASSERT_TRUE(
|
||||
@ -127,8 +124,7 @@ TEST(MinidumpCrashpadInfoWriter, ReportAndClientID) {
|
||||
|
||||
TEST(MinidumpCrashpadInfoWriter, SimpleAnnotations) {
|
||||
MinidumpFileWriter minidump_file_writer;
|
||||
auto crashpad_info_writer =
|
||||
base::WrapUnique(new MinidumpCrashpadInfoWriter());
|
||||
auto crashpad_info_writer = std::make_unique<MinidumpCrashpadInfoWriter>();
|
||||
|
||||
static constexpr char kKey[] =
|
||||
"a thing that provides a means of gaining access to or understanding "
|
||||
@ -137,9 +133,9 @@ TEST(MinidumpCrashpadInfoWriter, SimpleAnnotations) {
|
||||
"the numerical amount denoted by an algebraic term; a magnitude, "
|
||||
"quantity, or number";
|
||||
auto simple_string_dictionary_writer =
|
||||
base::WrapUnique(new MinidumpSimpleStringDictionaryWriter());
|
||||
std::make_unique<MinidumpSimpleStringDictionaryWriter>();
|
||||
auto simple_string_dictionary_entry_writer =
|
||||
base::WrapUnique(new MinidumpSimpleStringDictionaryEntryWriter());
|
||||
std::make_unique<MinidumpSimpleStringDictionaryEntryWriter>();
|
||||
simple_string_dictionary_entry_writer->SetKeyValue(kKey, kValue);
|
||||
simple_string_dictionary_writer->AddEntry(
|
||||
std::move(simple_string_dictionary_entry_writer));
|
||||
@ -177,12 +173,11 @@ TEST(MinidumpCrashpadInfoWriter, CrashpadModuleList) {
|
||||
constexpr uint32_t kMinidumpModuleListIndex = 3;
|
||||
|
||||
MinidumpFileWriter minidump_file_writer;
|
||||
auto crashpad_info_writer =
|
||||
base::WrapUnique(new MinidumpCrashpadInfoWriter());
|
||||
auto crashpad_info_writer = std::make_unique<MinidumpCrashpadInfoWriter>();
|
||||
|
||||
auto module_list_writer =
|
||||
base::WrapUnique(new MinidumpModuleCrashpadInfoListWriter());
|
||||
auto module_writer = base::WrapUnique(new MinidumpModuleCrashpadInfoWriter());
|
||||
std::make_unique<MinidumpModuleCrashpadInfoListWriter>();
|
||||
auto module_writer = std::make_unique<MinidumpModuleCrashpadInfoWriter>();
|
||||
module_list_writer->AddModule(std::move(module_writer),
|
||||
kMinidumpModuleListIndex);
|
||||
crashpad_info_writer->SetModuleList(std::move(module_list_writer));
|
||||
@ -236,12 +231,12 @@ TEST(MinidumpCrashpadInfoWriter, InitializeFromSnapshot) {
|
||||
|
||||
// Test with a useless module, one that doesn’t carry anything that would
|
||||
// require MinidumpCrashpadInfo or any child object.
|
||||
auto process_snapshot = base::WrapUnique(new TestProcessSnapshot());
|
||||
auto process_snapshot = std::make_unique<TestProcessSnapshot>();
|
||||
|
||||
auto module_snapshot = base::WrapUnique(new TestModuleSnapshot());
|
||||
auto module_snapshot = std::make_unique<TestModuleSnapshot>();
|
||||
process_snapshot->AddModule(std::move(module_snapshot));
|
||||
|
||||
auto info_writer = base::WrapUnique(new MinidumpCrashpadInfoWriter());
|
||||
auto info_writer = std::make_unique<MinidumpCrashpadInfoWriter>();
|
||||
info_writer->InitializeFromSnapshot(process_snapshot.get());
|
||||
EXPECT_FALSE(info_writer->IsUseful());
|
||||
|
||||
|
@ -17,13 +17,11 @@
|
||||
#include <string>
|
||||
#include <utility>
|
||||
|
||||
#include "base/memory/ptr_util.h"
|
||||
#include "gtest/gtest.h"
|
||||
#include "minidump/minidump_context.h"
|
||||
#include "minidump/minidump_context_writer.h"
|
||||
#include "minidump/minidump_extensions.h"
|
||||
#include "minidump/minidump_file_writer.h"
|
||||
#include "minidump/minidump_thread_id_map.h"
|
||||
#include "minidump/test/minidump_context_test_util.h"
|
||||
#include "minidump/test/minidump_file_writer_test_util.h"
|
||||
#include "minidump/test/minidump_writable_test_util.h"
|
||||
@ -94,11 +92,11 @@ void ExpectExceptionStream(const MINIDUMP_EXCEPTION_STREAM* expected,
|
||||
|
||||
TEST(MinidumpExceptionWriter, Minimal) {
|
||||
MinidumpFileWriter minidump_file_writer;
|
||||
auto exception_writer = base::WrapUnique(new MinidumpExceptionWriter());
|
||||
auto exception_writer = std::make_unique<MinidumpExceptionWriter>();
|
||||
|
||||
constexpr uint32_t kSeed = 100;
|
||||
|
||||
auto context_x86_writer = base::WrapUnique(new MinidumpContextX86Writer());
|
||||
auto context_x86_writer = std::make_unique<MinidumpContextX86Writer>();
|
||||
InitializeMinidumpContextX86(context_x86_writer->context(), kSeed);
|
||||
exception_writer->SetContext(std::move(context_x86_writer));
|
||||
|
||||
@ -126,7 +124,7 @@ TEST(MinidumpExceptionWriter, Minimal) {
|
||||
|
||||
TEST(MinidumpExceptionWriter, Standard) {
|
||||
MinidumpFileWriter minidump_file_writer;
|
||||
auto exception_writer = base::WrapUnique(new MinidumpExceptionWriter());
|
||||
auto exception_writer = std::make_unique<MinidumpExceptionWriter>();
|
||||
|
||||
constexpr uint32_t kSeed = 200;
|
||||
constexpr uint32_t kThreadID = 1;
|
||||
@ -138,7 +136,7 @@ TEST(MinidumpExceptionWriter, Standard) {
|
||||
constexpr uint64_t kExceptionInformation1 = 7;
|
||||
constexpr uint64_t kExceptionInformation2 = 7;
|
||||
|
||||
auto context_x86_writer = base::WrapUnique(new MinidumpContextX86Writer());
|
||||
auto context_x86_writer = std::make_unique<MinidumpContextX86Writer>();
|
||||
InitializeMinidumpContextX86(context_x86_writer->context(), kSeed);
|
||||
exception_writer->SetContext(std::move(context_x86_writer));
|
||||
|
||||
@ -230,7 +228,7 @@ TEST(MinidumpExceptionWriter, InitializeFromSnapshot) {
|
||||
MinidumpThreadIDMap thread_id_map;
|
||||
thread_id_map[kThreadID] = expect_exception.ThreadId;
|
||||
|
||||
auto exception_writer = base::WrapUnique(new MinidumpExceptionWriter());
|
||||
auto exception_writer = std::make_unique<MinidumpExceptionWriter>();
|
||||
exception_writer->InitializeFromSnapshot(&exception_snapshot, thread_id_map);
|
||||
|
||||
MinidumpFileWriter minidump_file_writer;
|
||||
@ -254,7 +252,7 @@ TEST(MinidumpExceptionWriter, InitializeFromSnapshot) {
|
||||
|
||||
TEST(MinidumpExceptionWriterDeathTest, NoContext) {
|
||||
MinidumpFileWriter minidump_file_writer;
|
||||
auto exception_writer = base::WrapUnique(new MinidumpExceptionWriter());
|
||||
auto exception_writer = std::make_unique<MinidumpExceptionWriter>();
|
||||
|
||||
ASSERT_TRUE(minidump_file_writer.AddStream(std::move(exception_writer)));
|
||||
|
||||
|
@ -17,7 +17,6 @@
|
||||
#include <utility>
|
||||
|
||||
#include "base/logging.h"
|
||||
#include "base/memory/ptr_util.h"
|
||||
#include "minidump/minidump_crashpad_info_writer.h"
|
||||
#include "minidump/minidump_exception_writer.h"
|
||||
#include "minidump/minidump_handle_writer.h"
|
||||
@ -73,18 +72,18 @@ void MinidumpFileWriter::InitializeFromSnapshot(
|
||||
SetTimestamp(snapshot_time.tv_sec);
|
||||
|
||||
const SystemSnapshot* system_snapshot = process_snapshot->System();
|
||||
auto system_info = base::WrapUnique(new MinidumpSystemInfoWriter());
|
||||
auto system_info = std::make_unique<MinidumpSystemInfoWriter>();
|
||||
system_info->InitializeFromSnapshot(system_snapshot);
|
||||
bool add_stream_result = AddStream(std::move(system_info));
|
||||
DCHECK(add_stream_result);
|
||||
|
||||
auto misc_info = base::WrapUnique(new MinidumpMiscInfoWriter());
|
||||
auto misc_info = std::make_unique<MinidumpMiscInfoWriter>();
|
||||
misc_info->InitializeFromSnapshot(process_snapshot);
|
||||
add_stream_result = AddStream(std::move(misc_info));
|
||||
DCHECK(add_stream_result);
|
||||
|
||||
auto memory_list = base::WrapUnique(new MinidumpMemoryListWriter());
|
||||
auto thread_list = base::WrapUnique(new MinidumpThreadListWriter());
|
||||
auto memory_list = std::make_unique<MinidumpMemoryListWriter>();
|
||||
auto thread_list = std::make_unique<MinidumpThreadListWriter>();
|
||||
thread_list->SetMemoryListWriter(memory_list.get());
|
||||
MinidumpThreadIDMap thread_id_map;
|
||||
thread_list->InitializeFromSnapshot(process_snapshot->Threads(),
|
||||
@ -94,13 +93,13 @@ void MinidumpFileWriter::InitializeFromSnapshot(
|
||||
|
||||
const ExceptionSnapshot* exception_snapshot = process_snapshot->Exception();
|
||||
if (exception_snapshot) {
|
||||
auto exception = base::WrapUnique(new MinidumpExceptionWriter());
|
||||
auto exception = std::make_unique<MinidumpExceptionWriter>();
|
||||
exception->InitializeFromSnapshot(exception_snapshot, thread_id_map);
|
||||
add_stream_result = AddStream(std::move(exception));
|
||||
DCHECK(add_stream_result);
|
||||
}
|
||||
|
||||
auto module_list = base::WrapUnique(new MinidumpModuleListWriter());
|
||||
auto module_list = std::make_unique<MinidumpModuleListWriter>();
|
||||
module_list->InitializeFromSnapshot(process_snapshot->Modules());
|
||||
add_stream_result = AddStream(std::move(module_list));
|
||||
DCHECK(add_stream_result);
|
||||
@ -108,13 +107,13 @@ void MinidumpFileWriter::InitializeFromSnapshot(
|
||||
auto unloaded_modules = process_snapshot->UnloadedModules();
|
||||
if (!unloaded_modules.empty()) {
|
||||
auto unloaded_module_list =
|
||||
base::WrapUnique(new MinidumpUnloadedModuleListWriter());
|
||||
std::make_unique<MinidumpUnloadedModuleListWriter>();
|
||||
unloaded_module_list->InitializeFromSnapshot(unloaded_modules);
|
||||
add_stream_result = AddStream(std::move(unloaded_module_list));
|
||||
DCHECK(add_stream_result);
|
||||
}
|
||||
|
||||
auto crashpad_info = base::WrapUnique(new MinidumpCrashpadInfoWriter());
|
||||
auto crashpad_info = std::make_unique<MinidumpCrashpadInfoWriter>();
|
||||
crashpad_info->InitializeFromSnapshot(process_snapshot);
|
||||
|
||||
// Since the MinidumpCrashpadInfo stream is an extension, it’s safe to not add
|
||||
@ -127,8 +126,7 @@ void MinidumpFileWriter::InitializeFromSnapshot(
|
||||
std::vector<const MemoryMapRegionSnapshot*> memory_map_snapshot =
|
||||
process_snapshot->MemoryMap();
|
||||
if (!memory_map_snapshot.empty()) {
|
||||
auto memory_info_list =
|
||||
base::WrapUnique(new MinidumpMemoryInfoListWriter());
|
||||
auto memory_info_list = std::make_unique<MinidumpMemoryInfoListWriter>();
|
||||
memory_info_list->InitializeFromSnapshot(memory_map_snapshot);
|
||||
add_stream_result = AddStream(std::move(memory_info_list));
|
||||
DCHECK(add_stream_result);
|
||||
@ -136,7 +134,7 @@ void MinidumpFileWriter::InitializeFromSnapshot(
|
||||
|
||||
std::vector<HandleSnapshot> handles_snapshot = process_snapshot->Handles();
|
||||
if (!handles_snapshot.empty()) {
|
||||
auto handle_data_writer = base::WrapUnique(new MinidumpHandleDataWriter());
|
||||
auto handle_data_writer = std::make_unique<MinidumpHandleDataWriter>();
|
||||
handle_data_writer->InitializeFromSnapshot(handles_snapshot);
|
||||
add_stream_result = AddStream(std::move(handle_data_writer));
|
||||
DCHECK(add_stream_result);
|
||||
@ -160,7 +158,7 @@ void MinidumpFileWriter::InitializeFromSnapshot(
|
||||
<< stream->stream_type();
|
||||
continue;
|
||||
}
|
||||
auto user_stream = base::WrapUnique(new MinidumpUserStreamWriter());
|
||||
auto user_stream = std::make_unique<MinidumpUserStreamWriter>();
|
||||
user_stream->InitializeFromSnapshot(stream);
|
||||
AddStream(std::move(user_stream));
|
||||
}
|
||||
@ -205,7 +203,7 @@ bool MinidumpFileWriter::AddUserExtensionStream(
|
||||
user_extension_stream_data) {
|
||||
DCHECK_EQ(state(), kStateMutable);
|
||||
|
||||
auto user_stream = base::WrapUnique(new MinidumpUserStreamWriter());
|
||||
auto user_stream = std::make_unique<MinidumpUserStreamWriter>();
|
||||
user_stream->InitializeFromUserExtensionStream(
|
||||
std::move(user_extension_stream_data));
|
||||
|
||||
|
@ -21,12 +21,9 @@
|
||||
#include <utility>
|
||||
|
||||
#include "base/compiler_specific.h"
|
||||
#include "base/macros.h"
|
||||
#include "base/memory/ptr_util.h"
|
||||
#include "gtest/gtest.h"
|
||||
#include "minidump/minidump_stream_writer.h"
|
||||
#include "minidump/minidump_user_extension_stream_data_source.h"
|
||||
#include "minidump/minidump_writable.h"
|
||||
#include "minidump/test/minidump_file_writer_test_util.h"
|
||||
#include "minidump/test/minidump_user_extension_stream_util.h"
|
||||
#include "minidump/test/minidump_writable_test_util.h"
|
||||
@ -100,7 +97,7 @@ TEST(MinidumpFileWriter, OneStream) {
|
||||
static_cast<MinidumpStreamType>(0x4d);
|
||||
constexpr uint8_t kStreamValue = 0x5a;
|
||||
auto stream =
|
||||
base::WrapUnique(new TestStream(kStreamType, kStreamSize, kStreamValue));
|
||||
std::make_unique<TestStream>(kStreamType, kStreamSize, kStreamValue);
|
||||
ASSERT_TRUE(minidump_file.AddStream(std::move(stream)));
|
||||
|
||||
StringFile string_file;
|
||||
@ -141,13 +138,13 @@ TEST(MinidumpFileWriter, AddUserExtensionStream) {
|
||||
constexpr MinidumpStreamType kStreamType =
|
||||
static_cast<MinidumpStreamType>(0x4d);
|
||||
|
||||
auto data_source = base::WrapUnique(new test::BufferExtensionStreamDataSource(
|
||||
kStreamType, kStreamData, kStreamSize));
|
||||
auto data_source = std::make_unique<test::BufferExtensionStreamDataSource>(
|
||||
kStreamType, kStreamData, kStreamSize);
|
||||
ASSERT_TRUE(minidump_file.AddUserExtensionStream(std::move(data_source)));
|
||||
|
||||
// Adding the same stream type a second time should fail.
|
||||
data_source = base::WrapUnique(new test::BufferExtensionStreamDataSource(
|
||||
kStreamType, kStreamData, kStreamSize));
|
||||
data_source = std::make_unique<test::BufferExtensionStreamDataSource>(
|
||||
kStreamType, kStreamData, kStreamSize);
|
||||
ASSERT_FALSE(minidump_file.AddUserExtensionStream(std::move(data_source)));
|
||||
|
||||
StringFile string_file;
|
||||
@ -185,8 +182,8 @@ TEST(MinidumpFileWriter, AddEmptyUserExtensionStream) {
|
||||
constexpr MinidumpStreamType kStreamType =
|
||||
static_cast<MinidumpStreamType>(0x4d);
|
||||
|
||||
auto data_source = base::WrapUnique(
|
||||
new test::BufferExtensionStreamDataSource(kStreamType, nullptr, 0));
|
||||
auto data_source = std::make_unique<test::BufferExtensionStreamDataSource>(
|
||||
kStreamType, nullptr, 0);
|
||||
ASSERT_TRUE(minidump_file.AddUserExtensionStream(std::move(data_source)));
|
||||
|
||||
StringFile string_file;
|
||||
@ -219,8 +216,8 @@ TEST(MinidumpFileWriter, ThreeStreams) {
|
||||
constexpr MinidumpStreamType kStream0Type =
|
||||
static_cast<MinidumpStreamType>(0x6d);
|
||||
constexpr uint8_t kStream0Value = 0x5a;
|
||||
auto stream0 = base::WrapUnique(
|
||||
new TestStream(kStream0Type, kStream0Size, kStream0Value));
|
||||
auto stream0 =
|
||||
std::make_unique<TestStream>(kStream0Type, kStream0Size, kStream0Value);
|
||||
ASSERT_TRUE(minidump_file.AddStream(std::move(stream0)));
|
||||
|
||||
// Make the second stream’s type be a smaller quantity than the first stream’s
|
||||
@ -230,16 +227,16 @@ TEST(MinidumpFileWriter, ThreeStreams) {
|
||||
constexpr MinidumpStreamType kStream1Type =
|
||||
static_cast<MinidumpStreamType>(0x4d);
|
||||
constexpr uint8_t kStream1Value = 0xa5;
|
||||
auto stream1 = base::WrapUnique(
|
||||
new TestStream(kStream1Type, kStream1Size, kStream1Value));
|
||||
auto stream1 =
|
||||
std::make_unique<TestStream>(kStream1Type, kStream1Size, kStream1Value);
|
||||
ASSERT_TRUE(minidump_file.AddStream(std::move(stream1)));
|
||||
|
||||
constexpr size_t kStream2Size = 1;
|
||||
constexpr MinidumpStreamType kStream2Type =
|
||||
static_cast<MinidumpStreamType>(0x7e);
|
||||
constexpr uint8_t kStream2Value = 0x36;
|
||||
auto stream2 = base::WrapUnique(
|
||||
new TestStream(kStream2Type, kStream2Size, kStream2Value));
|
||||
auto stream2 =
|
||||
std::make_unique<TestStream>(kStream2Type, kStream2Size, kStream2Value);
|
||||
ASSERT_TRUE(minidump_file.AddStream(std::move(stream2)));
|
||||
|
||||
StringFile string_file;
|
||||
@ -309,7 +306,8 @@ TEST(MinidumpFileWriter, ZeroLengthStream) {
|
||||
constexpr size_t kStreamSize = 0;
|
||||
constexpr MinidumpStreamType kStreamType =
|
||||
static_cast<MinidumpStreamType>(0x4d);
|
||||
auto stream = base::WrapUnique(new TestStream(kStreamType, kStreamSize, 0));
|
||||
auto stream = std::make_unique<TestStream>(
|
||||
kStreamType, kStreamSize, static_cast<uint8_t>(0));
|
||||
ASSERT_TRUE(minidump_file.AddStream(std::move(stream)));
|
||||
|
||||
StringFile string_file;
|
||||
@ -340,12 +338,12 @@ TEST(MinidumpFileWriter, InitializeFromSnapshot_Basic) {
|
||||
TestProcessSnapshot process_snapshot;
|
||||
process_snapshot.SetSnapshotTime(kSnapshotTimeval);
|
||||
|
||||
auto system_snapshot = base::WrapUnique(new TestSystemSnapshot());
|
||||
auto system_snapshot = std::make_unique<TestSystemSnapshot>();
|
||||
system_snapshot->SetCPUArchitecture(kCPUArchitectureX86_64);
|
||||
system_snapshot->SetOperatingSystem(SystemSnapshot::kOperatingSystemMacOSX);
|
||||
process_snapshot.SetSystem(std::move(system_snapshot));
|
||||
|
||||
auto peb_snapshot = base::WrapUnique(new TestMemorySnapshot());
|
||||
auto peb_snapshot = std::make_unique<TestMemorySnapshot>();
|
||||
constexpr uint64_t kPebAddress = 0x07f90000;
|
||||
peb_snapshot->SetAddress(kPebAddress);
|
||||
constexpr size_t kPebSize = 0x280;
|
||||
@ -404,16 +402,16 @@ TEST(MinidumpFileWriter, InitializeFromSnapshot_Exception) {
|
||||
TestProcessSnapshot process_snapshot;
|
||||
process_snapshot.SetSnapshotTime(kSnapshotTimeval);
|
||||
|
||||
auto system_snapshot = base::WrapUnique(new TestSystemSnapshot());
|
||||
auto system_snapshot = std::make_unique<TestSystemSnapshot>();
|
||||
system_snapshot->SetCPUArchitecture(kCPUArchitectureX86_64);
|
||||
system_snapshot->SetOperatingSystem(SystemSnapshot::kOperatingSystemMacOSX);
|
||||
process_snapshot.SetSystem(std::move(system_snapshot));
|
||||
|
||||
auto thread_snapshot = base::WrapUnique(new TestThreadSnapshot());
|
||||
auto thread_snapshot = std::make_unique<TestThreadSnapshot>();
|
||||
InitializeCPUContextX86_64(thread_snapshot->MutableContext(), 5);
|
||||
process_snapshot.AddThread(std::move(thread_snapshot));
|
||||
|
||||
auto exception_snapshot = base::WrapUnique(new TestExceptionSnapshot());
|
||||
auto exception_snapshot = std::make_unique<TestExceptionSnapshot>();
|
||||
InitializeCPUContextX86_64(exception_snapshot->MutableContext(), 11);
|
||||
process_snapshot.SetException(std::move(exception_snapshot));
|
||||
|
||||
@ -421,7 +419,7 @@ TEST(MinidumpFileWriter, InitializeFromSnapshot_Exception) {
|
||||
// MinidumpModuleCrashpadInfo structure, so no such structure is expected to
|
||||
// be present, which will in turn suppress the addition of a
|
||||
// MinidumpCrashpadInfo stream.
|
||||
auto module_snapshot = base::WrapUnique(new TestModuleSnapshot());
|
||||
auto module_snapshot = std::make_unique<TestModuleSnapshot>();
|
||||
process_snapshot.AddModule(std::move(module_snapshot));
|
||||
|
||||
MinidumpFileWriter minidump_file_writer;
|
||||
@ -468,22 +466,22 @@ TEST(MinidumpFileWriter, InitializeFromSnapshot_CrashpadInfo) {
|
||||
TestProcessSnapshot process_snapshot;
|
||||
process_snapshot.SetSnapshotTime(kSnapshotTimeval);
|
||||
|
||||
auto system_snapshot = base::WrapUnique(new TestSystemSnapshot());
|
||||
auto system_snapshot = std::make_unique<TestSystemSnapshot>();
|
||||
system_snapshot->SetCPUArchitecture(kCPUArchitectureX86_64);
|
||||
system_snapshot->SetOperatingSystem(SystemSnapshot::kOperatingSystemMacOSX);
|
||||
process_snapshot.SetSystem(std::move(system_snapshot));
|
||||
|
||||
auto thread_snapshot = base::WrapUnique(new TestThreadSnapshot());
|
||||
auto thread_snapshot = std::make_unique<TestThreadSnapshot>();
|
||||
InitializeCPUContextX86_64(thread_snapshot->MutableContext(), 5);
|
||||
process_snapshot.AddThread(std::move(thread_snapshot));
|
||||
|
||||
auto exception_snapshot = base::WrapUnique(new TestExceptionSnapshot());
|
||||
auto exception_snapshot = std::make_unique<TestExceptionSnapshot>();
|
||||
InitializeCPUContextX86_64(exception_snapshot->MutableContext(), 11);
|
||||
process_snapshot.SetException(std::move(exception_snapshot));
|
||||
|
||||
// The module needs an annotation for the MinidumpCrashpadInfo stream to be
|
||||
// considered useful and be included.
|
||||
auto module_snapshot = base::WrapUnique(new TestModuleSnapshot());
|
||||
auto module_snapshot = std::make_unique<TestModuleSnapshot>();
|
||||
std::vector<std::string> annotations_list(1, std::string("annotation"));
|
||||
module_snapshot->SetAnnotationsVector(annotations_list);
|
||||
process_snapshot.AddModule(std::move(module_snapshot));
|
||||
@ -536,15 +534,15 @@ TEST(MinidumpFileWriter, SameStreamType) {
|
||||
constexpr MinidumpStreamType kStreamType =
|
||||
static_cast<MinidumpStreamType>(0x4d);
|
||||
constexpr uint8_t kStream0Value = 0x5a;
|
||||
auto stream0 = base::WrapUnique(
|
||||
new TestStream(kStreamType, kStream0Size, kStream0Value));
|
||||
auto stream0 =
|
||||
std::make_unique<TestStream>(kStreamType, kStream0Size, kStream0Value);
|
||||
ASSERT_TRUE(minidump_file.AddStream(std::move(stream0)));
|
||||
|
||||
// An attempt to add a second stream of the same type should fail.
|
||||
constexpr size_t kStream1Size = 5;
|
||||
constexpr uint8_t kStream1Value = 0xa5;
|
||||
auto stream1 = base::WrapUnique(
|
||||
new TestStream(kStreamType, kStream1Size, kStream1Value));
|
||||
auto stream1 =
|
||||
std::make_unique<TestStream>(kStreamType, kStream1Size, kStream1Value);
|
||||
ASSERT_FALSE(minidump_file.AddStream(std::move(stream1)));
|
||||
|
||||
StringFile string_file;
|
||||
|
@ -14,10 +14,10 @@
|
||||
|
||||
#include "minidump/minidump_handle_writer.h"
|
||||
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <utility>
|
||||
|
||||
#include "base/memory/ptr_util.h"
|
||||
#include "base/strings/utf_string_conversions.h"
|
||||
#include "gtest/gtest.h"
|
||||
#include "minidump/minidump_file_writer.h"
|
||||
@ -58,7 +58,7 @@ void GetHandleDataStream(
|
||||
|
||||
TEST(MinidumpHandleDataWriter, Empty) {
|
||||
MinidumpFileWriter minidump_file_writer;
|
||||
auto handle_data_writer = base::WrapUnique(new MinidumpHandleDataWriter());
|
||||
auto handle_data_writer = std::make_unique<MinidumpHandleDataWriter>();
|
||||
ASSERT_TRUE(minidump_file_writer.AddStream(std::move(handle_data_writer)));
|
||||
|
||||
StringFile string_file;
|
||||
@ -77,7 +77,7 @@ TEST(MinidumpHandleDataWriter, Empty) {
|
||||
|
||||
TEST(MinidumpHandleDataWriter, OneHandle) {
|
||||
MinidumpFileWriter minidump_file_writer;
|
||||
auto handle_data_writer = base::WrapUnique(new MinidumpHandleDataWriter());
|
||||
auto handle_data_writer = std::make_unique<MinidumpHandleDataWriter>();
|
||||
|
||||
HandleSnapshot handle_snapshot;
|
||||
handle_snapshot.handle = 0x1234;
|
||||
@ -126,7 +126,7 @@ TEST(MinidumpHandleDataWriter, OneHandle) {
|
||||
|
||||
TEST(MinidumpHandleDataWriter, RepeatedTypeName) {
|
||||
MinidumpFileWriter minidump_file_writer;
|
||||
auto handle_data_writer = base::WrapUnique(new MinidumpHandleDataWriter());
|
||||
auto handle_data_writer = std::make_unique<MinidumpHandleDataWriter>();
|
||||
|
||||
HandleSnapshot handle_snapshot;
|
||||
handle_snapshot.handle = 0x1234;
|
||||
|
@ -14,10 +14,10 @@
|
||||
|
||||
#include "minidump/minidump_memory_info_writer.h"
|
||||
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <utility>
|
||||
|
||||
#include "base/memory/ptr_util.h"
|
||||
#include "gtest/gtest.h"
|
||||
#include "minidump/minidump_file_writer.h"
|
||||
#include "minidump/test/minidump_file_writer_test_util.h"
|
||||
@ -59,7 +59,7 @@ void GetMemoryInfoListStream(
|
||||
TEST(MinidumpMemoryInfoWriter, Empty) {
|
||||
MinidumpFileWriter minidump_file_writer;
|
||||
auto memory_info_list_writer =
|
||||
base::WrapUnique(new MinidumpMemoryInfoListWriter());
|
||||
std::make_unique<MinidumpMemoryInfoListWriter>();
|
||||
ASSERT_TRUE(
|
||||
minidump_file_writer.AddStream(std::move(memory_info_list_writer)));
|
||||
|
||||
@ -80,9 +80,9 @@ TEST(MinidumpMemoryInfoWriter, Empty) {
|
||||
TEST(MinidumpMemoryInfoWriter, OneRegion) {
|
||||
MinidumpFileWriter minidump_file_writer;
|
||||
auto memory_info_list_writer =
|
||||
base::WrapUnique(new MinidumpMemoryInfoListWriter());
|
||||
std::make_unique<MinidumpMemoryInfoListWriter>();
|
||||
|
||||
auto memory_map_region = base::WrapUnique(new TestMemoryMapRegionSnapshot());
|
||||
auto memory_map_region = std::make_unique<TestMemoryMapRegionSnapshot>();
|
||||
|
||||
MINIDUMP_MEMORY_INFO mmi = {0};
|
||||
mmi.BaseAddress = 0x12340000;
|
||||
|
@ -18,8 +18,6 @@
|
||||
|
||||
#include "base/auto_reset.h"
|
||||
#include "base/logging.h"
|
||||
#include "base/memory/ptr_util.h"
|
||||
#include "snapshot/memory_snapshot.h"
|
||||
#include "util/file/file_writer.h"
|
||||
#include "util/numeric/safe_assignment.h"
|
||||
|
||||
|
@ -17,19 +17,15 @@
|
||||
#include <utility>
|
||||
|
||||
#include "base/format_macros.h"
|
||||
#include "base/macros.h"
|
||||
#include "base/memory/ptr_util.h"
|
||||
#include "base/strings/stringprintf.h"
|
||||
#include "gtest/gtest.h"
|
||||
#include "minidump/minidump_extensions.h"
|
||||
#include "minidump/minidump_file_writer.h"
|
||||
#include "minidump/minidump_stream_writer.h"
|
||||
#include "minidump/test/minidump_file_writer_test_util.h"
|
||||
#include "minidump/test/minidump_memory_writer_test_util.h"
|
||||
#include "minidump/test/minidump_writable_test_util.h"
|
||||
#include "snapshot/test/test_memory_snapshot.h"
|
||||
#include "util/file/string_file.h"
|
||||
#include "util/stdlib/pointer_container.h"
|
||||
|
||||
namespace crashpad {
|
||||
namespace test {
|
||||
@ -77,7 +73,7 @@ void GetMemoryListStream(const std::string& file_contents,
|
||||
|
||||
TEST(MinidumpMemoryWriter, EmptyMemoryList) {
|
||||
MinidumpFileWriter minidump_file_writer;
|
||||
auto memory_list_writer = base::WrapUnique(new MinidumpMemoryListWriter());
|
||||
auto memory_list_writer = std::make_unique<MinidumpMemoryListWriter>();
|
||||
|
||||
ASSERT_TRUE(minidump_file_writer.AddStream(std::move(memory_list_writer)));
|
||||
|
||||
@ -97,14 +93,14 @@ TEST(MinidumpMemoryWriter, EmptyMemoryList) {
|
||||
|
||||
TEST(MinidumpMemoryWriter, OneMemoryRegion) {
|
||||
MinidumpFileWriter minidump_file_writer;
|
||||
auto memory_list_writer = base::WrapUnique(new MinidumpMemoryListWriter());
|
||||
auto memory_list_writer = std::make_unique<MinidumpMemoryListWriter>();
|
||||
|
||||
constexpr uint64_t kBaseAddress = 0xfedcba9876543210;
|
||||
constexpr uint64_t kSize = 0x1000;
|
||||
constexpr size_t kSize = 0x1000;
|
||||
constexpr uint8_t kValue = 'm';
|
||||
|
||||
auto memory_writer = base::WrapUnique(
|
||||
new TestMinidumpMemoryWriter(kBaseAddress, kSize, kValue));
|
||||
auto memory_writer =
|
||||
std::make_unique<TestMinidumpMemoryWriter>(kBaseAddress, kSize, kValue);
|
||||
memory_list_writer->AddMemory(std::move(memory_writer));
|
||||
|
||||
ASSERT_TRUE(minidump_file_writer.AddStream(std::move(memory_list_writer)));
|
||||
@ -132,20 +128,20 @@ TEST(MinidumpMemoryWriter, OneMemoryRegion) {
|
||||
|
||||
TEST(MinidumpMemoryWriter, TwoMemoryRegions) {
|
||||
MinidumpFileWriter minidump_file_writer;
|
||||
auto memory_list_writer = base::WrapUnique(new MinidumpMemoryListWriter());
|
||||
auto memory_list_writer = std::make_unique<MinidumpMemoryListWriter>();
|
||||
|
||||
constexpr uint64_t kBaseAddress0 = 0xc0ffee;
|
||||
constexpr uint64_t kSize0 = 0x0100;
|
||||
constexpr size_t kSize0 = 0x0100;
|
||||
constexpr uint8_t kValue0 = '6';
|
||||
constexpr uint64_t kBaseAddress1 = 0xfac00fac;
|
||||
constexpr uint64_t kSize1 = 0x0200;
|
||||
constexpr size_t kSize1 = 0x0200;
|
||||
constexpr uint8_t kValue1 = '!';
|
||||
|
||||
auto memory_writer_0 = base::WrapUnique(
|
||||
new TestMinidumpMemoryWriter(kBaseAddress0, kSize0, kValue0));
|
||||
auto memory_writer_0 = std::make_unique<TestMinidumpMemoryWriter>(
|
||||
kBaseAddress0, kSize0, kValue0);
|
||||
memory_list_writer->AddMemory(std::move(memory_writer_0));
|
||||
auto memory_writer_1 = base::WrapUnique(
|
||||
new TestMinidumpMemoryWriter(kBaseAddress1, kSize1, kValue1));
|
||||
auto memory_writer_1 = std::make_unique<TestMinidumpMemoryWriter>(
|
||||
kBaseAddress1, kSize1, kValue1);
|
||||
memory_list_writer->AddMemory(std::move(memory_writer_1));
|
||||
|
||||
ASSERT_TRUE(minidump_file_writer.AddStream(std::move(memory_list_writer)));
|
||||
@ -242,9 +238,9 @@ TEST(MinidumpMemoryWriter, ExtraMemory) {
|
||||
constexpr size_t kSize0 = 0x0400;
|
||||
constexpr uint8_t kValue0 = '1';
|
||||
auto test_memory_stream =
|
||||
base::WrapUnique(new TestMemoryStream(kBaseAddress0, kSize0, kValue0));
|
||||
std::make_unique<TestMemoryStream>(kBaseAddress0, kSize0, kValue0);
|
||||
|
||||
auto memory_list_writer = base::WrapUnique(new MinidumpMemoryListWriter());
|
||||
auto memory_list_writer = std::make_unique<MinidumpMemoryListWriter>();
|
||||
memory_list_writer->AddExtraMemory(test_memory_stream->memory());
|
||||
|
||||
ASSERT_TRUE(minidump_file_writer.AddStream(std::move(test_memory_stream)));
|
||||
@ -253,8 +249,8 @@ TEST(MinidumpMemoryWriter, ExtraMemory) {
|
||||
constexpr size_t kSize1 = 0x0400;
|
||||
constexpr uint8_t kValue1 = 'm';
|
||||
|
||||
auto memory_writer = base::WrapUnique(
|
||||
new TestMinidumpMemoryWriter(kBaseAddress1, kSize1, kValue1));
|
||||
auto memory_writer = std::make_unique<TestMinidumpMemoryWriter>(
|
||||
kBaseAddress1, kSize1, kValue1);
|
||||
memory_list_writer->AddMemory(std::move(memory_writer));
|
||||
|
||||
ASSERT_TRUE(minidump_file_writer.AddStream(std::move(memory_list_writer)));
|
||||
@ -331,7 +327,7 @@ TEST(MinidumpMemoryWriter, AddFromSnapshot) {
|
||||
memory_snapshots.push_back(memory_snapshot);
|
||||
}
|
||||
|
||||
auto memory_list_writer = base::WrapUnique(new MinidumpMemoryListWriter());
|
||||
auto memory_list_writer = std::make_unique<MinidumpMemoryListWriter>();
|
||||
memory_list_writer->AddFromSnapshot(memory_snapshots);
|
||||
|
||||
MinidumpFileWriter minidump_file_writer;
|
||||
|
@ -16,14 +16,11 @@
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <utility>
|
||||
|
||||
#include "base/compiler_specific.h"
|
||||
#include "base/format_macros.h"
|
||||
#include "base/macros.h"
|
||||
#include "base/memory/ptr_util.h"
|
||||
#include "base/strings/string16.h"
|
||||
#include "base/strings/stringprintf.h"
|
||||
#include "base/strings/utf_string_conversions.h"
|
||||
@ -192,7 +189,7 @@ void ExpectMiscInfoEqual<MINIDUMP_MISC_INFO_5>(
|
||||
|
||||
TEST(MinidumpMiscInfoWriter, Empty) {
|
||||
MinidumpFileWriter minidump_file_writer;
|
||||
auto misc_info_writer = base::WrapUnique(new MinidumpMiscInfoWriter());
|
||||
auto misc_info_writer = std::make_unique<MinidumpMiscInfoWriter>();
|
||||
|
||||
ASSERT_TRUE(minidump_file_writer.AddStream(std::move(misc_info_writer)));
|
||||
|
||||
@ -209,7 +206,7 @@ TEST(MinidumpMiscInfoWriter, Empty) {
|
||||
|
||||
TEST(MinidumpMiscInfoWriter, ProcessId) {
|
||||
MinidumpFileWriter minidump_file_writer;
|
||||
auto misc_info_writer = base::WrapUnique(new MinidumpMiscInfoWriter());
|
||||
auto misc_info_writer = std::make_unique<MinidumpMiscInfoWriter>();
|
||||
|
||||
constexpr uint32_t kProcessId = 12345;
|
||||
|
||||
@ -232,7 +229,7 @@ TEST(MinidumpMiscInfoWriter, ProcessId) {
|
||||
|
||||
TEST(MinidumpMiscInfoWriter, ProcessTimes) {
|
||||
MinidumpFileWriter minidump_file_writer;
|
||||
auto misc_info_writer = base::WrapUnique(new MinidumpMiscInfoWriter());
|
||||
auto misc_info_writer = std::make_unique<MinidumpMiscInfoWriter>();
|
||||
|
||||
constexpr time_t kProcessCreateTime = 0x15252f00;
|
||||
constexpr uint32_t kProcessUserTime = 10;
|
||||
@ -260,7 +257,7 @@ TEST(MinidumpMiscInfoWriter, ProcessTimes) {
|
||||
|
||||
TEST(MinidumpMiscInfoWriter, ProcessorPowerInfo) {
|
||||
MinidumpFileWriter minidump_file_writer;
|
||||
auto misc_info_writer = base::WrapUnique(new MinidumpMiscInfoWriter());
|
||||
auto misc_info_writer = std::make_unique<MinidumpMiscInfoWriter>();
|
||||
|
||||
constexpr uint32_t kProcessorMaxMhz = 2800;
|
||||
constexpr uint32_t kProcessorCurrentMhz = 2300;
|
||||
@ -295,7 +292,7 @@ TEST(MinidumpMiscInfoWriter, ProcessorPowerInfo) {
|
||||
|
||||
TEST(MinidumpMiscInfoWriter, ProcessIntegrityLevel) {
|
||||
MinidumpFileWriter minidump_file_writer;
|
||||
auto misc_info_writer = base::WrapUnique(new MinidumpMiscInfoWriter());
|
||||
auto misc_info_writer = std::make_unique<MinidumpMiscInfoWriter>();
|
||||
|
||||
constexpr uint32_t kProcessIntegrityLevel = 0x2000;
|
||||
|
||||
@ -318,7 +315,7 @@ TEST(MinidumpMiscInfoWriter, ProcessIntegrityLevel) {
|
||||
|
||||
TEST(MinidumpMiscInfoWriter, ProcessExecuteFlags) {
|
||||
MinidumpFileWriter minidump_file_writer;
|
||||
auto misc_info_writer = base::WrapUnique(new MinidumpMiscInfoWriter());
|
||||
auto misc_info_writer = std::make_unique<MinidumpMiscInfoWriter>();
|
||||
|
||||
constexpr uint32_t kProcessExecuteFlags = 0x13579bdf;
|
||||
|
||||
@ -341,7 +338,7 @@ TEST(MinidumpMiscInfoWriter, ProcessExecuteFlags) {
|
||||
|
||||
TEST(MinidumpMiscInfoWriter, ProtectedProcess) {
|
||||
MinidumpFileWriter minidump_file_writer;
|
||||
auto misc_info_writer = base::WrapUnique(new MinidumpMiscInfoWriter());
|
||||
auto misc_info_writer = std::make_unique<MinidumpMiscInfoWriter>();
|
||||
|
||||
constexpr uint32_t kProtectedProcess = 1;
|
||||
|
||||
@ -364,7 +361,7 @@ TEST(MinidumpMiscInfoWriter, ProtectedProcess) {
|
||||
|
||||
TEST(MinidumpMiscInfoWriter, TimeZone) {
|
||||
MinidumpFileWriter minidump_file_writer;
|
||||
auto misc_info_writer = base::WrapUnique(new MinidumpMiscInfoWriter());
|
||||
auto misc_info_writer = std::make_unique<MinidumpMiscInfoWriter>();
|
||||
|
||||
constexpr uint32_t kTimeZoneId = 2;
|
||||
constexpr int32_t kBias = 300;
|
||||
@ -421,7 +418,7 @@ TEST(MinidumpMiscInfoWriter, TimeZoneStringsOverflow) {
|
||||
// to the widths of their fields.
|
||||
|
||||
MinidumpFileWriter minidump_file_writer;
|
||||
auto misc_info_writer = base::WrapUnique(new MinidumpMiscInfoWriter());
|
||||
auto misc_info_writer = std::make_unique<MinidumpMiscInfoWriter>();
|
||||
|
||||
constexpr uint32_t kTimeZoneId = 2;
|
||||
constexpr int32_t kBias = 300;
|
||||
@ -480,7 +477,7 @@ TEST(MinidumpMiscInfoWriter, TimeZoneStringsOverflow) {
|
||||
|
||||
TEST(MinidumpMiscInfoWriter, BuildStrings) {
|
||||
MinidumpFileWriter minidump_file_writer;
|
||||
auto misc_info_writer = base::WrapUnique(new MinidumpMiscInfoWriter());
|
||||
auto misc_info_writer = std::make_unique<MinidumpMiscInfoWriter>();
|
||||
|
||||
static constexpr char kBuildString[] = "build string";
|
||||
static constexpr char kDebugBuildString[] = "debug build string";
|
||||
@ -515,7 +512,7 @@ TEST(MinidumpMiscInfoWriter, BuildStringsOverflow) {
|
||||
// widths of their fields.
|
||||
|
||||
MinidumpFileWriter minidump_file_writer;
|
||||
auto misc_info_writer = base::WrapUnique(new MinidumpMiscInfoWriter());
|
||||
auto misc_info_writer = std::make_unique<MinidumpMiscInfoWriter>();
|
||||
|
||||
MINIDUMP_MISC_INFO_N tmp;
|
||||
ALLOW_UNUSED_LOCAL(tmp);
|
||||
@ -549,7 +546,7 @@ TEST(MinidumpMiscInfoWriter, BuildStringsOverflow) {
|
||||
|
||||
TEST(MinidumpMiscInfoWriter, XStateData) {
|
||||
MinidumpFileWriter minidump_file_writer;
|
||||
auto misc_info_writer = base::WrapUnique(new MinidumpMiscInfoWriter());
|
||||
auto misc_info_writer = std::make_unique<MinidumpMiscInfoWriter>();
|
||||
|
||||
constexpr XSTATE_CONFIG_FEATURE_MSC_INFO kXStateData = {
|
||||
sizeof(XSTATE_CONFIG_FEATURE_MSC_INFO),
|
||||
@ -583,7 +580,7 @@ TEST(MinidumpMiscInfoWriter, XStateData) {
|
||||
|
||||
TEST(MinidumpMiscInfoWriter, ProcessCookie) {
|
||||
MinidumpFileWriter minidump_file_writer;
|
||||
auto misc_info_writer = base::WrapUnique(new MinidumpMiscInfoWriter());
|
||||
auto misc_info_writer = std::make_unique<MinidumpMiscInfoWriter>();
|
||||
|
||||
constexpr uint32_t kProcessCookie = 0x12345678;
|
||||
|
||||
@ -606,7 +603,7 @@ TEST(MinidumpMiscInfoWriter, ProcessCookie) {
|
||||
|
||||
TEST(MinidumpMiscInfoWriter, Everything) {
|
||||
MinidumpFileWriter minidump_file_writer;
|
||||
auto misc_info_writer = base::WrapUnique(new MinidumpMiscInfoWriter());
|
||||
auto misc_info_writer = std::make_unique<MinidumpMiscInfoWriter>();
|
||||
|
||||
constexpr uint32_t kProcessId = 12345;
|
||||
constexpr time_t kProcessCreateTime = 0x15252f00;
|
||||
@ -772,7 +769,7 @@ TEST(MinidumpMiscInfoWriter, InitializeFromSnapshot) {
|
||||
process_snapshot.SetProcessStartTime(kStartTime);
|
||||
process_snapshot.SetProcessCPUTimes(kUserCPUTime, kSystemCPUTime);
|
||||
|
||||
auto system_snapshot = base::WrapUnique(new TestSystemSnapshot());
|
||||
auto system_snapshot = std::make_unique<TestSystemSnapshot>();
|
||||
constexpr uint64_t kHzPerMHz = static_cast<uint64_t>(1E6);
|
||||
system_snapshot->SetCPUFrequency(
|
||||
expect_misc_info.ProcessorCurrentMhz * kHzPerMHz,
|
||||
@ -788,7 +785,7 @@ TEST(MinidumpMiscInfoWriter, InitializeFromSnapshot) {
|
||||
|
||||
process_snapshot.SetSystem(std::move(system_snapshot));
|
||||
|
||||
auto misc_info_writer = base::WrapUnique(new MinidumpMiscInfoWriter());
|
||||
auto misc_info_writer = std::make_unique<MinidumpMiscInfoWriter>();
|
||||
misc_info_writer->InitializeFromSnapshot(&process_snapshot);
|
||||
|
||||
MinidumpFileWriter minidump_file_writer;
|
||||
|
@ -17,7 +17,6 @@
|
||||
#include <utility>
|
||||
|
||||
#include "base/logging.h"
|
||||
#include "base/memory/ptr_util.h"
|
||||
#include "minidump/minidump_simple_string_dictionary_writer.h"
|
||||
#include "snapshot/module_snapshot.h"
|
||||
#include "util/file/file_writer.h"
|
||||
@ -42,14 +41,14 @@ void MinidumpModuleCrashpadInfoWriter::InitializeFromSnapshot(
|
||||
DCHECK(!list_annotations_);
|
||||
DCHECK(!simple_annotations_);
|
||||
|
||||
auto list_annotations = base::WrapUnique(new MinidumpUTF8StringListWriter());
|
||||
auto list_annotations = std::make_unique<MinidumpUTF8StringListWriter>();
|
||||
list_annotations->InitializeFromVector(module_snapshot->AnnotationsVector());
|
||||
if (list_annotations->IsUseful()) {
|
||||
SetListAnnotations(std::move(list_annotations));
|
||||
}
|
||||
|
||||
auto simple_annotations =
|
||||
base::WrapUnique(new MinidumpSimpleStringDictionaryWriter());
|
||||
std::make_unique<MinidumpSimpleStringDictionaryWriter>();
|
||||
simple_annotations->InitializeFromMap(
|
||||
module_snapshot->AnnotationsSimpleMap());
|
||||
if (simple_annotations->IsUseful()) {
|
||||
@ -142,7 +141,7 @@ void MinidumpModuleCrashpadInfoListWriter::InitializeFromSnapshot(
|
||||
for (size_t index = 0; index < count; ++index) {
|
||||
const ModuleSnapshot* module_snapshot = module_snapshots[index];
|
||||
|
||||
auto module = base::WrapUnique(new MinidumpModuleCrashpadInfoWriter());
|
||||
auto module = std::make_unique<MinidumpModuleCrashpadInfoWriter>();
|
||||
module->InitializeFromSnapshot(module_snapshot);
|
||||
if (module->IsUseful()) {
|
||||
AddModule(std::move(module), index);
|
||||
|
@ -19,9 +19,7 @@
|
||||
|
||||
#include <utility>
|
||||
|
||||
#include "base/memory/ptr_util.h"
|
||||
#include "gtest/gtest.h"
|
||||
#include "minidump/minidump_extensions.h"
|
||||
#include "minidump/minidump_simple_string_dictionary_writer.h"
|
||||
#include "minidump/test/minidump_file_writer_test_util.h"
|
||||
#include "minidump/test/minidump_string_writer_test_util.h"
|
||||
@ -61,7 +59,7 @@ TEST(MinidumpModuleCrashpadInfoWriter, EmptyList) {
|
||||
StringFile string_file;
|
||||
|
||||
auto module_list_writer =
|
||||
base::WrapUnique(new MinidumpModuleCrashpadInfoListWriter());
|
||||
std::make_unique<MinidumpModuleCrashpadInfoListWriter>();
|
||||
EXPECT_FALSE(module_list_writer->IsUseful());
|
||||
|
||||
EXPECT_TRUE(module_list_writer->WriteEverything(&string_file));
|
||||
@ -77,8 +75,8 @@ TEST(MinidumpModuleCrashpadInfoWriter, EmptyModule) {
|
||||
StringFile string_file;
|
||||
|
||||
auto module_list_writer =
|
||||
base::WrapUnique(new MinidumpModuleCrashpadInfoListWriter());
|
||||
auto module_writer = base::WrapUnique(new MinidumpModuleCrashpadInfoWriter());
|
||||
std::make_unique<MinidumpModuleCrashpadInfoListWriter>();
|
||||
auto module_writer = std::make_unique<MinidumpModuleCrashpadInfoWriter>();
|
||||
EXPECT_FALSE(module_writer->IsUseful());
|
||||
module_list_writer->AddModule(std::move(module_writer), 0);
|
||||
|
||||
@ -117,17 +115,16 @@ TEST(MinidumpModuleCrashpadInfoWriter, FullModule) {
|
||||
StringFile string_file;
|
||||
|
||||
auto module_list_writer =
|
||||
base::WrapUnique(new MinidumpModuleCrashpadInfoListWriter());
|
||||
std::make_unique<MinidumpModuleCrashpadInfoListWriter>();
|
||||
|
||||
auto module_writer = base::WrapUnique(new MinidumpModuleCrashpadInfoWriter());
|
||||
auto string_list_writer =
|
||||
base::WrapUnique(new MinidumpUTF8StringListWriter());
|
||||
auto module_writer = std::make_unique<MinidumpModuleCrashpadInfoWriter>();
|
||||
auto string_list_writer = std::make_unique<MinidumpUTF8StringListWriter>();
|
||||
string_list_writer->InitializeFromVector(vector);
|
||||
module_writer->SetListAnnotations(std::move(string_list_writer));
|
||||
auto simple_string_dictionary_writer =
|
||||
base::WrapUnique(new MinidumpSimpleStringDictionaryWriter());
|
||||
std::make_unique<MinidumpSimpleStringDictionaryWriter>();
|
||||
auto simple_string_dictionary_entry_writer =
|
||||
base::WrapUnique(new MinidumpSimpleStringDictionaryEntryWriter());
|
||||
std::make_unique<MinidumpSimpleStringDictionaryEntryWriter>();
|
||||
simple_string_dictionary_entry_writer->SetKeyValue(kKey, kValue);
|
||||
simple_string_dictionary_writer->AddEntry(
|
||||
std::move(simple_string_dictionary_entry_writer));
|
||||
@ -207,14 +204,13 @@ TEST(MinidumpModuleCrashpadInfoWriter, ThreeModules) {
|
||||
StringFile string_file;
|
||||
|
||||
auto module_list_writer =
|
||||
base::WrapUnique(new MinidumpModuleCrashpadInfoListWriter());
|
||||
std::make_unique<MinidumpModuleCrashpadInfoListWriter>();
|
||||
|
||||
auto module_writer_0 =
|
||||
base::WrapUnique(new MinidumpModuleCrashpadInfoWriter());
|
||||
auto module_writer_0 = std::make_unique<MinidumpModuleCrashpadInfoWriter>();
|
||||
auto simple_string_dictionary_writer_0 =
|
||||
base::WrapUnique(new MinidumpSimpleStringDictionaryWriter());
|
||||
std::make_unique<MinidumpSimpleStringDictionaryWriter>();
|
||||
auto simple_string_dictionary_entry_writer_0 =
|
||||
base::WrapUnique(new MinidumpSimpleStringDictionaryEntryWriter());
|
||||
std::make_unique<MinidumpSimpleStringDictionaryEntryWriter>();
|
||||
simple_string_dictionary_entry_writer_0->SetKeyValue(kKey0, kValue0);
|
||||
simple_string_dictionary_writer_0->AddEntry(
|
||||
std::move(simple_string_dictionary_entry_writer_0));
|
||||
@ -224,23 +220,21 @@ TEST(MinidumpModuleCrashpadInfoWriter, ThreeModules) {
|
||||
module_list_writer->AddModule(std::move(module_writer_0),
|
||||
kMinidumpModuleListIndex0);
|
||||
|
||||
auto module_writer_1 =
|
||||
base::WrapUnique(new MinidumpModuleCrashpadInfoWriter());
|
||||
auto module_writer_1 = std::make_unique<MinidumpModuleCrashpadInfoWriter>();
|
||||
EXPECT_FALSE(module_writer_1->IsUseful());
|
||||
module_list_writer->AddModule(std::move(module_writer_1),
|
||||
kMinidumpModuleListIndex1);
|
||||
|
||||
auto module_writer_2 =
|
||||
base::WrapUnique(new MinidumpModuleCrashpadInfoWriter());
|
||||
auto module_writer_2 = std::make_unique<MinidumpModuleCrashpadInfoWriter>();
|
||||
auto simple_string_dictionary_writer_2 =
|
||||
base::WrapUnique(new MinidumpSimpleStringDictionaryWriter());
|
||||
std::make_unique<MinidumpSimpleStringDictionaryWriter>();
|
||||
auto simple_string_dictionary_entry_writer_2a =
|
||||
base::WrapUnique(new MinidumpSimpleStringDictionaryEntryWriter());
|
||||
std::make_unique<MinidumpSimpleStringDictionaryEntryWriter>();
|
||||
simple_string_dictionary_entry_writer_2a->SetKeyValue(kKey2A, kValue2A);
|
||||
simple_string_dictionary_writer_2->AddEntry(
|
||||
std::move(simple_string_dictionary_entry_writer_2a));
|
||||
auto simple_string_dictionary_entry_writer_2b =
|
||||
base::WrapUnique(new MinidumpSimpleStringDictionaryEntryWriter());
|
||||
std::make_unique<MinidumpSimpleStringDictionaryEntryWriter>();
|
||||
simple_string_dictionary_entry_writer_2b->SetKeyValue(kKey2B, kValue2B);
|
||||
simple_string_dictionary_writer_2->AddEntry(
|
||||
std::move(simple_string_dictionary_entry_writer_2b));
|
||||
@ -376,7 +370,7 @@ TEST(MinidumpModuleCrashpadInfoWriter, InitializeFromSnapshot) {
|
||||
module_snapshots.push_back(&module_snapshot_3);
|
||||
|
||||
auto module_list_writer =
|
||||
base::WrapUnique(new MinidumpModuleCrashpadInfoListWriter());
|
||||
std::make_unique<MinidumpModuleCrashpadInfoListWriter>();
|
||||
module_list_writer->InitializeFromSnapshot(module_snapshots);
|
||||
EXPECT_TRUE(module_list_writer->IsUseful());
|
||||
|
||||
|
@ -20,7 +20,6 @@
|
||||
#include <utility>
|
||||
|
||||
#include "base/logging.h"
|
||||
#include "base/memory/ptr_util.h"
|
||||
#include "base/numerics/safe_conversions.h"
|
||||
#include "minidump/minidump_string_writer.h"
|
||||
#include "minidump/minidump_writer_util.h"
|
||||
@ -244,7 +243,7 @@ void MinidumpModuleWriter::InitializeFromSnapshot(
|
||||
SetFileTypeAndSubtype(file_type, VFT2_UNKNOWN);
|
||||
|
||||
auto codeview_record =
|
||||
base::WrapUnique(new MinidumpModuleCodeViewRecordPDB70Writer());
|
||||
std::make_unique<MinidumpModuleCodeViewRecordPDB70Writer>();
|
||||
codeview_record->InitializeFromSnapshot(module_snapshot);
|
||||
SetCodeViewRecord(std::move(codeview_record));
|
||||
}
|
||||
@ -385,7 +384,7 @@ void MinidumpModuleListWriter::InitializeFromSnapshot(
|
||||
DCHECK(modules_.empty());
|
||||
|
||||
for (const ModuleSnapshot* module_snapshot : module_snapshots) {
|
||||
auto module = base::WrapUnique(new MinidumpModuleWriter());
|
||||
auto module = std::make_unique<MinidumpModuleWriter>();
|
||||
module->InitializeFromSnapshot(module_snapshot);
|
||||
AddModule(std::move(module));
|
||||
}
|
||||
|
@ -20,11 +20,9 @@
|
||||
#include <utility>
|
||||
|
||||
#include "base/format_macros.h"
|
||||
#include "base/memory/ptr_util.h"
|
||||
#include "base/strings/stringprintf.h"
|
||||
#include "base/strings/utf_string_conversions.h"
|
||||
#include "gtest/gtest.h"
|
||||
#include "minidump/minidump_extensions.h"
|
||||
#include "minidump/minidump_file_writer.h"
|
||||
#include "minidump/test/minidump_file_writer_test_util.h"
|
||||
#include "minidump/test/minidump_string_writer_test_util.h"
|
||||
@ -34,7 +32,6 @@
|
||||
#include "util/file/string_file.h"
|
||||
#include "util/misc/implicit_cast.h"
|
||||
#include "util/misc/uuid.h"
|
||||
#include "util/stdlib/pointer_container.h"
|
||||
|
||||
namespace crashpad {
|
||||
namespace test {
|
||||
@ -66,7 +63,7 @@ void GetModuleListStream(const std::string& file_contents,
|
||||
|
||||
TEST(MinidumpModuleWriter, EmptyModuleList) {
|
||||
MinidumpFileWriter minidump_file_writer;
|
||||
auto module_list_writer = base::WrapUnique(new MinidumpModuleListWriter());
|
||||
auto module_list_writer = std::make_unique<MinidumpModuleListWriter>();
|
||||
|
||||
ASSERT_TRUE(minidump_file_writer.AddStream(std::move(module_list_writer)));
|
||||
|
||||
@ -269,11 +266,11 @@ void ExpectModule(const MINIDUMP_MODULE* expected,
|
||||
|
||||
TEST(MinidumpModuleWriter, EmptyModule) {
|
||||
MinidumpFileWriter minidump_file_writer;
|
||||
auto module_list_writer = base::WrapUnique(new MinidumpModuleListWriter());
|
||||
auto module_list_writer = std::make_unique<MinidumpModuleListWriter>();
|
||||
|
||||
static constexpr char kModuleName[] = "test_executable";
|
||||
|
||||
auto module_writer = base::WrapUnique(new MinidumpModuleWriter());
|
||||
auto module_writer = std::make_unique<MinidumpModuleWriter>();
|
||||
module_writer->SetName(kModuleName);
|
||||
|
||||
module_list_writer->AddModule(std::move(module_writer));
|
||||
@ -308,7 +305,7 @@ TEST(MinidumpModuleWriter, EmptyModule) {
|
||||
|
||||
TEST(MinidumpModuleWriter, OneModule) {
|
||||
MinidumpFileWriter minidump_file_writer;
|
||||
auto module_list_writer = base::WrapUnique(new MinidumpModuleListWriter());
|
||||
auto module_list_writer = std::make_unique<MinidumpModuleListWriter>();
|
||||
|
||||
static constexpr char kModuleName[] = "statically_linked";
|
||||
constexpr uint64_t kModuleBase = 0x10da69000;
|
||||
@ -337,7 +334,7 @@ TEST(MinidumpModuleWriter, OneModule) {
|
||||
static constexpr char kDebugName[] = "statical.dbg";
|
||||
constexpr bool kDebugUTF16 = false;
|
||||
|
||||
auto module_writer = base::WrapUnique(new MinidumpModuleWriter());
|
||||
auto module_writer = std::make_unique<MinidumpModuleWriter>();
|
||||
module_writer->SetName(kModuleName);
|
||||
module_writer->SetImageBaseAddress(kModuleBase);
|
||||
module_writer->SetImageSize(kModuleSize);
|
||||
@ -356,13 +353,13 @@ TEST(MinidumpModuleWriter, OneModule) {
|
||||
module_writer->SetFileTypeAndSubtype(kFileType, kFileSubtype);
|
||||
|
||||
auto codeview_pdb70_writer =
|
||||
base::WrapUnique(new MinidumpModuleCodeViewRecordPDB70Writer());
|
||||
std::make_unique<MinidumpModuleCodeViewRecordPDB70Writer>();
|
||||
codeview_pdb70_writer->SetPDBName(kPDBName);
|
||||
codeview_pdb70_writer->SetUUIDAndAge(pdb_uuid, kPDBAge);
|
||||
module_writer->SetCodeViewRecord(std::move(codeview_pdb70_writer));
|
||||
|
||||
auto misc_debug_writer =
|
||||
base::WrapUnique(new MinidumpModuleMiscDebugRecordWriter());
|
||||
std::make_unique<MinidumpModuleMiscDebugRecordWriter>();
|
||||
misc_debug_writer->SetDataType(kDebugType);
|
||||
misc_debug_writer->SetData(kDebugName, kDebugUTF16);
|
||||
module_writer->SetMiscDebugRecord(std::move(misc_debug_writer));
|
||||
@ -417,7 +414,7 @@ TEST(MinidumpModuleWriter, OneModule_CodeViewUsesPDB20_MiscUsesUTF16) {
|
||||
// alternatives, a PDB 2.0 link as the CodeView record and an IMAGE_DEBUG_MISC
|
||||
// record with UTF-16 data.
|
||||
MinidumpFileWriter minidump_file_writer;
|
||||
auto module_list_writer = base::WrapUnique(new MinidumpModuleListWriter());
|
||||
auto module_list_writer = std::make_unique<MinidumpModuleListWriter>();
|
||||
|
||||
static constexpr char kModuleName[] = "dinosaur";
|
||||
static constexpr char kPDBName[] = "d1n05.pdb";
|
||||
@ -427,17 +424,17 @@ TEST(MinidumpModuleWriter, OneModule_CodeViewUsesPDB20_MiscUsesUTF16) {
|
||||
static constexpr char kDebugName[] = "d1n05.dbg";
|
||||
constexpr bool kDebugUTF16 = true;
|
||||
|
||||
auto module_writer = base::WrapUnique(new MinidumpModuleWriter());
|
||||
auto module_writer = std::make_unique<MinidumpModuleWriter>();
|
||||
module_writer->SetName(kModuleName);
|
||||
|
||||
auto codeview_pdb20_writer =
|
||||
base::WrapUnique(new MinidumpModuleCodeViewRecordPDB20Writer());
|
||||
std::make_unique<MinidumpModuleCodeViewRecordPDB20Writer>();
|
||||
codeview_pdb20_writer->SetPDBName(kPDBName);
|
||||
codeview_pdb20_writer->SetTimestampAndAge(kPDBTimestamp, kPDBAge);
|
||||
module_writer->SetCodeViewRecord(std::move(codeview_pdb20_writer));
|
||||
|
||||
auto misc_debug_writer =
|
||||
base::WrapUnique(new MinidumpModuleMiscDebugRecordWriter());
|
||||
std::make_unique<MinidumpModuleMiscDebugRecordWriter>();
|
||||
misc_debug_writer->SetDataType(kDebugType);
|
||||
misc_debug_writer->SetData(kDebugName, kDebugUTF16);
|
||||
module_writer->SetMiscDebugRecord(std::move(misc_debug_writer));
|
||||
@ -478,7 +475,7 @@ TEST(MinidumpModuleWriter, ThreeModules) {
|
||||
// its CodeView record, one with no CodeView record, and one with a PDB 2.0
|
||||
// link as its CodeView record.
|
||||
MinidumpFileWriter minidump_file_writer;
|
||||
auto module_list_writer = base::WrapUnique(new MinidumpModuleListWriter());
|
||||
auto module_list_writer = std::make_unique<MinidumpModuleListWriter>();
|
||||
|
||||
static constexpr char kModuleName0[] = "main";
|
||||
constexpr uint64_t kModuleBase0 = 0x100101000;
|
||||
@ -502,33 +499,33 @@ TEST(MinidumpModuleWriter, ThreeModules) {
|
||||
constexpr time_t kPDBTimestamp2 = 0x386d4380;
|
||||
constexpr uint32_t kPDBAge2 = 2;
|
||||
|
||||
auto module_writer_0 = base::WrapUnique(new MinidumpModuleWriter());
|
||||
auto module_writer_0 = std::make_unique<MinidumpModuleWriter>();
|
||||
module_writer_0->SetName(kModuleName0);
|
||||
module_writer_0->SetImageBaseAddress(kModuleBase0);
|
||||
module_writer_0->SetImageSize(kModuleSize0);
|
||||
|
||||
auto codeview_pdb70_writer_0 =
|
||||
base::WrapUnique(new MinidumpModuleCodeViewRecordPDB70Writer());
|
||||
std::make_unique<MinidumpModuleCodeViewRecordPDB70Writer>();
|
||||
codeview_pdb70_writer_0->SetPDBName(kPDBName0);
|
||||
codeview_pdb70_writer_0->SetUUIDAndAge(pdb_uuid_0, kPDBAge0);
|
||||
module_writer_0->SetCodeViewRecord(std::move(codeview_pdb70_writer_0));
|
||||
|
||||
module_list_writer->AddModule(std::move(module_writer_0));
|
||||
|
||||
auto module_writer_1 = base::WrapUnique(new MinidumpModuleWriter());
|
||||
auto module_writer_1 = std::make_unique<MinidumpModuleWriter>();
|
||||
module_writer_1->SetName(kModuleName1);
|
||||
module_writer_1->SetImageBaseAddress(kModuleBase1);
|
||||
module_writer_1->SetImageSize(kModuleSize1);
|
||||
|
||||
module_list_writer->AddModule(std::move(module_writer_1));
|
||||
|
||||
auto module_writer_2 = base::WrapUnique(new MinidumpModuleWriter());
|
||||
auto module_writer_2 = std::make_unique<MinidumpModuleWriter>();
|
||||
module_writer_2->SetName(kModuleName2);
|
||||
module_writer_2->SetImageBaseAddress(kModuleBase2);
|
||||
module_writer_2->SetImageSize(kModuleSize2);
|
||||
|
||||
auto codeview_pdb70_writer_2 =
|
||||
base::WrapUnique(new MinidumpModuleCodeViewRecordPDB20Writer());
|
||||
std::make_unique<MinidumpModuleCodeViewRecordPDB20Writer>();
|
||||
codeview_pdb70_writer_2->SetPDBName(kPDBName2);
|
||||
codeview_pdb70_writer_2->SetTimestampAndAge(kPDBTimestamp2, kPDBAge2);
|
||||
module_writer_2->SetCodeViewRecord(std::move(codeview_pdb70_writer_2));
|
||||
@ -720,7 +717,7 @@ TEST(MinidumpModuleWriter, InitializeFromSnapshot) {
|
||||
module_snapshots.push_back(module_snapshot);
|
||||
}
|
||||
|
||||
auto module_list_writer = base::WrapUnique(new MinidumpModuleListWriter());
|
||||
auto module_list_writer = std::make_unique<MinidumpModuleListWriter>();
|
||||
module_list_writer->InitializeFromSnapshot(module_snapshots);
|
||||
|
||||
MinidumpFileWriter minidump_file_writer;
|
||||
@ -753,8 +750,8 @@ TEST(MinidumpModuleWriter, InitializeFromSnapshot) {
|
||||
|
||||
TEST(MinidumpModuleWriterDeathTest, NoModuleName) {
|
||||
MinidumpFileWriter minidump_file_writer;
|
||||
auto module_list_writer = base::WrapUnique(new MinidumpModuleListWriter());
|
||||
auto module_writer = base::WrapUnique(new MinidumpModuleWriter());
|
||||
auto module_list_writer = std::make_unique<MinidumpModuleListWriter>();
|
||||
auto module_writer = std::make_unique<MinidumpModuleWriter>();
|
||||
module_list_writer->AddModule(std::move(module_writer));
|
||||
ASSERT_TRUE(minidump_file_writer.AddStream(std::move(module_list_writer)));
|
||||
|
||||
|
@ -17,7 +17,6 @@
|
||||
#include <utility>
|
||||
|
||||
#include "base/format_macros.h"
|
||||
#include "base/memory/ptr_util.h"
|
||||
#include "base/strings/stringprintf.h"
|
||||
#include "gtest/gtest.h"
|
||||
#include "minidump/test/minidump_rva_list_test_util.h"
|
||||
@ -34,7 +33,7 @@ class TestMinidumpRVAListWriter final : public internal::MinidumpRVAListWriter {
|
||||
~TestMinidumpRVAListWriter() override {}
|
||||
|
||||
void AddChild(uint32_t value) {
|
||||
auto child = base::WrapUnique(new TestUInt32MinidumpWritable(value));
|
||||
auto child = std::make_unique<TestUInt32MinidumpWritable>(value);
|
||||
MinidumpRVAListWriter::AddChild(std::move(child));
|
||||
}
|
||||
|
||||
|
@ -17,7 +17,6 @@
|
||||
#include <utility>
|
||||
|
||||
#include "base/logging.h"
|
||||
#include "base/memory/ptr_util.h"
|
||||
#include "util/file/file_writer.h"
|
||||
#include "util/numeric/safe_assignment.h"
|
||||
|
||||
@ -109,8 +108,7 @@ void MinidumpSimpleStringDictionaryWriter::InitializeFromMap(
|
||||
DCHECK(entries_.empty());
|
||||
|
||||
for (const auto& iterator : map) {
|
||||
auto entry =
|
||||
base::WrapUnique(new MinidumpSimpleStringDictionaryEntryWriter());
|
||||
auto entry = std::make_unique<MinidumpSimpleStringDictionaryEntryWriter>();
|
||||
entry->SetKeyValue(iterator.first, iterator.second);
|
||||
AddEntry(std::move(entry));
|
||||
}
|
||||
|
@ -16,13 +16,9 @@
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include <map>
|
||||
#include <string>
|
||||
#include <utility>
|
||||
|
||||
#include "base/memory/ptr_util.h"
|
||||
#include "gtest/gtest.h"
|
||||
#include "minidump/minidump_extensions.h"
|
||||
#include "minidump/test/minidump_string_writer_test_util.h"
|
||||
#include "minidump/test/minidump_writable_test_util.h"
|
||||
#include "util/file/string_file.h"
|
||||
@ -65,7 +61,7 @@ TEST(MinidumpSimpleStringDictionaryWriter, EmptyKeyValue) {
|
||||
|
||||
MinidumpSimpleStringDictionaryWriter dictionary_writer;
|
||||
auto entry_writer =
|
||||
base::WrapUnique(new MinidumpSimpleStringDictionaryEntryWriter());
|
||||
std::make_unique<MinidumpSimpleStringDictionaryEntryWriter>();
|
||||
dictionary_writer.AddEntry(std::move(entry_writer));
|
||||
|
||||
EXPECT_TRUE(dictionary_writer.IsUseful());
|
||||
@ -98,7 +94,7 @@ TEST(MinidumpSimpleStringDictionaryWriter, OneKeyValue) {
|
||||
|
||||
MinidumpSimpleStringDictionaryWriter dictionary_writer;
|
||||
auto entry_writer =
|
||||
base::WrapUnique(new MinidumpSimpleStringDictionaryEntryWriter());
|
||||
std::make_unique<MinidumpSimpleStringDictionaryEntryWriter>();
|
||||
entry_writer->SetKeyValue(kKey, kValue);
|
||||
dictionary_writer.AddEntry(std::move(entry_writer));
|
||||
|
||||
@ -136,15 +132,15 @@ TEST(MinidumpSimpleStringDictionaryWriter, ThreeKeysValues) {
|
||||
|
||||
MinidumpSimpleStringDictionaryWriter dictionary_writer;
|
||||
auto entry_writer_0 =
|
||||
base::WrapUnique(new MinidumpSimpleStringDictionaryEntryWriter());
|
||||
std::make_unique<MinidumpSimpleStringDictionaryEntryWriter>();
|
||||
entry_writer_0->SetKeyValue(kKey0, kValue0);
|
||||
dictionary_writer.AddEntry(std::move(entry_writer_0));
|
||||
auto entry_writer_1 =
|
||||
base::WrapUnique(new MinidumpSimpleStringDictionaryEntryWriter());
|
||||
std::make_unique<MinidumpSimpleStringDictionaryEntryWriter>();
|
||||
entry_writer_1->SetKeyValue(kKey1, kValue1);
|
||||
dictionary_writer.AddEntry(std::move(entry_writer_1));
|
||||
auto entry_writer_2 =
|
||||
base::WrapUnique(new MinidumpSimpleStringDictionaryEntryWriter());
|
||||
std::make_unique<MinidumpSimpleStringDictionaryEntryWriter>();
|
||||
entry_writer_2->SetKeyValue(kKey2, kValue2);
|
||||
dictionary_writer.AddEntry(std::move(entry_writer_2));
|
||||
|
||||
@ -204,11 +200,11 @@ TEST(MinidumpSimpleStringDictionaryWriter, DuplicateKeyValue) {
|
||||
|
||||
MinidumpSimpleStringDictionaryWriter dictionary_writer;
|
||||
auto entry_writer_0 =
|
||||
base::WrapUnique(new MinidumpSimpleStringDictionaryEntryWriter());
|
||||
std::make_unique<MinidumpSimpleStringDictionaryEntryWriter>();
|
||||
entry_writer_0->SetKeyValue(kKey, kValue0);
|
||||
dictionary_writer.AddEntry(std::move(entry_writer_0));
|
||||
auto entry_writer_1 =
|
||||
base::WrapUnique(new MinidumpSimpleStringDictionaryEntryWriter());
|
||||
std::make_unique<MinidumpSimpleStringDictionaryEntryWriter>();
|
||||
entry_writer_1->SetKeyValue(kKey, kValue1);
|
||||
dictionary_writer.AddEntry(std::move(entry_writer_1));
|
||||
|
||||
|
@ -17,7 +17,6 @@
|
||||
#include <utility>
|
||||
|
||||
#include "base/logging.h"
|
||||
#include "base/memory/ptr_util.h"
|
||||
#include "minidump/minidump_writer_util.h"
|
||||
#include "util/file/file_writer.h"
|
||||
#include "util/numeric/safe_assignment.h"
|
||||
@ -120,7 +119,7 @@ void MinidumpStringListWriter<MinidumpStringWriterType>::InitializeFromVector(
|
||||
template <typename MinidumpStringWriterType>
|
||||
void MinidumpStringListWriter<MinidumpStringWriterType>::AddStringUTF8(
|
||||
const std::string& string_utf8) {
|
||||
auto string_writer = base::WrapUnique(new MinidumpStringWriterType());
|
||||
auto string_writer = std::make_unique<MinidumpStringWriterType>();
|
||||
string_writer->SetUTF8(string_utf8);
|
||||
AddChild(std::move(string_writer));
|
||||
}
|
||||
|
@ -18,8 +18,6 @@
|
||||
|
||||
#include "base/compiler_specific.h"
|
||||
#include "base/format_macros.h"
|
||||
#include "base/macros.h"
|
||||
#include "base/strings/string16.h"
|
||||
#include "base/strings/stringprintf.h"
|
||||
#include "base/strings/utf_string_conversions.h"
|
||||
#include "gtest/gtest.h"
|
||||
|
@ -21,7 +21,6 @@
|
||||
#include <utility>
|
||||
|
||||
#include "base/compiler_specific.h"
|
||||
#include "base/memory/ptr_util.h"
|
||||
#include "gtest/gtest.h"
|
||||
#include "minidump/minidump_file_writer.h"
|
||||
#include "minidump/test/minidump_file_writer_test_util.h"
|
||||
@ -78,7 +77,7 @@ void GetSystemInfoStream(const std::string& file_contents,
|
||||
|
||||
TEST(MinidumpSystemInfoWriter, Empty) {
|
||||
MinidumpFileWriter minidump_file_writer;
|
||||
auto system_info_writer = base::WrapUnique(new MinidumpSystemInfoWriter());
|
||||
auto system_info_writer = std::make_unique<MinidumpSystemInfoWriter>();
|
||||
|
||||
system_info_writer->SetCSDVersion(std::string());
|
||||
|
||||
@ -118,7 +117,7 @@ TEST(MinidumpSystemInfoWriter, Empty) {
|
||||
|
||||
TEST(MinidumpSystemInfoWriter, X86_Win) {
|
||||
MinidumpFileWriter minidump_file_writer;
|
||||
auto system_info_writer = base::WrapUnique(new MinidumpSystemInfoWriter());
|
||||
auto system_info_writer = std::make_unique<MinidumpSystemInfoWriter>();
|
||||
|
||||
constexpr MinidumpCPUArchitecture kCPUArchitecture =
|
||||
kMinidumpCPUArchitectureX86;
|
||||
@ -189,7 +188,7 @@ TEST(MinidumpSystemInfoWriter, X86_Win) {
|
||||
|
||||
TEST(MinidumpSystemInfoWriter, AMD64_Mac) {
|
||||
MinidumpFileWriter minidump_file_writer;
|
||||
auto system_info_writer = base::WrapUnique(new MinidumpSystemInfoWriter());
|
||||
auto system_info_writer = std::make_unique<MinidumpSystemInfoWriter>();
|
||||
|
||||
constexpr MinidumpCPUArchitecture kCPUArchitecture =
|
||||
kMinidumpCPUArchitectureAMD64;
|
||||
@ -246,7 +245,7 @@ TEST(MinidumpSystemInfoWriter, X86_CPUVendorFromRegisters) {
|
||||
// This test exercises SetCPUX86Vendor() to set the vendor from register
|
||||
// values.
|
||||
MinidumpFileWriter minidump_file_writer;
|
||||
auto system_info_writer = base::WrapUnique(new MinidumpSystemInfoWriter());
|
||||
auto system_info_writer = std::make_unique<MinidumpSystemInfoWriter>();
|
||||
|
||||
constexpr MinidumpCPUArchitecture kCPUArchitecture =
|
||||
kMinidumpCPUArchitectureX86;
|
||||
@ -333,7 +332,7 @@ TEST(MinidumpSystemInfoWriter, InitializeFromSnapshot_X86) {
|
||||
expect_system_info.BuildNumber,
|
||||
kOSVersionBuild);
|
||||
|
||||
auto system_info_writer = base::WrapUnique(new MinidumpSystemInfoWriter());
|
||||
auto system_info_writer = std::make_unique<MinidumpSystemInfoWriter>();
|
||||
system_info_writer->InitializeFromSnapshot(&system_snapshot);
|
||||
|
||||
MinidumpFileWriter minidump_file_writer;
|
||||
@ -429,7 +428,7 @@ TEST(MinidumpSystemInfoWriter, InitializeFromSnapshot_AMD64) {
|
||||
kOSVersionBuild);
|
||||
system_snapshot.SetNXEnabled(true);
|
||||
|
||||
auto system_info_writer = base::WrapUnique(new MinidumpSystemInfoWriter());
|
||||
auto system_info_writer = std::make_unique<MinidumpSystemInfoWriter>();
|
||||
system_info_writer->InitializeFromSnapshot(&system_snapshot);
|
||||
|
||||
MinidumpFileWriter minidump_file_writer;
|
||||
@ -470,7 +469,7 @@ TEST(MinidumpSystemInfoWriter, InitializeFromSnapshot_AMD64) {
|
||||
|
||||
TEST(MinidumpSystemInfoWriterDeathTest, NoCSDVersion) {
|
||||
MinidumpFileWriter minidump_file_writer;
|
||||
auto system_info_writer = base::WrapUnique(new MinidumpSystemInfoWriter());
|
||||
auto system_info_writer = std::make_unique<MinidumpSystemInfoWriter>();
|
||||
ASSERT_TRUE(minidump_file_writer.AddStream(std::move(system_info_writer)));
|
||||
|
||||
StringFile string_file;
|
||||
|
@ -17,7 +17,6 @@
|
||||
#include <utility>
|
||||
|
||||
#include "base/logging.h"
|
||||
#include "base/memory/ptr_util.h"
|
||||
#include "minidump/minidump_context_writer.h"
|
||||
#include "minidump/minidump_memory_writer.h"
|
||||
#include "snapshot/memory_snapshot.h"
|
||||
@ -148,7 +147,7 @@ void MinidumpThreadListWriter::InitializeFromSnapshot(
|
||||
BuildMinidumpThreadIDMap(thread_snapshots, thread_id_map);
|
||||
|
||||
for (const ThreadSnapshot* thread_snapshot : thread_snapshots) {
|
||||
auto thread = base::WrapUnique(new MinidumpThreadWriter());
|
||||
auto thread = std::make_unique<MinidumpThreadWriter>();
|
||||
thread->InitializeFromSnapshot(thread_snapshot, thread_id_map);
|
||||
AddThread(std::move(thread));
|
||||
}
|
||||
|
@ -19,13 +19,11 @@
|
||||
|
||||
#include "base/compiler_specific.h"
|
||||
#include "base/format_macros.h"
|
||||
#include "base/memory/ptr_util.h"
|
||||
#include "base/strings/stringprintf.h"
|
||||
#include "gtest/gtest.h"
|
||||
#include "minidump/minidump_context_writer.h"
|
||||
#include "minidump/minidump_file_writer.h"
|
||||
#include "minidump/minidump_memory_writer.h"
|
||||
#include "minidump/minidump_thread_id_map.h"
|
||||
#include "minidump/test/minidump_context_test_util.h"
|
||||
#include "minidump/test/minidump_file_writer_test_util.h"
|
||||
#include "minidump/test/minidump_memory_writer_test_util.h"
|
||||
@ -79,7 +77,7 @@ void GetThreadListStream(const std::string& file_contents,
|
||||
|
||||
TEST(MinidumpThreadWriter, EmptyThreadList) {
|
||||
MinidumpFileWriter minidump_file_writer;
|
||||
auto thread_list_writer = base::WrapUnique(new MinidumpThreadListWriter());
|
||||
auto thread_list_writer = std::make_unique<MinidumpThreadListWriter>();
|
||||
|
||||
ASSERT_TRUE(minidump_file_writer.AddStream(std::move(thread_list_writer)));
|
||||
|
||||
@ -140,7 +138,7 @@ void ExpectThread(const MINIDUMP_THREAD* expected,
|
||||
|
||||
TEST(MinidumpThreadWriter, OneThread_x86_NoStack) {
|
||||
MinidumpFileWriter minidump_file_writer;
|
||||
auto thread_list_writer = base::WrapUnique(new MinidumpThreadListWriter());
|
||||
auto thread_list_writer = std::make_unique<MinidumpThreadListWriter>();
|
||||
|
||||
constexpr uint32_t kThreadID = 0x11111111;
|
||||
constexpr uint32_t kSuspendCount = 1;
|
||||
@ -149,14 +147,14 @@ TEST(MinidumpThreadWriter, OneThread_x86_NoStack) {
|
||||
constexpr uint64_t kTEB = 0x55555555;
|
||||
constexpr uint32_t kSeed = 123;
|
||||
|
||||
auto thread_writer = base::WrapUnique(new MinidumpThreadWriter());
|
||||
auto thread_writer = std::make_unique<MinidumpThreadWriter>();
|
||||
thread_writer->SetThreadID(kThreadID);
|
||||
thread_writer->SetSuspendCount(kSuspendCount);
|
||||
thread_writer->SetPriorityClass(kPriorityClass);
|
||||
thread_writer->SetPriority(kPriority);
|
||||
thread_writer->SetTEB(kTEB);
|
||||
|
||||
auto context_x86_writer = base::WrapUnique(new MinidumpContextX86Writer());
|
||||
auto context_x86_writer = std::make_unique<MinidumpContextX86Writer>();
|
||||
InitializeMinidumpContextX86(context_x86_writer->context(), kSeed);
|
||||
thread_writer->SetContext(std::move(context_x86_writer));
|
||||
|
||||
@ -199,7 +197,7 @@ TEST(MinidumpThreadWriter, OneThread_x86_NoStack) {
|
||||
|
||||
TEST(MinidumpThreadWriter, OneThread_AMD64_Stack) {
|
||||
MinidumpFileWriter minidump_file_writer;
|
||||
auto thread_list_writer = base::WrapUnique(new MinidumpThreadListWriter());
|
||||
auto thread_list_writer = std::make_unique<MinidumpThreadListWriter>();
|
||||
|
||||
constexpr uint32_t kThreadID = 0x22222222;
|
||||
constexpr uint32_t kSuspendCount = 2;
|
||||
@ -211,21 +209,23 @@ TEST(MinidumpThreadWriter, OneThread_AMD64_Stack) {
|
||||
constexpr uint8_t kMemoryValue = 99;
|
||||
constexpr uint32_t kSeed = 456;
|
||||
|
||||
auto thread_writer = base::WrapUnique(new MinidumpThreadWriter());
|
||||
auto thread_writer = std::make_unique<MinidumpThreadWriter>();
|
||||
thread_writer->SetThreadID(kThreadID);
|
||||
thread_writer->SetSuspendCount(kSuspendCount);
|
||||
thread_writer->SetPriorityClass(kPriorityClass);
|
||||
thread_writer->SetPriority(kPriority);
|
||||
thread_writer->SetTEB(kTEB);
|
||||
|
||||
auto memory_writer = base::WrapUnique(
|
||||
new TestMinidumpMemoryWriter(kMemoryBase, kMemorySize, kMemoryValue));
|
||||
auto memory_writer = std::make_unique<TestMinidumpMemoryWriter>(
|
||||
kMemoryBase, kMemorySize, kMemoryValue);
|
||||
thread_writer->SetStack(std::move(memory_writer));
|
||||
|
||||
// Object allocated on heap may not be aligned.
|
||||
MSVC_PUSH_DISABLE_WARNING(4316);
|
||||
auto context_amd64_writer =
|
||||
base::WrapUnique(new MinidumpContextAMD64Writer());
|
||||
// This would use std::make_unique, but since the “new” would be in <memory>
|
||||
// and not here, MSVC_PUSH_DISABLE_WARNING wouldn’t have the intended effect.
|
||||
std::unique_ptr<MinidumpContextAMD64Writer> context_amd64_writer(
|
||||
new MinidumpContextAMD64Writer());
|
||||
MSVC_POP_WARNING(); // C4316.
|
||||
InitializeMinidumpContextAMD64(context_amd64_writer->context(), kSeed);
|
||||
thread_writer->SetContext(std::move(context_amd64_writer));
|
||||
@ -278,8 +278,8 @@ TEST(MinidumpThreadWriter, OneThread_AMD64_Stack) {
|
||||
|
||||
TEST(MinidumpThreadWriter, ThreeThreads_x86_MemoryList) {
|
||||
MinidumpFileWriter minidump_file_writer;
|
||||
auto thread_list_writer = base::WrapUnique(new MinidumpThreadListWriter());
|
||||
auto memory_list_writer = base::WrapUnique(new MinidumpMemoryListWriter());
|
||||
auto thread_list_writer = std::make_unique<MinidumpThreadListWriter>();
|
||||
auto memory_list_writer = std::make_unique<MinidumpMemoryListWriter>();
|
||||
thread_list_writer->SetMemoryListWriter(memory_list_writer.get());
|
||||
|
||||
constexpr uint32_t kThreadID0 = 1111111;
|
||||
@ -292,18 +292,18 @@ TEST(MinidumpThreadWriter, ThreeThreads_x86_MemoryList) {
|
||||
constexpr uint8_t kMemoryValue0 = 11;
|
||||
constexpr uint32_t kSeed0 = 1;
|
||||
|
||||
auto thread_writer_0 = base::WrapUnique(new MinidumpThreadWriter());
|
||||
auto thread_writer_0 = std::make_unique<MinidumpThreadWriter>();
|
||||
thread_writer_0->SetThreadID(kThreadID0);
|
||||
thread_writer_0->SetSuspendCount(kSuspendCount0);
|
||||
thread_writer_0->SetPriorityClass(kPriorityClass0);
|
||||
thread_writer_0->SetPriority(kPriority0);
|
||||
thread_writer_0->SetTEB(kTEB0);
|
||||
|
||||
auto memory_writer_0 = base::WrapUnique(
|
||||
new TestMinidumpMemoryWriter(kMemoryBase0, kMemorySize0, kMemoryValue0));
|
||||
auto memory_writer_0 = std::make_unique<TestMinidumpMemoryWriter>(
|
||||
kMemoryBase0, kMemorySize0, kMemoryValue0);
|
||||
thread_writer_0->SetStack(std::move(memory_writer_0));
|
||||
|
||||
auto context_x86_writer_0 = base::WrapUnique(new MinidumpContextX86Writer());
|
||||
auto context_x86_writer_0 = std::make_unique<MinidumpContextX86Writer>();
|
||||
InitializeMinidumpContextX86(context_x86_writer_0->context(), kSeed0);
|
||||
thread_writer_0->SetContext(std::move(context_x86_writer_0));
|
||||
|
||||
@ -319,18 +319,18 @@ TEST(MinidumpThreadWriter, ThreeThreads_x86_MemoryList) {
|
||||
constexpr uint8_t kMemoryValue1 = 22;
|
||||
constexpr uint32_t kSeed1 = 2;
|
||||
|
||||
auto thread_writer_1 = base::WrapUnique(new MinidumpThreadWriter());
|
||||
auto thread_writer_1 = std::make_unique<MinidumpThreadWriter>();
|
||||
thread_writer_1->SetThreadID(kThreadID1);
|
||||
thread_writer_1->SetSuspendCount(kSuspendCount1);
|
||||
thread_writer_1->SetPriorityClass(kPriorityClass1);
|
||||
thread_writer_1->SetPriority(kPriority1);
|
||||
thread_writer_1->SetTEB(kTEB1);
|
||||
|
||||
auto memory_writer_1 = base::WrapUnique(
|
||||
new TestMinidumpMemoryWriter(kMemoryBase1, kMemorySize1, kMemoryValue1));
|
||||
auto memory_writer_1 = std::make_unique<TestMinidumpMemoryWriter>(
|
||||
kMemoryBase1, kMemorySize1, kMemoryValue1);
|
||||
thread_writer_1->SetStack(std::move(memory_writer_1));
|
||||
|
||||
auto context_x86_writer_1 = base::WrapUnique(new MinidumpContextX86Writer());
|
||||
auto context_x86_writer_1 = std::make_unique<MinidumpContextX86Writer>();
|
||||
InitializeMinidumpContextX86(context_x86_writer_1->context(), kSeed1);
|
||||
thread_writer_1->SetContext(std::move(context_x86_writer_1));
|
||||
|
||||
@ -346,18 +346,18 @@ TEST(MinidumpThreadWriter, ThreeThreads_x86_MemoryList) {
|
||||
constexpr uint8_t kMemoryValue2 = 33;
|
||||
constexpr uint32_t kSeed2 = 3;
|
||||
|
||||
auto thread_writer_2 = base::WrapUnique(new MinidumpThreadWriter());
|
||||
auto thread_writer_2 = std::make_unique<MinidumpThreadWriter>();
|
||||
thread_writer_2->SetThreadID(kThreadID2);
|
||||
thread_writer_2->SetSuspendCount(kSuspendCount2);
|
||||
thread_writer_2->SetPriorityClass(kPriorityClass2);
|
||||
thread_writer_2->SetPriority(kPriority2);
|
||||
thread_writer_2->SetTEB(kTEB2);
|
||||
|
||||
auto memory_writer_2 = base::WrapUnique(
|
||||
new TestMinidumpMemoryWriter(kMemoryBase2, kMemorySize2, kMemoryValue2));
|
||||
auto memory_writer_2 = std::make_unique<TestMinidumpMemoryWriter>(
|
||||
kMemoryBase2, kMemorySize2, kMemoryValue2);
|
||||
thread_writer_2->SetStack(std::move(memory_writer_2));
|
||||
|
||||
auto context_x86_writer_2 = base::WrapUnique(new MinidumpContextX86Writer());
|
||||
auto context_x86_writer_2 = std::make_unique<MinidumpContextX86Writer>();
|
||||
InitializeMinidumpContextX86(context_x86_writer_2->context(), kSeed2);
|
||||
thread_writer_2->SetContext(std::move(context_x86_writer_2));
|
||||
|
||||
@ -597,7 +597,7 @@ void RunInitializeFromSnapshotTest(bool thread_id_collision) {
|
||||
thread_snapshot->SetThreadSpecificDataAddress(expect_threads[index].Teb);
|
||||
|
||||
if (expect_threads[index].Stack.Memory.DataSize) {
|
||||
auto memory_snapshot = base::WrapUnique(new TestMemorySnapshot());
|
||||
auto memory_snapshot = std::make_unique<TestMemorySnapshot>();
|
||||
memory_snapshot->SetAddress(
|
||||
expect_threads[index].Stack.StartOfMemoryRange);
|
||||
memory_snapshot->SetSize(expect_threads[index].Stack.Memory.DataSize);
|
||||
@ -608,7 +608,7 @@ void RunInitializeFromSnapshotTest(bool thread_id_collision) {
|
||||
Traits::InitializeCPUContext(thread_snapshot->MutableContext(),
|
||||
context_seeds[index]);
|
||||
|
||||
auto teb_snapshot = base::WrapUnique(new TestMemorySnapshot());
|
||||
auto teb_snapshot = std::make_unique<TestMemorySnapshot>();
|
||||
teb_snapshot->SetAddress(expect_threads[index].Teb);
|
||||
teb_snapshot->SetSize(kTebSize);
|
||||
teb_snapshot->SetValue(static_cast<char>('t' + index));
|
||||
@ -617,8 +617,8 @@ void RunInitializeFromSnapshotTest(bool thread_id_collision) {
|
||||
thread_snapshots.push_back(thread_snapshot);
|
||||
}
|
||||
|
||||
auto thread_list_writer = base::WrapUnique(new MinidumpThreadListWriter());
|
||||
auto memory_list_writer = base::WrapUnique(new MinidumpMemoryListWriter());
|
||||
auto thread_list_writer = std::make_unique<MinidumpThreadListWriter>();
|
||||
auto memory_list_writer = std::make_unique<MinidumpMemoryListWriter>();
|
||||
thread_list_writer->SetMemoryListWriter(memory_list_writer.get());
|
||||
MinidumpThreadIDMap thread_id_map;
|
||||
thread_list_writer->InitializeFromSnapshot(thread_snapshots, &thread_id_map);
|
||||
@ -698,9 +698,9 @@ TEST(MinidumpThreadWriter, InitializeFromSnapshot_ThreadIDCollision) {
|
||||
|
||||
TEST(MinidumpThreadWriterDeathTest, NoContext) {
|
||||
MinidumpFileWriter minidump_file_writer;
|
||||
auto thread_list_writer = base::WrapUnique(new MinidumpThreadListWriter());
|
||||
auto thread_list_writer = std::make_unique<MinidumpThreadListWriter>();
|
||||
|
||||
auto thread_writer = base::WrapUnique(new MinidumpThreadWriter());
|
||||
auto thread_writer = std::make_unique<MinidumpThreadWriter>();
|
||||
|
||||
thread_list_writer->AddThread(std::move(thread_writer));
|
||||
ASSERT_TRUE(minidump_file_writer.AddStream(std::move(thread_list_writer)));
|
||||
|
@ -16,7 +16,6 @@
|
||||
|
||||
#include <limits>
|
||||
|
||||
#include "base/memory/ptr_util.h"
|
||||
#include "minidump/minidump_writer_util.h"
|
||||
#include "util/file/file_writer.h"
|
||||
#include "util/numeric/in_range_cast.h"
|
||||
@ -124,7 +123,7 @@ void MinidumpUnloadedModuleListWriter::InitializeFromSnapshot(
|
||||
DCHECK(unloaded_modules_.empty());
|
||||
|
||||
for (auto unloaded_module_snapshot : unloaded_module_snapshots) {
|
||||
auto unloaded_module = base::WrapUnique(new MinidumpUnloadedModuleWriter());
|
||||
auto unloaded_module = std::make_unique<MinidumpUnloadedModuleWriter>();
|
||||
unloaded_module->InitializeFromSnapshot(unloaded_module_snapshot);
|
||||
AddUnloadedModule(std::move(unloaded_module));
|
||||
}
|
||||
|
@ -14,7 +14,6 @@
|
||||
|
||||
#include "minidump/minidump_unloaded_module_writer.h"
|
||||
|
||||
#include "base/memory/ptr_util.h"
|
||||
#include "base/strings/utf_string_conversions.h"
|
||||
#include "gtest/gtest.h"
|
||||
#include "minidump/minidump_file_writer.h"
|
||||
@ -72,12 +71,12 @@ void GetUnloadedModuleListStream(
|
||||
TEST(MinidumpUnloadedModuleWriter, EmptyModule) {
|
||||
MinidumpFileWriter minidump_file_writer;
|
||||
auto unloaded_module_list_writer =
|
||||
base::WrapUnique(new MinidumpUnloadedModuleListWriter());
|
||||
std::make_unique<MinidumpUnloadedModuleListWriter>();
|
||||
|
||||
static constexpr char kModuleName[] = "test_dll";
|
||||
|
||||
auto unloaded_module_writer =
|
||||
base::WrapUnique(new MinidumpUnloadedModuleWriter());
|
||||
std::make_unique<MinidumpUnloadedModuleWriter>();
|
||||
unloaded_module_writer->SetName(kModuleName);
|
||||
|
||||
unloaded_module_list_writer->AddUnloadedModule(
|
||||
@ -111,7 +110,7 @@ TEST(MinidumpUnloadedModuleWriter, EmptyModule) {
|
||||
TEST(MinidumpUnloadedModuleWriter, OneModule) {
|
||||
MinidumpFileWriter minidump_file_writer;
|
||||
auto unloaded_module_list_writer =
|
||||
base::WrapUnique(new MinidumpUnloadedModuleListWriter());
|
||||
std::make_unique<MinidumpUnloadedModuleListWriter>();
|
||||
|
||||
static constexpr char kModuleName[] = "statically_linked";
|
||||
constexpr uint64_t kModuleBase = 0x10da69000;
|
||||
@ -120,7 +119,7 @@ TEST(MinidumpUnloadedModuleWriter, OneModule) {
|
||||
constexpr time_t kTimestamp = 0x386d4380;
|
||||
|
||||
auto unloaded_module_writer =
|
||||
base::WrapUnique(new MinidumpUnloadedModuleWriter());
|
||||
std::make_unique<MinidumpUnloadedModuleWriter>();
|
||||
unloaded_module_writer->SetName(kModuleName);
|
||||
unloaded_module_writer->SetImageBaseAddress(kModuleBase);
|
||||
unloaded_module_writer->SetImageSize(kModuleSize);
|
||||
|
@ -14,7 +14,6 @@
|
||||
|
||||
#include "minidump/minidump_user_stream_writer.h"
|
||||
|
||||
#include "base/memory/ptr_util.h"
|
||||
#include "util/file/file_writer.h"
|
||||
|
||||
namespace crashpad {
|
||||
@ -95,8 +94,7 @@ void MinidumpUserStreamWriter::InitializeFromSnapshot(
|
||||
DCHECK(!contents_writer_.get());
|
||||
|
||||
stream_type_ = static_cast<MinidumpStreamType>(stream->stream_type());
|
||||
contents_writer_ =
|
||||
base::WrapUnique(new SnapshotContentsWriter(stream->memory()));
|
||||
contents_writer_ = std::make_unique<SnapshotContentsWriter>(stream->memory());
|
||||
}
|
||||
|
||||
void MinidumpUserStreamWriter::InitializeFromUserExtensionStream(
|
||||
@ -105,8 +103,8 @@ void MinidumpUserStreamWriter::InitializeFromUserExtensionStream(
|
||||
DCHECK(!contents_writer_.get());
|
||||
|
||||
stream_type_ = data_source->stream_type();
|
||||
contents_writer_ = base::WrapUnique(
|
||||
new ExtensionStreamContentsWriter(std::move(data_source)));
|
||||
contents_writer_ =
|
||||
std::make_unique<ExtensionStreamContentsWriter>(std::move(data_source));
|
||||
}
|
||||
|
||||
bool MinidumpUserStreamWriter::Freeze() {
|
||||
|
@ -19,6 +19,7 @@
|
||||
#include <dbghelp.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
|
||||
#include "base/macros.h"
|
||||
|
@ -17,7 +17,6 @@
|
||||
#include <string>
|
||||
#include <utility>
|
||||
|
||||
#include "base/memory/ptr_util.h"
|
||||
#include "gtest/gtest.h"
|
||||
#include "minidump/minidump_file_writer.h"
|
||||
#include "minidump/test/minidump_file_writer_test_util.h"
|
||||
@ -58,9 +57,8 @@ constexpr MinidumpStreamType kTestStreamId =
|
||||
|
||||
TEST(MinidumpUserStreamWriter, InitializeFromSnapshotNoData) {
|
||||
MinidumpFileWriter minidump_file_writer;
|
||||
auto user_stream_writer = base::WrapUnique(new MinidumpUserStreamWriter());
|
||||
auto stream =
|
||||
base::WrapUnique(new UserMinidumpStream(kTestStreamId, nullptr));
|
||||
auto user_stream_writer = std::make_unique<MinidumpUserStreamWriter>();
|
||||
auto stream = std::make_unique<UserMinidumpStream>(kTestStreamId, nullptr);
|
||||
user_stream_writer->InitializeFromSnapshot(stream.get());
|
||||
ASSERT_TRUE(minidump_file_writer.AddStream(std::move(user_stream_writer)));
|
||||
|
||||
@ -77,9 +75,9 @@ TEST(MinidumpUserStreamWriter, InitializeFromSnapshotNoData) {
|
||||
|
||||
TEST(MinidumpUserStreamWriter, InitializeFromUserExtensionStreamNoData) {
|
||||
MinidumpFileWriter minidump_file_writer;
|
||||
auto data_source = base::WrapUnique(
|
||||
new test::BufferExtensionStreamDataSource(kTestStreamId, nullptr, 0));
|
||||
auto user_stream_writer = base::WrapUnique(new MinidumpUserStreamWriter());
|
||||
auto data_source = std::make_unique<test::BufferExtensionStreamDataSource>(
|
||||
kTestStreamId, nullptr, 0);
|
||||
auto user_stream_writer = std::make_unique<MinidumpUserStreamWriter>();
|
||||
user_stream_writer->InitializeFromUserExtensionStream(std::move(data_source));
|
||||
minidump_file_writer.AddStream(std::move(user_stream_writer));
|
||||
|
||||
@ -96,15 +94,14 @@ TEST(MinidumpUserStreamWriter, InitializeFromUserExtensionStreamNoData) {
|
||||
|
||||
TEST(MinidumpUserStreamWriter, InitializeFromSnapshotOneStream) {
|
||||
MinidumpFileWriter minidump_file_writer;
|
||||
auto user_stream_writer = base::WrapUnique(new MinidumpUserStreamWriter());
|
||||
auto user_stream_writer = std::make_unique<MinidumpUserStreamWriter>();
|
||||
|
||||
TestMemorySnapshot* test_data = new TestMemorySnapshot();
|
||||
test_data->SetAddress(97865);
|
||||
constexpr size_t kStreamSize = 128;
|
||||
test_data->SetSize(kStreamSize);
|
||||
test_data->SetValue('c');
|
||||
auto stream =
|
||||
base::WrapUnique(new UserMinidumpStream(kTestStreamId, test_data));
|
||||
auto stream = std::make_unique<UserMinidumpStream>(kTestStreamId, test_data);
|
||||
user_stream_writer->InitializeFromSnapshot(stream.get());
|
||||
ASSERT_TRUE(minidump_file_writer.AddStream(std::move(user_stream_writer)));
|
||||
|
||||
@ -127,9 +124,9 @@ TEST(MinidumpUserStreamWriter, InitializeFromBufferOneStream) {
|
||||
|
||||
constexpr size_t kStreamSize = 128;
|
||||
std::vector<uint8_t> data(kStreamSize, 'c');
|
||||
auto data_source = base::WrapUnique(new test::BufferExtensionStreamDataSource(
|
||||
kTestStreamId, &data[0], data.size()));
|
||||
auto user_stream_writer = base::WrapUnique(new MinidumpUserStreamWriter());
|
||||
auto data_source = std::make_unique<test::BufferExtensionStreamDataSource>(
|
||||
kTestStreamId, &data[0], data.size());
|
||||
auto user_stream_writer = std::make_unique<MinidumpUserStreamWriter>();
|
||||
user_stream_writer->InitializeFromUserExtensionStream(std::move(data_source));
|
||||
minidump_file_writer.AddStream(std::move(user_stream_writer));
|
||||
|
||||
|
@ -15,7 +15,6 @@
|
||||
#include "snapshot/mac/process_snapshot_mac.h"
|
||||
|
||||
#include "base/logging.h"
|
||||
#include "base/memory/ptr_util.h"
|
||||
#include "util/misc/tri_state.h"
|
||||
|
||||
namespace crashpad {
|
||||
@ -221,7 +220,7 @@ void ProcessSnapshotMac::InitializeThreads() {
|
||||
process_reader_.Threads();
|
||||
for (const ProcessReader::Thread& process_reader_thread :
|
||||
process_reader_threads) {
|
||||
auto thread = base::WrapUnique(new internal::ThreadSnapshotMac());
|
||||
auto thread = std::make_unique<internal::ThreadSnapshotMac>();
|
||||
if (thread->Initialize(&process_reader_, process_reader_thread)) {
|
||||
threads_.push_back(thread.release());
|
||||
}
|
||||
@ -233,7 +232,7 @@ void ProcessSnapshotMac::InitializeModules() {
|
||||
process_reader_.Modules();
|
||||
for (const ProcessReader::Module& process_reader_module :
|
||||
process_reader_modules) {
|
||||
auto module = base::WrapUnique(new internal::ModuleSnapshotMac());
|
||||
auto module = std::make_unique<internal::ModuleSnapshotMac>();
|
||||
if (module->Initialize(&process_reader_, process_reader_module)) {
|
||||
modules_.push_back(module.release());
|
||||
}
|
||||
|
@ -17,7 +17,6 @@
|
||||
#include <memory>
|
||||
#include <utility>
|
||||
|
||||
#include "base/memory/ptr_util.h"
|
||||
#include "snapshot/minidump/minidump_simple_string_dictionary_reader.h"
|
||||
#include "util/file/file_io.h"
|
||||
|
||||
@ -278,7 +277,7 @@ bool ProcessSnapshotMinidump::InitializeModules() {
|
||||
? &module_crashpad_info_it->second
|
||||
: nullptr;
|
||||
|
||||
auto module = base::WrapUnique(new internal::ModuleSnapshotMinidump());
|
||||
auto module = std::make_unique<internal::ModuleSnapshotMinidump>();
|
||||
if (!module->Initialize(
|
||||
file_reader_, module_rva, module_crashpad_info_location)) {
|
||||
return false;
|
||||
|
@ -20,12 +20,8 @@
|
||||
#include <algorithm>
|
||||
|
||||
#include "base/logging.h"
|
||||
#include "base/memory/ptr_util.h"
|
||||
#include "base/strings/stringprintf.h"
|
||||
#include "base/strings/utf_string_conversions.h"
|
||||
#include "snapshot/win/exception_snapshot_win.h"
|
||||
#include "snapshot/win/memory_snapshot_win.h"
|
||||
#include "snapshot/win/module_snapshot_win.h"
|
||||
#include "util/misc/from_pointer_cast.h"
|
||||
#include "util/win/nt_internals.h"
|
||||
#include "util/win/registration_protocol_win.h"
|
||||
@ -243,7 +239,7 @@ void ProcessSnapshotWin::InitializeThreads(
|
||||
budget_remaining_pointer = &budget_remaining;
|
||||
for (const ProcessReaderWin::Thread& process_reader_thread :
|
||||
process_reader_threads) {
|
||||
auto thread = base::WrapUnique(new internal::ThreadSnapshotWin());
|
||||
auto thread = std::make_unique<internal::ThreadSnapshotWin>();
|
||||
if (thread->Initialize(&process_reader_,
|
||||
process_reader_thread,
|
||||
budget_remaining_pointer)) {
|
||||
@ -257,7 +253,7 @@ void ProcessSnapshotWin::InitializeModules() {
|
||||
process_reader_.Modules();
|
||||
for (const ProcessInfo::Module& process_reader_module :
|
||||
process_reader_modules) {
|
||||
auto module = base::WrapUnique(new internal::ModuleSnapshotWin());
|
||||
auto module = std::make_unique<internal::ModuleSnapshotWin>();
|
||||
if (module->Initialize(&process_reader_, process_reader_module)) {
|
||||
modules_.push_back(module.release());
|
||||
}
|
||||
|
@ -17,7 +17,6 @@
|
||||
#include "base/files/file_path.h"
|
||||
#include "build/build_config.h"
|
||||
#include "gtest/gtest.h"
|
||||
#include "snapshot/win/module_snapshot_win.h"
|
||||
#include "snapshot/win/pe_image_reader.h"
|
||||
#include "snapshot/win/process_reader_win.h"
|
||||
#include "test/errors.h"
|
||||
|
@ -16,7 +16,6 @@
|
||||
|
||||
#include <tlhelp32.h>
|
||||
|
||||
#include "base/memory/ptr_util.h"
|
||||
#include "test/errors.h"
|
||||
#include "util/win/process_info.h"
|
||||
|
||||
@ -124,7 +123,7 @@ WinMultiprocessWithTempDir::WinMultiprocessWithTempDir()
|
||||
: WinMultiprocess(), temp_dir_env_(kTempDirEnvName) {}
|
||||
|
||||
void WinMultiprocessWithTempDir::WinMultiprocessParentBeforeChild() {
|
||||
temp_dir_ = base::WrapUnique(new ScopedTempDir);
|
||||
temp_dir_ = std::make_unique<ScopedTempDir>();
|
||||
temp_dir_env_.SetValue(temp_dir_->path().value().c_str());
|
||||
}
|
||||
|
||||
|
@ -18,6 +18,7 @@
|
||||
#include <wchar.h>
|
||||
#include <windows.h>
|
||||
|
||||
#include <memory>
|
||||
#include <string>
|
||||
|
||||
#include "base/files/file_path.h"
|
||||
|
Loading…
x
Reference in New Issue
Block a user