mirror of
https://github.com/chromium/crashpad.git
synced 2024-12-26 23:01:05 +08:00
Replace use of .Pass() with crashpad::move().
Since C++11 library support isn't available everywhere crashpad is compiled, add our own move() method in the crashpad namespace to replace std::move() for now. Replace uses of .Pass() with this method. R=mark@chromium.org, scottmg@chromium.org BUG=chromium:557422 Review URL: https://codereview.chromium.org/1483073004 .
This commit is contained in:
parent
1f3ced1846
commit
6bebb10829
@ -25,6 +25,7 @@
|
||||
#include "base/strings/utf_string_conversions.h"
|
||||
#include "client/settings.h"
|
||||
#include "util/misc/initialization_state_dcheck.h"
|
||||
#include "util/stdlib/move.h"
|
||||
|
||||
namespace crashpad {
|
||||
|
||||
@ -815,7 +816,7 @@ scoped_ptr<CrashReportDatabase> InitializeInternal(
|
||||
scoped_ptr<CrashReportDatabaseWin> database_win(
|
||||
new CrashReportDatabaseWin(path));
|
||||
return database_win->Initialize(may_create)
|
||||
? database_win.Pass()
|
||||
? crashpad::move(database_win)
|
||||
: scoped_ptr<CrashReportDatabaseWin>();
|
||||
}
|
||||
|
||||
|
@ -32,6 +32,7 @@
|
||||
#include "util/mach/notify_server.h"
|
||||
#include "util/misc/clock.h"
|
||||
#include "util/misc/implicit_cast.h"
|
||||
#include "util/stdlib/move.h"
|
||||
#include "util/posix/close_multiple.h"
|
||||
|
||||
namespace crashpad {
|
||||
@ -158,7 +159,7 @@ class HandlerStarter final : public NotifyServer::DefaultInterface {
|
||||
url,
|
||||
annotations,
|
||||
arguments,
|
||||
receive_right.Pass(),
|
||||
crashpad::move(receive_right),
|
||||
handler_restarter.get(),
|
||||
false)) {
|
||||
return base::mac::ScopedMachSendRight();
|
||||
@ -538,7 +539,7 @@ bool CrashpadClient::StartHandler(
|
||||
return false;
|
||||
}
|
||||
|
||||
SetHandlerMachPort(exception_port.Pass());
|
||||
SetHandlerMachPort(crashpad::move(exception_port));
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -548,14 +549,14 @@ bool CrashpadClient::SetHandlerMachService(const std::string& service_name) {
|
||||
return false;
|
||||
}
|
||||
|
||||
SetHandlerMachPort(exception_port.Pass());
|
||||
SetHandlerMachPort(crashpad::move(exception_port));
|
||||
return true;
|
||||
}
|
||||
|
||||
void CrashpadClient::SetHandlerMachPort(
|
||||
base::mac::ScopedMachSendRight exception_port) {
|
||||
DCHECK(exception_port.is_valid());
|
||||
exception_port_ = exception_port.Pass();
|
||||
exception_port_ = crashpad::move(exception_port);
|
||||
}
|
||||
|
||||
bool CrashpadClient::UseHandler() {
|
||||
|
@ -18,6 +18,7 @@
|
||||
|
||||
#include "base/logging.h"
|
||||
#include "base/posix/eintr_wrapper.h"
|
||||
#include "util/stdlib/move.h"
|
||||
#include "util/numeric/in_range_cast.h"
|
||||
|
||||
namespace crashpad {
|
||||
@ -235,7 +236,7 @@ Settings::ScopedLockedFileHandle Settings::OpenForWritingAndReadSettings(
|
||||
return ScopedLockedFileHandle();
|
||||
}
|
||||
|
||||
return handle.Pass();
|
||||
return handle;
|
||||
}
|
||||
|
||||
bool Settings::ReadSettings(FileHandle handle,
|
||||
|
@ -28,6 +28,7 @@
|
||||
#include "snapshot/minidump/process_snapshot_minidump.h"
|
||||
#include "snapshot/module_snapshot.h"
|
||||
#include "util/file/file_reader.h"
|
||||
#include "util/stdlib/move.h"
|
||||
#include "util/misc/uuid.h"
|
||||
#include "util/net/http_body.h"
|
||||
#include "util/net/http_multipart_builder.h"
|
||||
@ -366,7 +367,7 @@ CrashReportUploadThread::UploadResult CrashReportUploadThread::UploadReport(
|
||||
HTTPHeaders::value_type content_type =
|
||||
http_multipart_builder.GetContentType();
|
||||
http_transport->SetHeader(content_type.first, content_type.second);
|
||||
http_transport->SetBodyStream(http_multipart_builder.GetBodyStream().Pass());
|
||||
http_transport->SetBodyStream(http_multipart_builder.GetBodyStream());
|
||||
// TODO(mark): The timeout should be configurable by the client.
|
||||
http_transport->SetTimeout(60.0); // 1 minute.
|
||||
|
||||
|
@ -33,6 +33,7 @@
|
||||
#include "tools/tool_support.h"
|
||||
#include "handler/crash_report_upload_thread.h"
|
||||
#include "util/file/file_io.h"
|
||||
#include "util/stdlib/move.h"
|
||||
#include "util/stdlib/map_insert.h"
|
||||
#include "util/stdlib/string_number_conversion.h"
|
||||
#include "util/string/split_string.h"
|
||||
@ -314,7 +315,7 @@ int HandlerMain(int argc, char* argv[]) {
|
||||
}
|
||||
|
||||
ExceptionHandlerServer exception_handler_server(
|
||||
receive_right.Pass(), !options.mach_service.empty());
|
||||
crashpad::move(receive_right), !options.mach_service.empty());
|
||||
base::AutoReset<ExceptionHandlerServer*> reset_g_exception_handler_server(
|
||||
&g_exception_handler_server, &exception_handler_server);
|
||||
|
||||
|
@ -21,6 +21,7 @@
|
||||
#include "util/mach/mach_message.h"
|
||||
#include "util/mach/mach_message_server.h"
|
||||
#include "util/mach/notify_server.h"
|
||||
#include "util/stdlib/move.h"
|
||||
|
||||
namespace crashpad {
|
||||
|
||||
@ -183,7 +184,7 @@ class ExceptionHandlerServerRun : public UniversalMachExcServer::Interface,
|
||||
ExceptionHandlerServer::ExceptionHandlerServer(
|
||||
base::mac::ScopedMachReceiveRight receive_port,
|
||||
bool launchd)
|
||||
: receive_port_(receive_port.Pass()),
|
||||
: receive_port_(crashpad::move(receive_port)),
|
||||
notify_port_(NewMachPort(MACH_PORT_RIGHT_RECEIVE)),
|
||||
launchd_(launchd) {
|
||||
CHECK(receive_port_.is_valid());
|
||||
|
@ -19,6 +19,7 @@
|
||||
#include "minidump/minidump_simple_string_dictionary_writer.h"
|
||||
#include "snapshot/process_snapshot.h"
|
||||
#include "util/file/file_writer.h"
|
||||
#include "util/stdlib/move.h"
|
||||
|
||||
namespace crashpad {
|
||||
|
||||
@ -51,14 +52,14 @@ void MinidumpCrashpadInfoWriter::InitializeFromSnapshot(
|
||||
simple_annotations->InitializeFromMap(
|
||||
process_snapshot->AnnotationsSimpleMap());
|
||||
if (simple_annotations->IsUseful()) {
|
||||
SetSimpleAnnotations(simple_annotations.Pass());
|
||||
SetSimpleAnnotations(crashpad::move(simple_annotations));
|
||||
}
|
||||
|
||||
auto modules = make_scoped_ptr(new MinidumpModuleCrashpadInfoListWriter());
|
||||
modules->InitializeFromSnapshot(process_snapshot->Modules());
|
||||
|
||||
if (modules->IsUseful()) {
|
||||
SetModuleList(modules.Pass());
|
||||
SetModuleList(crashpad::move(modules));
|
||||
}
|
||||
}
|
||||
|
||||
@ -78,14 +79,14 @@ void MinidumpCrashpadInfoWriter::SetSimpleAnnotations(
|
||||
scoped_ptr<MinidumpSimpleStringDictionaryWriter> simple_annotations) {
|
||||
DCHECK_EQ(state(), kStateMutable);
|
||||
|
||||
simple_annotations_ = simple_annotations.Pass();
|
||||
simple_annotations_ = crashpad::move(simple_annotations);
|
||||
}
|
||||
|
||||
void MinidumpCrashpadInfoWriter::SetModuleList(
|
||||
scoped_ptr<MinidumpModuleCrashpadInfoListWriter> module_list) {
|
||||
DCHECK_EQ(state(), kStateMutable);
|
||||
|
||||
module_list_ = module_list.Pass();
|
||||
module_list_ = crashpad::move(module_list);
|
||||
}
|
||||
|
||||
bool MinidumpCrashpadInfoWriter::Freeze() {
|
||||
|
@ -31,6 +31,7 @@
|
||||
#include "snapshot/test/test_module_snapshot.h"
|
||||
#include "snapshot/test/test_process_snapshot.h"
|
||||
#include "util/file/string_file.h"
|
||||
#include "util/stdlib/move.h"
|
||||
|
||||
namespace crashpad {
|
||||
namespace test {
|
||||
@ -67,7 +68,7 @@ TEST(MinidumpCrashpadInfoWriter, Empty) {
|
||||
auto crashpad_info_writer = make_scoped_ptr(new MinidumpCrashpadInfoWriter());
|
||||
EXPECT_FALSE(crashpad_info_writer->IsUseful());
|
||||
|
||||
minidump_file_writer.AddStream(crashpad_info_writer.Pass());
|
||||
minidump_file_writer.AddStream(crashpad::move(crashpad_info_writer));
|
||||
|
||||
StringFile string_file;
|
||||
ASSERT_TRUE(minidump_file_writer.WriteEverything(&string_file));
|
||||
@ -102,7 +103,7 @@ TEST(MinidumpCrashpadInfoWriter, ReportAndClientID) {
|
||||
|
||||
EXPECT_TRUE(crashpad_info_writer->IsUseful());
|
||||
|
||||
minidump_file_writer.AddStream(crashpad_info_writer.Pass());
|
||||
minidump_file_writer.AddStream(crashpad::move(crashpad_info_writer));
|
||||
|
||||
StringFile string_file;
|
||||
ASSERT_TRUE(minidump_file_writer.WriteEverything(&string_file));
|
||||
@ -137,13 +138,13 @@ TEST(MinidumpCrashpadInfoWriter, SimpleAnnotations) {
|
||||
make_scoped_ptr(new MinidumpSimpleStringDictionaryEntryWriter());
|
||||
simple_string_dictionary_entry_writer->SetKeyValue(kKey, kValue);
|
||||
simple_string_dictionary_writer->AddEntry(
|
||||
simple_string_dictionary_entry_writer.Pass());
|
||||
crashpad::move(simple_string_dictionary_entry_writer));
|
||||
crashpad_info_writer->SetSimpleAnnotations(
|
||||
simple_string_dictionary_writer.Pass());
|
||||
crashpad::move(simple_string_dictionary_writer));
|
||||
|
||||
EXPECT_TRUE(crashpad_info_writer->IsUseful());
|
||||
|
||||
minidump_file_writer.AddStream(crashpad_info_writer.Pass());
|
||||
minidump_file_writer.AddStream(crashpad::move(crashpad_info_writer));
|
||||
|
||||
StringFile string_file;
|
||||
ASSERT_TRUE(minidump_file_writer.WriteEverything(&string_file));
|
||||
@ -177,12 +178,12 @@ TEST(MinidumpCrashpadInfoWriter, CrashpadModuleList) {
|
||||
auto module_list_writer =
|
||||
make_scoped_ptr(new MinidumpModuleCrashpadInfoListWriter());
|
||||
auto module_writer = make_scoped_ptr(new MinidumpModuleCrashpadInfoWriter());
|
||||
module_list_writer->AddModule(module_writer.Pass(), kMinidumpModuleListIndex);
|
||||
crashpad_info_writer->SetModuleList(module_list_writer.Pass());
|
||||
module_list_writer->AddModule(crashpad::move(module_writer), kMinidumpModuleListIndex);
|
||||
crashpad_info_writer->SetModuleList(crashpad::move(module_list_writer));
|
||||
|
||||
EXPECT_TRUE(crashpad_info_writer->IsUseful());
|
||||
|
||||
minidump_file_writer.AddStream(crashpad_info_writer.Pass());
|
||||
minidump_file_writer.AddStream(crashpad::move(crashpad_info_writer));
|
||||
|
||||
StringFile string_file;
|
||||
ASSERT_TRUE(minidump_file_writer.WriteEverything(&string_file));
|
||||
@ -232,7 +233,7 @@ TEST(MinidumpCrashpadInfoWriter, InitializeFromSnapshot) {
|
||||
auto process_snapshot = make_scoped_ptr(new TestProcessSnapshot());
|
||||
|
||||
auto module_snapshot = make_scoped_ptr(new TestModuleSnapshot());
|
||||
process_snapshot->AddModule(module_snapshot.Pass());
|
||||
process_snapshot->AddModule(crashpad::move(module_snapshot));
|
||||
|
||||
auto info_writer = make_scoped_ptr(new MinidumpCrashpadInfoWriter());
|
||||
info_writer->InitializeFromSnapshot(process_snapshot.get());
|
||||
@ -251,14 +252,14 @@ TEST(MinidumpCrashpadInfoWriter, InitializeFromSnapshot) {
|
||||
module_snapshot.reset(new TestModuleSnapshot());
|
||||
std::vector<std::string> annotations_list(1, std::string(kEntry));
|
||||
module_snapshot->SetAnnotationsVector(annotations_list);
|
||||
process_snapshot->AddModule(module_snapshot.Pass());
|
||||
process_snapshot->AddModule(crashpad::move(module_snapshot));
|
||||
|
||||
info_writer.reset(new MinidumpCrashpadInfoWriter());
|
||||
info_writer->InitializeFromSnapshot(process_snapshot.get());
|
||||
EXPECT_TRUE(info_writer->IsUseful());
|
||||
|
||||
MinidumpFileWriter minidump_file_writer;
|
||||
minidump_file_writer.AddStream(info_writer.Pass());
|
||||
minidump_file_writer.AddStream(crashpad::move(info_writer));
|
||||
|
||||
StringFile string_file;
|
||||
ASSERT_TRUE(minidump_file_writer.WriteEverything(&string_file));
|
||||
|
@ -21,6 +21,7 @@
|
||||
#include "minidump/minidump_context_writer.h"
|
||||
#include "snapshot/exception_snapshot.h"
|
||||
#include "util/file/file_writer.h"
|
||||
#include "util/stdlib/move.h"
|
||||
|
||||
namespace crashpad {
|
||||
|
||||
@ -48,14 +49,14 @@ void MinidumpExceptionWriter::InitializeFromSnapshot(
|
||||
|
||||
scoped_ptr<MinidumpContextWriter> context =
|
||||
MinidumpContextWriter::CreateFromSnapshot(exception_snapshot->Context());
|
||||
SetContext(context.Pass());
|
||||
SetContext(crashpad::move(context));
|
||||
}
|
||||
|
||||
void MinidumpExceptionWriter::SetContext(
|
||||
scoped_ptr<MinidumpContextWriter> context) {
|
||||
DCHECK_EQ(state(), kStateMutable);
|
||||
|
||||
context_ = context.Pass();
|
||||
context_ = crashpad::move(context);
|
||||
}
|
||||
|
||||
void MinidumpExceptionWriter::SetExceptionInformation(
|
||||
|
@ -35,6 +35,7 @@
|
||||
#include "snapshot/test/test_exception_snapshot.h"
|
||||
#include "test/gtest_death_check.h"
|
||||
#include "util/file/string_file.h"
|
||||
#include "util/stdlib/move.h"
|
||||
|
||||
namespace crashpad {
|
||||
namespace test {
|
||||
@ -104,9 +105,9 @@ TEST(MinidumpExceptionWriter, Minimal) {
|
||||
|
||||
auto context_x86_writer = make_scoped_ptr(new MinidumpContextX86Writer());
|
||||
InitializeMinidumpContextX86(context_x86_writer->context(), kSeed);
|
||||
exception_writer->SetContext(context_x86_writer.Pass());
|
||||
exception_writer->SetContext(crashpad::move(context_x86_writer));
|
||||
|
||||
minidump_file_writer.AddStream(exception_writer.Pass());
|
||||
minidump_file_writer.AddStream(crashpad::move(exception_writer));
|
||||
|
||||
StringFile string_file;
|
||||
ASSERT_TRUE(minidump_file_writer.WriteEverything(&string_file));
|
||||
@ -144,7 +145,7 @@ TEST(MinidumpExceptionWriter, Standard) {
|
||||
|
||||
auto context_x86_writer = make_scoped_ptr(new MinidumpContextX86Writer());
|
||||
InitializeMinidumpContextX86(context_x86_writer->context(), kSeed);
|
||||
exception_writer->SetContext(context_x86_writer.Pass());
|
||||
exception_writer->SetContext(crashpad::move(context_x86_writer));
|
||||
|
||||
exception_writer->SetThreadID(kThreadID);
|
||||
exception_writer->SetExceptionCode(kExceptionCode);
|
||||
@ -165,7 +166,7 @@ TEST(MinidumpExceptionWriter, Standard) {
|
||||
exception_information.push_back(kExceptionInformation2);
|
||||
exception_writer->SetExceptionInformation(exception_information);
|
||||
|
||||
minidump_file_writer.AddStream(exception_writer.Pass());
|
||||
minidump_file_writer.AddStream(crashpad::move(exception_writer));
|
||||
|
||||
StringFile string_file;
|
||||
ASSERT_TRUE(minidump_file_writer.WriteEverything(&string_file));
|
||||
@ -238,7 +239,7 @@ TEST(MinidumpExceptionWriter, InitializeFromSnapshot) {
|
||||
exception_writer->InitializeFromSnapshot(&exception_snapshot, thread_id_map);
|
||||
|
||||
MinidumpFileWriter minidump_file_writer;
|
||||
minidump_file_writer.AddStream(exception_writer.Pass());
|
||||
minidump_file_writer.AddStream(crashpad::move(exception_writer));
|
||||
|
||||
StringFile string_file;
|
||||
ASSERT_TRUE(minidump_file_writer.WriteEverything(&string_file));
|
||||
@ -260,7 +261,7 @@ TEST(MinidumpExceptionWriterDeathTest, NoContext) {
|
||||
MinidumpFileWriter minidump_file_writer;
|
||||
auto exception_writer = make_scoped_ptr(new MinidumpExceptionWriter());
|
||||
|
||||
minidump_file_writer.AddStream(exception_writer.Pass());
|
||||
minidump_file_writer.AddStream(crashpad::move(exception_writer));
|
||||
|
||||
StringFile string_file;
|
||||
ASSERT_DEATH_CHECK(minidump_file_writer.WriteEverything(&string_file),
|
||||
|
@ -28,6 +28,7 @@
|
||||
#include "minidump/minidump_writer_util.h"
|
||||
#include "snapshot/process_snapshot.h"
|
||||
#include "util/file/file_writer.h"
|
||||
#include "util/stdlib/move.h"
|
||||
#include "util/numeric/safe_assignment.h"
|
||||
|
||||
namespace crashpad {
|
||||
@ -67,11 +68,11 @@ void MinidumpFileWriter::InitializeFromSnapshot(
|
||||
const SystemSnapshot* system_snapshot = process_snapshot->System();
|
||||
auto system_info = make_scoped_ptr(new MinidumpSystemInfoWriter());
|
||||
system_info->InitializeFromSnapshot(system_snapshot);
|
||||
AddStream(system_info.Pass());
|
||||
AddStream(crashpad::move(system_info));
|
||||
|
||||
auto misc_info = make_scoped_ptr(new MinidumpMiscInfoWriter());
|
||||
misc_info->InitializeFromSnapshot(process_snapshot);
|
||||
AddStream(misc_info.Pass());
|
||||
AddStream(crashpad::move(misc_info));
|
||||
|
||||
auto memory_list = make_scoped_ptr(new MinidumpMemoryListWriter());
|
||||
auto thread_list = make_scoped_ptr(new MinidumpThreadListWriter());
|
||||
@ -79,18 +80,18 @@ void MinidumpFileWriter::InitializeFromSnapshot(
|
||||
MinidumpThreadIDMap thread_id_map;
|
||||
thread_list->InitializeFromSnapshot(process_snapshot->Threads(),
|
||||
&thread_id_map);
|
||||
AddStream(thread_list.Pass());
|
||||
AddStream(crashpad::move(thread_list));
|
||||
|
||||
const ExceptionSnapshot* exception_snapshot = process_snapshot->Exception();
|
||||
if (exception_snapshot) {
|
||||
auto exception = make_scoped_ptr(new MinidumpExceptionWriter());
|
||||
exception->InitializeFromSnapshot(exception_snapshot, thread_id_map);
|
||||
AddStream(exception.Pass());
|
||||
AddStream(crashpad::move(exception));
|
||||
}
|
||||
|
||||
auto module_list = make_scoped_ptr(new MinidumpModuleListWriter());
|
||||
module_list->InitializeFromSnapshot(process_snapshot->Modules());
|
||||
AddStream(module_list.Pass());
|
||||
AddStream(crashpad::move(module_list));
|
||||
|
||||
auto crashpad_info = make_scoped_ptr(new MinidumpCrashpadInfoWriter());
|
||||
crashpad_info->InitializeFromSnapshot(process_snapshot);
|
||||
@ -98,7 +99,7 @@ void MinidumpFileWriter::InitializeFromSnapshot(
|
||||
// Since the MinidumpCrashpadInfo stream is an extension, it’s safe to not add
|
||||
// it to the minidump file if it wouldn’t carry any useful information.
|
||||
if (crashpad_info->IsUseful()) {
|
||||
AddStream(crashpad_info.Pass());
|
||||
AddStream(crashpad::move(crashpad_info));
|
||||
}
|
||||
|
||||
std::vector<const MemoryMapRegionSnapshot*> memory_map_snapshot =
|
||||
@ -106,19 +107,19 @@ void MinidumpFileWriter::InitializeFromSnapshot(
|
||||
if (!memory_map_snapshot.empty()) {
|
||||
auto memory_info_list = make_scoped_ptr(new MinidumpMemoryInfoListWriter());
|
||||
memory_info_list->InitializeFromSnapshot(memory_map_snapshot);
|
||||
AddStream(memory_info_list.Pass());
|
||||
AddStream(crashpad::move(memory_info_list));
|
||||
}
|
||||
|
||||
std::vector<HandleSnapshot> handles_snapshot = process_snapshot->Handles();
|
||||
if (!handles_snapshot.empty()) {
|
||||
auto handle_data_writer = make_scoped_ptr(new MinidumpHandleDataWriter());
|
||||
handle_data_writer->InitializeFromSnapshot(handles_snapshot);
|
||||
AddStream(handle_data_writer.Pass());
|
||||
AddStream(crashpad::move(handle_data_writer));
|
||||
}
|
||||
|
||||
memory_list->AddFromSnapshot(process_snapshot->ExtraMemory());
|
||||
|
||||
AddStream(memory_list.Pass());
|
||||
AddStream(crashpad::move(memory_list));
|
||||
}
|
||||
|
||||
void MinidumpFileWriter::SetTimestamp(time_t timestamp) {
|
||||
|
@ -35,6 +35,7 @@
|
||||
#include "snapshot/test/test_thread_snapshot.h"
|
||||
#include "test/gtest_death_check.h"
|
||||
#include "util/file/string_file.h"
|
||||
#include "util/stdlib/move.h"
|
||||
|
||||
namespace crashpad {
|
||||
namespace test {
|
||||
@ -96,7 +97,7 @@ TEST(MinidumpFileWriter, OneStream) {
|
||||
const uint8_t kStreamValue = 0x5a;
|
||||
auto stream =
|
||||
make_scoped_ptr(new TestStream(kStreamType, kStreamSize, kStreamValue));
|
||||
minidump_file.AddStream(stream.Pass());
|
||||
minidump_file.AddStream(crashpad::move(stream));
|
||||
|
||||
StringFile string_file;
|
||||
ASSERT_TRUE(minidump_file.WriteEverything(&string_file));
|
||||
@ -135,7 +136,7 @@ TEST(MinidumpFileWriter, ThreeStreams) {
|
||||
const uint8_t kStream0Value = 0x5a;
|
||||
auto stream0 = make_scoped_ptr(
|
||||
new TestStream(kStream0Type, kStream0Size, kStream0Value));
|
||||
minidump_file.AddStream(stream0.Pass());
|
||||
minidump_file.AddStream(crashpad::move(stream0));
|
||||
|
||||
// Make the second stream’s type be a smaller quantity than the first stream’s
|
||||
// to test that the streams show up in the order that they were added, not in
|
||||
@ -145,14 +146,14 @@ TEST(MinidumpFileWriter, ThreeStreams) {
|
||||
const uint8_t kStream1Value = 0xa5;
|
||||
auto stream1 = make_scoped_ptr(
|
||||
new TestStream(kStream1Type, kStream1Size, kStream1Value));
|
||||
minidump_file.AddStream(stream1.Pass());
|
||||
minidump_file.AddStream(crashpad::move(stream1));
|
||||
|
||||
const size_t kStream2Size = 1;
|
||||
const MinidumpStreamType kStream2Type = static_cast<MinidumpStreamType>(0x7e);
|
||||
const uint8_t kStream2Value = 0x36;
|
||||
auto stream2 = make_scoped_ptr(
|
||||
new TestStream(kStream2Type, kStream2Size, kStream2Value));
|
||||
minidump_file.AddStream(stream2.Pass());
|
||||
minidump_file.AddStream(crashpad::move(stream2));
|
||||
|
||||
StringFile string_file;
|
||||
ASSERT_TRUE(minidump_file.WriteEverything(&string_file));
|
||||
@ -219,7 +220,7 @@ TEST(MinidumpFileWriter, ZeroLengthStream) {
|
||||
const size_t kStreamSize = 0;
|
||||
const MinidumpStreamType kStreamType = static_cast<MinidumpStreamType>(0x4d);
|
||||
auto stream = make_scoped_ptr(new TestStream(kStreamType, kStreamSize, 0));
|
||||
minidump_file.AddStream(stream.Pass());
|
||||
minidump_file.AddStream(crashpad::move(stream));
|
||||
|
||||
StringFile string_file;
|
||||
ASSERT_TRUE(minidump_file.WriteEverything(&string_file));
|
||||
@ -251,7 +252,7 @@ TEST(MinidumpFileWriter, InitializeFromSnapshot_Basic) {
|
||||
auto system_snapshot = make_scoped_ptr(new TestSystemSnapshot());
|
||||
system_snapshot->SetCPUArchitecture(kCPUArchitectureX86_64);
|
||||
system_snapshot->SetOperatingSystem(SystemSnapshot::kOperatingSystemMacOSX);
|
||||
process_snapshot.SetSystem(system_snapshot.Pass());
|
||||
process_snapshot.SetSystem(crashpad::move(system_snapshot));
|
||||
|
||||
auto peb_snapshot = make_scoped_ptr(new TestMemorySnapshot());
|
||||
const uint64_t kPebAddress = 0x07f90000;
|
||||
@ -259,7 +260,7 @@ TEST(MinidumpFileWriter, InitializeFromSnapshot_Basic) {
|
||||
const size_t kPebSize = 0x280;
|
||||
peb_snapshot->SetSize(kPebSize);
|
||||
peb_snapshot->SetValue('p');
|
||||
process_snapshot.AddExtraMemory(peb_snapshot.Pass());
|
||||
process_snapshot.AddExtraMemory(crashpad::move(peb_snapshot));
|
||||
|
||||
MinidumpFileWriter minidump_file_writer;
|
||||
minidump_file_writer.InitializeFromSnapshot(&process_snapshot);
|
||||
@ -315,22 +316,22 @@ TEST(MinidumpFileWriter, InitializeFromSnapshot_Exception) {
|
||||
auto system_snapshot = make_scoped_ptr(new TestSystemSnapshot());
|
||||
system_snapshot->SetCPUArchitecture(kCPUArchitectureX86_64);
|
||||
system_snapshot->SetOperatingSystem(SystemSnapshot::kOperatingSystemMacOSX);
|
||||
process_snapshot.SetSystem(system_snapshot.Pass());
|
||||
process_snapshot.SetSystem(crashpad::move(system_snapshot));
|
||||
|
||||
auto thread_snapshot = make_scoped_ptr(new TestThreadSnapshot());
|
||||
InitializeCPUContextX86_64(thread_snapshot->MutableContext(), 5);
|
||||
process_snapshot.AddThread(thread_snapshot.Pass());
|
||||
process_snapshot.AddThread(crashpad::move(thread_snapshot));
|
||||
|
||||
auto exception_snapshot = make_scoped_ptr(new TestExceptionSnapshot());
|
||||
InitializeCPUContextX86_64(exception_snapshot->MutableContext(), 11);
|
||||
process_snapshot.SetException(exception_snapshot.Pass());
|
||||
process_snapshot.SetException(crashpad::move(exception_snapshot));
|
||||
|
||||
// The module does not have anything that needs to be represented in a
|
||||
// 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 = make_scoped_ptr(new TestModuleSnapshot());
|
||||
process_snapshot.AddModule(module_snapshot.Pass());
|
||||
process_snapshot.AddModule(crashpad::move(module_snapshot));
|
||||
|
||||
MinidumpFileWriter minidump_file_writer;
|
||||
minidump_file_writer.InitializeFromSnapshot(&process_snapshot);
|
||||
@ -379,22 +380,22 @@ TEST(MinidumpFileWriter, InitializeFromSnapshot_CrashpadInfo) {
|
||||
auto system_snapshot = make_scoped_ptr(new TestSystemSnapshot());
|
||||
system_snapshot->SetCPUArchitecture(kCPUArchitectureX86_64);
|
||||
system_snapshot->SetOperatingSystem(SystemSnapshot::kOperatingSystemMacOSX);
|
||||
process_snapshot.SetSystem(system_snapshot.Pass());
|
||||
process_snapshot.SetSystem(crashpad::move(system_snapshot));
|
||||
|
||||
auto thread_snapshot = make_scoped_ptr(new TestThreadSnapshot());
|
||||
InitializeCPUContextX86_64(thread_snapshot->MutableContext(), 5);
|
||||
process_snapshot.AddThread(thread_snapshot.Pass());
|
||||
process_snapshot.AddThread(crashpad::move(thread_snapshot));
|
||||
|
||||
auto exception_snapshot = make_scoped_ptr(new TestExceptionSnapshot());
|
||||
InitializeCPUContextX86_64(exception_snapshot->MutableContext(), 11);
|
||||
process_snapshot.SetException(exception_snapshot.Pass());
|
||||
process_snapshot.SetException(crashpad::move(exception_snapshot));
|
||||
|
||||
// The module needs an annotation for the MinidumpCrashpadInfo stream to be
|
||||
// considered useful and be included.
|
||||
auto module_snapshot = make_scoped_ptr(new TestModuleSnapshot());
|
||||
std::vector<std::string> annotations_list(1, std::string("annotation"));
|
||||
module_snapshot->SetAnnotationsVector(annotations_list);
|
||||
process_snapshot.AddModule(module_snapshot.Pass());
|
||||
process_snapshot.AddModule(crashpad::move(module_snapshot));
|
||||
|
||||
MinidumpFileWriter minidump_file_writer;
|
||||
minidump_file_writer.InitializeFromSnapshot(&process_snapshot);
|
||||
@ -445,7 +446,7 @@ TEST(MinidumpFileWriterDeathTest, SameStreamType) {
|
||||
const uint8_t kStream0Value = 0x5a;
|
||||
auto stream0 = make_scoped_ptr(
|
||||
new TestStream(kStream0Type, kStream0Size, kStream0Value));
|
||||
minidump_file.AddStream(stream0.Pass());
|
||||
minidump_file.AddStream(crashpad::move(stream0));
|
||||
|
||||
// It is an error to add a second stream of the same type.
|
||||
const size_t kStream1Size = 3;
|
||||
@ -453,7 +454,7 @@ TEST(MinidumpFileWriterDeathTest, SameStreamType) {
|
||||
const uint8_t kStream1Value = 0xa5;
|
||||
auto stream1 = make_scoped_ptr(
|
||||
new TestStream(kStream1Type, kStream1Size, kStream1Value));
|
||||
ASSERT_DEATH_CHECK(minidump_file.AddStream(stream1.Pass()),
|
||||
ASSERT_DEATH_CHECK(minidump_file.AddStream(crashpad::move(stream1)),
|
||||
"already present");
|
||||
}
|
||||
|
||||
|
@ -23,6 +23,7 @@
|
||||
#include "minidump/test/minidump_string_writer_test_util.h"
|
||||
#include "minidump/test/minidump_writable_test_util.h"
|
||||
#include "util/file/string_file.h"
|
||||
#include "util/stdlib/move.h"
|
||||
|
||||
namespace crashpad {
|
||||
namespace test {
|
||||
@ -57,7 +58,7 @@ void GetHandleDataStream(
|
||||
TEST(MinidumpHandleDataWriter, Empty) {
|
||||
MinidumpFileWriter minidump_file_writer;
|
||||
auto handle_data_writer = make_scoped_ptr(new MinidumpHandleDataWriter());
|
||||
minidump_file_writer.AddStream(handle_data_writer.Pass());
|
||||
minidump_file_writer.AddStream(crashpad::move(handle_data_writer));
|
||||
|
||||
StringFile string_file;
|
||||
ASSERT_TRUE(minidump_file_writer.WriteEverything(&string_file));
|
||||
@ -90,7 +91,7 @@ TEST(MinidumpHandleDataWriter, OneHandle) {
|
||||
|
||||
handle_data_writer->InitializeFromSnapshot(snapshot);
|
||||
|
||||
minidump_file_writer.AddStream(handle_data_writer.Pass());
|
||||
minidump_file_writer.AddStream(crashpad::move(handle_data_writer));
|
||||
|
||||
StringFile string_file;
|
||||
ASSERT_TRUE(minidump_file_writer.WriteEverything(&string_file));
|
||||
@ -148,7 +149,7 @@ TEST(MinidumpHandleDataWriter, RepeatedTypeName) {
|
||||
|
||||
handle_data_writer->InitializeFromSnapshot(snapshot);
|
||||
|
||||
minidump_file_writer.AddStream(handle_data_writer.Pass());
|
||||
minidump_file_writer.AddStream(crashpad::move(handle_data_writer));
|
||||
|
||||
StringFile string_file;
|
||||
ASSERT_TRUE(minidump_file_writer.WriteEverything(&string_file));
|
||||
|
@ -22,6 +22,7 @@
|
||||
#include "minidump/test/minidump_writable_test_util.h"
|
||||
#include "snapshot/test/test_memory_map_region_snapshot.h"
|
||||
#include "util/file/string_file.h"
|
||||
#include "util/stdlib/move.h"
|
||||
|
||||
namespace crashpad {
|
||||
namespace test {
|
||||
@ -58,7 +59,7 @@ TEST(MinidumpMemoryInfoWriter, Empty) {
|
||||
MinidumpFileWriter minidump_file_writer;
|
||||
auto memory_info_list_writer =
|
||||
make_scoped_ptr(new MinidumpMemoryInfoListWriter());
|
||||
minidump_file_writer.AddStream(memory_info_list_writer.Pass());
|
||||
minidump_file_writer.AddStream(crashpad::move(memory_info_list_writer));
|
||||
|
||||
StringFile string_file;
|
||||
ASSERT_TRUE(minidump_file_writer.WriteEverything(&string_file));
|
||||
@ -95,7 +96,7 @@ TEST(MinidumpMemoryInfoWriter, OneRegion) {
|
||||
memory_map.push_back(memory_map_region.get());
|
||||
memory_info_list_writer->InitializeFromSnapshot(memory_map);
|
||||
|
||||
minidump_file_writer.AddStream(memory_info_list_writer.Pass());
|
||||
minidump_file_writer.AddStream(crashpad::move(memory_info_list_writer));
|
||||
|
||||
StringFile string_file;
|
||||
ASSERT_TRUE(minidump_file_writer.WriteEverything(&string_file));
|
||||
|
@ -18,6 +18,7 @@
|
||||
#include "base/logging.h"
|
||||
#include "snapshot/memory_snapshot.h"
|
||||
#include "util/file/file_writer.h"
|
||||
#include "util/stdlib/move.h"
|
||||
#include "util/numeric/safe_assignment.h"
|
||||
|
||||
namespace crashpad {
|
||||
@ -177,7 +178,7 @@ void MinidumpMemoryListWriter::AddFromSnapshot(
|
||||
for (const MemorySnapshot* memory_snapshot : memory_snapshots) {
|
||||
scoped_ptr<MinidumpMemoryWriter> memory =
|
||||
MinidumpMemoryWriter::CreateFromSnapshot(memory_snapshot);
|
||||
AddMemory(memory.Pass());
|
||||
AddMemory(crashpad::move(memory));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -30,6 +30,7 @@
|
||||
#include "minidump/test/minidump_writable_test_util.h"
|
||||
#include "snapshot/test/test_memory_snapshot.h"
|
||||
#include "util/file/string_file.h"
|
||||
#include "util/stdlib/move.h"
|
||||
#include "util/stdlib/pointer_container.h"
|
||||
|
||||
namespace crashpad {
|
||||
@ -80,7 +81,7 @@ TEST(MinidumpMemoryWriter, EmptyMemoryList) {
|
||||
MinidumpFileWriter minidump_file_writer;
|
||||
auto memory_list_writer = make_scoped_ptr(new MinidumpMemoryListWriter());
|
||||
|
||||
minidump_file_writer.AddStream(memory_list_writer.Pass());
|
||||
minidump_file_writer.AddStream(crashpad::move(memory_list_writer));
|
||||
|
||||
StringFile string_file;
|
||||
ASSERT_TRUE(minidump_file_writer.WriteEverything(&string_file));
|
||||
@ -106,9 +107,9 @@ TEST(MinidumpMemoryWriter, OneMemoryRegion) {
|
||||
|
||||
auto memory_writer = make_scoped_ptr(
|
||||
new TestMinidumpMemoryWriter(kBaseAddress, kSize, kValue));
|
||||
memory_list_writer->AddMemory(memory_writer.Pass());
|
||||
memory_list_writer->AddMemory(crashpad::move(memory_writer));
|
||||
|
||||
minidump_file_writer.AddStream(memory_list_writer.Pass());
|
||||
minidump_file_writer.AddStream(crashpad::move(memory_list_writer));
|
||||
|
||||
StringFile string_file;
|
||||
ASSERT_TRUE(minidump_file_writer.WriteEverything(&string_file));
|
||||
@ -144,12 +145,12 @@ TEST(MinidumpMemoryWriter, TwoMemoryRegions) {
|
||||
|
||||
auto memory_writer_0 = make_scoped_ptr(
|
||||
new TestMinidumpMemoryWriter(kBaseAddress0, kSize0, kValue0));
|
||||
memory_list_writer->AddMemory(memory_writer_0.Pass());
|
||||
memory_list_writer->AddMemory(crashpad::move(memory_writer_0));
|
||||
auto memory_writer_1 = make_scoped_ptr(
|
||||
new TestMinidumpMemoryWriter(kBaseAddress1, kSize1, kValue1));
|
||||
memory_list_writer->AddMemory(memory_writer_1.Pass());
|
||||
memory_list_writer->AddMemory(crashpad::move(memory_writer_1));
|
||||
|
||||
minidump_file_writer.AddStream(memory_list_writer.Pass());
|
||||
minidump_file_writer.AddStream(crashpad::move(memory_list_writer));
|
||||
|
||||
StringFile string_file;
|
||||
ASSERT_TRUE(minidump_file_writer.WriteEverything(&string_file));
|
||||
@ -248,7 +249,7 @@ TEST(MinidumpMemoryWriter, ExtraMemory) {
|
||||
auto memory_list_writer = make_scoped_ptr(new MinidumpMemoryListWriter());
|
||||
memory_list_writer->AddExtraMemory(test_memory_stream->memory());
|
||||
|
||||
minidump_file_writer.AddStream(test_memory_stream.Pass());
|
||||
minidump_file_writer.AddStream(crashpad::move(test_memory_stream));
|
||||
|
||||
const uint64_t kBaseAddress1 = 0x2000;
|
||||
const size_t kSize1 = 0x0400;
|
||||
@ -256,9 +257,9 @@ TEST(MinidumpMemoryWriter, ExtraMemory) {
|
||||
|
||||
auto memory_writer = make_scoped_ptr(
|
||||
new TestMinidumpMemoryWriter(kBaseAddress1, kSize1, kValue1));
|
||||
memory_list_writer->AddMemory(memory_writer.Pass());
|
||||
memory_list_writer->AddMemory(crashpad::move(memory_writer));
|
||||
|
||||
minidump_file_writer.AddStream(memory_list_writer.Pass());
|
||||
minidump_file_writer.AddStream(crashpad::move(memory_list_writer));
|
||||
|
||||
StringFile string_file;
|
||||
ASSERT_TRUE(minidump_file_writer.WriteEverything(&string_file));
|
||||
@ -336,7 +337,7 @@ TEST(MinidumpMemoryWriter, AddFromSnapshot) {
|
||||
memory_list_writer->AddFromSnapshot(memory_snapshots);
|
||||
|
||||
MinidumpFileWriter minidump_file_writer;
|
||||
minidump_file_writer.AddStream(memory_list_writer.Pass());
|
||||
minidump_file_writer.AddStream(crashpad::move(memory_list_writer));
|
||||
|
||||
StringFile string_file;
|
||||
ASSERT_TRUE(minidump_file_writer.WriteEverything(&string_file));
|
||||
|
@ -32,6 +32,7 @@
|
||||
#include "snapshot/test/test_process_snapshot.h"
|
||||
#include "snapshot/test/test_system_snapshot.h"
|
||||
#include "util/file/string_file.h"
|
||||
#include "util/stdlib/move.h"
|
||||
#include "util/stdlib/strlcpy.h"
|
||||
|
||||
namespace crashpad {
|
||||
@ -168,7 +169,7 @@ TEST(MinidumpMiscInfoWriter, Empty) {
|
||||
MinidumpFileWriter minidump_file_writer;
|
||||
auto misc_info_writer = make_scoped_ptr(new MinidumpMiscInfoWriter());
|
||||
|
||||
minidump_file_writer.AddStream(misc_info_writer.Pass());
|
||||
minidump_file_writer.AddStream(crashpad::move(misc_info_writer));
|
||||
|
||||
StringFile string_file;
|
||||
ASSERT_TRUE(minidump_file_writer.WriteEverything(&string_file));
|
||||
@ -189,7 +190,7 @@ TEST(MinidumpMiscInfoWriter, ProcessId) {
|
||||
|
||||
misc_info_writer->SetProcessID(kProcessId);
|
||||
|
||||
minidump_file_writer.AddStream(misc_info_writer.Pass());
|
||||
minidump_file_writer.AddStream(crashpad::move(misc_info_writer));
|
||||
|
||||
StringFile string_file;
|
||||
ASSERT_TRUE(minidump_file_writer.WriteEverything(&string_file));
|
||||
@ -215,7 +216,7 @@ TEST(MinidumpMiscInfoWriter, ProcessTimes) {
|
||||
misc_info_writer->SetProcessTimes(
|
||||
kProcessCreateTime, kProcessUserTime, kProcessKernelTime);
|
||||
|
||||
minidump_file_writer.AddStream(misc_info_writer.Pass());
|
||||
minidump_file_writer.AddStream(crashpad::move(misc_info_writer));
|
||||
|
||||
StringFile string_file;
|
||||
ASSERT_TRUE(minidump_file_writer.WriteEverything(&string_file));
|
||||
@ -248,7 +249,7 @@ TEST(MinidumpMiscInfoWriter, ProcessorPowerInfo) {
|
||||
kProcessorMaxIdleState,
|
||||
kProcessorCurrentIdleState);
|
||||
|
||||
minidump_file_writer.AddStream(misc_info_writer.Pass());
|
||||
minidump_file_writer.AddStream(crashpad::move(misc_info_writer));
|
||||
|
||||
StringFile string_file;
|
||||
ASSERT_TRUE(minidump_file_writer.WriteEverything(&string_file));
|
||||
@ -275,7 +276,7 @@ TEST(MinidumpMiscInfoWriter, ProcessIntegrityLevel) {
|
||||
|
||||
misc_info_writer->SetProcessIntegrityLevel(kProcessIntegrityLevel);
|
||||
|
||||
minidump_file_writer.AddStream(misc_info_writer.Pass());
|
||||
minidump_file_writer.AddStream(crashpad::move(misc_info_writer));
|
||||
|
||||
StringFile string_file;
|
||||
ASSERT_TRUE(minidump_file_writer.WriteEverything(&string_file));
|
||||
@ -298,7 +299,7 @@ TEST(MinidumpMiscInfoWriter, ProcessExecuteFlags) {
|
||||
|
||||
misc_info_writer->SetProcessExecuteFlags(kProcessExecuteFlags);
|
||||
|
||||
minidump_file_writer.AddStream(misc_info_writer.Pass());
|
||||
minidump_file_writer.AddStream(crashpad::move(misc_info_writer));
|
||||
|
||||
StringFile string_file;
|
||||
ASSERT_TRUE(minidump_file_writer.WriteEverything(&string_file));
|
||||
@ -321,7 +322,7 @@ TEST(MinidumpMiscInfoWriter, ProtectedProcess) {
|
||||
|
||||
misc_info_writer->SetProtectedProcess(kProtectedProcess);
|
||||
|
||||
minidump_file_writer.AddStream(misc_info_writer.Pass());
|
||||
minidump_file_writer.AddStream(crashpad::move(misc_info_writer));
|
||||
|
||||
StringFile string_file;
|
||||
ASSERT_TRUE(minidump_file_writer.WriteEverything(&string_file));
|
||||
@ -358,7 +359,7 @@ TEST(MinidumpMiscInfoWriter, TimeZone) {
|
||||
kDaylightDate,
|
||||
kDaylightBias);
|
||||
|
||||
minidump_file_writer.AddStream(misc_info_writer.Pass());
|
||||
minidump_file_writer.AddStream(crashpad::move(misc_info_writer));
|
||||
|
||||
StringFile string_file;
|
||||
ASSERT_TRUE(minidump_file_writer.WriteEverything(&string_file));
|
||||
@ -419,7 +420,7 @@ TEST(MinidumpMiscInfoWriter, TimeZoneStringsOverflow) {
|
||||
kSystemTimeZero,
|
||||
kDaylightBias);
|
||||
|
||||
minidump_file_writer.AddStream(misc_info_writer.Pass());
|
||||
minidump_file_writer.AddStream(crashpad::move(misc_info_writer));
|
||||
|
||||
StringFile string_file;
|
||||
ASSERT_TRUE(minidump_file_writer.WriteEverything(&string_file));
|
||||
@ -460,7 +461,7 @@ TEST(MinidumpMiscInfoWriter, BuildStrings) {
|
||||
|
||||
misc_info_writer->SetBuildString(kBuildString, kDebugBuildString);
|
||||
|
||||
minidump_file_writer.AddStream(misc_info_writer.Pass());
|
||||
minidump_file_writer.AddStream(crashpad::move(misc_info_writer));
|
||||
|
||||
StringFile string_file;
|
||||
ASSERT_TRUE(minidump_file_writer.WriteEverything(&string_file));
|
||||
@ -497,7 +498,7 @@ TEST(MinidumpMiscInfoWriter, BuildStringsOverflow) {
|
||||
|
||||
misc_info_writer->SetBuildString(build_string, debug_build_string);
|
||||
|
||||
minidump_file_writer.AddStream(misc_info_writer.Pass());
|
||||
minidump_file_writer.AddStream(crashpad::move(misc_info_writer));
|
||||
|
||||
StringFile string_file;
|
||||
ASSERT_TRUE(minidump_file_writer.WriteEverything(&string_file));
|
||||
@ -567,7 +568,7 @@ TEST(MinidumpMiscInfoWriter, Everything) {
|
||||
kDaylightBias);
|
||||
misc_info_writer->SetBuildString(kBuildString, kDebugBuildString);
|
||||
|
||||
minidump_file_writer.AddStream(misc_info_writer.Pass());
|
||||
minidump_file_writer.AddStream(crashpad::move(misc_info_writer));
|
||||
|
||||
StringFile string_file;
|
||||
ASSERT_TRUE(minidump_file_writer.WriteEverything(&string_file));
|
||||
@ -701,13 +702,13 @@ TEST(MinidumpMiscInfoWriter, InitializeFromSnapshot) {
|
||||
system_snapshot->SetOSVersionFull(kOSVersionFull);
|
||||
system_snapshot->SetMachineDescription(kMachineDescription);
|
||||
|
||||
process_snapshot.SetSystem(system_snapshot.Pass());
|
||||
process_snapshot.SetSystem(crashpad::move(system_snapshot));
|
||||
|
||||
auto misc_info_writer = make_scoped_ptr(new MinidumpMiscInfoWriter());
|
||||
misc_info_writer->InitializeFromSnapshot(&process_snapshot);
|
||||
|
||||
MinidumpFileWriter minidump_file_writer;
|
||||
minidump_file_writer.AddStream(misc_info_writer.Pass());
|
||||
minidump_file_writer.AddStream(crashpad::move(misc_info_writer));
|
||||
|
||||
StringFile string_file;
|
||||
ASSERT_TRUE(minidump_file_writer.WriteEverything(&string_file));
|
||||
|
@ -20,6 +20,7 @@
|
||||
#include "minidump/minidump_simple_string_dictionary_writer.h"
|
||||
#include "snapshot/module_snapshot.h"
|
||||
#include "util/file/file_writer.h"
|
||||
#include "util/stdlib/move.h"
|
||||
#include "util/numeric/safe_assignment.h"
|
||||
|
||||
namespace crashpad {
|
||||
@ -44,7 +45,7 @@ void MinidumpModuleCrashpadInfoWriter::InitializeFromSnapshot(
|
||||
auto list_annotations = make_scoped_ptr(new MinidumpUTF8StringListWriter());
|
||||
list_annotations->InitializeFromVector(module_snapshot->AnnotationsVector());
|
||||
if (list_annotations->IsUseful()) {
|
||||
SetListAnnotations(list_annotations.Pass());
|
||||
SetListAnnotations(crashpad::move(list_annotations));
|
||||
}
|
||||
|
||||
auto simple_annotations =
|
||||
@ -52,7 +53,7 @@ void MinidumpModuleCrashpadInfoWriter::InitializeFromSnapshot(
|
||||
simple_annotations->InitializeFromMap(
|
||||
module_snapshot->AnnotationsSimpleMap());
|
||||
if (simple_annotations->IsUseful()) {
|
||||
SetSimpleAnnotations(simple_annotations.Pass());
|
||||
SetSimpleAnnotations(crashpad::move(simple_annotations));
|
||||
}
|
||||
}
|
||||
|
||||
@ -60,14 +61,14 @@ void MinidumpModuleCrashpadInfoWriter::SetListAnnotations(
|
||||
scoped_ptr<MinidumpUTF8StringListWriter> list_annotations) {
|
||||
DCHECK_EQ(state(), kStateMutable);
|
||||
|
||||
list_annotations_ = list_annotations.Pass();
|
||||
list_annotations_ = crashpad::move(list_annotations);
|
||||
}
|
||||
|
||||
void MinidumpModuleCrashpadInfoWriter::SetSimpleAnnotations(
|
||||
scoped_ptr<MinidumpSimpleStringDictionaryWriter> simple_annotations) {
|
||||
DCHECK_EQ(state(), kStateMutable);
|
||||
|
||||
simple_annotations_ = simple_annotations.Pass();
|
||||
simple_annotations_ = crashpad::move(simple_annotations);
|
||||
}
|
||||
|
||||
bool MinidumpModuleCrashpadInfoWriter::IsUseful() const {
|
||||
@ -144,7 +145,7 @@ void MinidumpModuleCrashpadInfoListWriter::InitializeFromSnapshot(
|
||||
auto module = make_scoped_ptr(new MinidumpModuleCrashpadInfoWriter());
|
||||
module->InitializeFromSnapshot(module_snapshot);
|
||||
if (module->IsUseful()) {
|
||||
AddModule(module.Pass(), index);
|
||||
AddModule(crashpad::move(module), index);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -25,6 +25,7 @@
|
||||
#include "minidump/test/minidump_writable_test_util.h"
|
||||
#include "snapshot/test/test_module_snapshot.h"
|
||||
#include "util/file/string_file.h"
|
||||
#include "util/stdlib/move.h"
|
||||
|
||||
namespace crashpad {
|
||||
namespace test {
|
||||
@ -77,7 +78,7 @@ TEST(MinidumpModuleCrashpadInfoWriter, EmptyModule) {
|
||||
make_scoped_ptr(new MinidumpModuleCrashpadInfoListWriter());
|
||||
auto module_writer = make_scoped_ptr(new MinidumpModuleCrashpadInfoWriter());
|
||||
EXPECT_FALSE(module_writer->IsUseful());
|
||||
module_list_writer->AddModule(module_writer.Pass(), 0);
|
||||
module_list_writer->AddModule(crashpad::move(module_writer), 0);
|
||||
|
||||
EXPECT_TRUE(module_list_writer->IsUseful());
|
||||
|
||||
@ -119,17 +120,19 @@ TEST(MinidumpModuleCrashpadInfoWriter, FullModule) {
|
||||
auto module_writer = make_scoped_ptr(new MinidumpModuleCrashpadInfoWriter());
|
||||
auto string_list_writer = make_scoped_ptr(new MinidumpUTF8StringListWriter());
|
||||
string_list_writer->InitializeFromVector(vector);
|
||||
module_writer->SetListAnnotations(string_list_writer.Pass());
|
||||
module_writer->SetListAnnotations(crashpad::move(string_list_writer));
|
||||
auto simple_string_dictionary_writer =
|
||||
make_scoped_ptr(new MinidumpSimpleStringDictionaryWriter());
|
||||
auto simple_string_dictionary_entry_writer =
|
||||
make_scoped_ptr(new MinidumpSimpleStringDictionaryEntryWriter());
|
||||
simple_string_dictionary_entry_writer->SetKeyValue(kKey, kValue);
|
||||
simple_string_dictionary_writer->AddEntry(
|
||||
simple_string_dictionary_entry_writer.Pass());
|
||||
module_writer->SetSimpleAnnotations(simple_string_dictionary_writer.Pass());
|
||||
crashpad::move(simple_string_dictionary_entry_writer));
|
||||
module_writer->SetSimpleAnnotations(
|
||||
crashpad::move(simple_string_dictionary_writer));
|
||||
EXPECT_TRUE(module_writer->IsUseful());
|
||||
module_list_writer->AddModule(module_writer.Pass(), kMinidumpModuleListIndex);
|
||||
module_list_writer->AddModule(crashpad::move(module_writer),
|
||||
kMinidumpModuleListIndex);
|
||||
|
||||
EXPECT_TRUE(module_list_writer->IsUseful());
|
||||
|
||||
@ -211,17 +214,17 @@ TEST(MinidumpModuleCrashpadInfoWriter, ThreeModules) {
|
||||
make_scoped_ptr(new MinidumpSimpleStringDictionaryEntryWriter());
|
||||
simple_string_dictionary_entry_writer_0->SetKeyValue(kKey0, kValue0);
|
||||
simple_string_dictionary_writer_0->AddEntry(
|
||||
simple_string_dictionary_entry_writer_0.Pass());
|
||||
crashpad::move(simple_string_dictionary_entry_writer_0));
|
||||
module_writer_0->SetSimpleAnnotations(
|
||||
simple_string_dictionary_writer_0.Pass());
|
||||
crashpad::move(simple_string_dictionary_writer_0));
|
||||
EXPECT_TRUE(module_writer_0->IsUseful());
|
||||
module_list_writer->AddModule(module_writer_0.Pass(),
|
||||
module_list_writer->AddModule(crashpad::move(module_writer_0),
|
||||
kMinidumpModuleListIndex0);
|
||||
|
||||
auto module_writer_1 =
|
||||
make_scoped_ptr(new MinidumpModuleCrashpadInfoWriter());
|
||||
EXPECT_FALSE(module_writer_1->IsUseful());
|
||||
module_list_writer->AddModule(module_writer_1.Pass(),
|
||||
module_list_writer->AddModule(crashpad::move(module_writer_1),
|
||||
kMinidumpModuleListIndex1);
|
||||
|
||||
auto module_writer_2 =
|
||||
@ -232,16 +235,16 @@ TEST(MinidumpModuleCrashpadInfoWriter, ThreeModules) {
|
||||
make_scoped_ptr(new MinidumpSimpleStringDictionaryEntryWriter());
|
||||
simple_string_dictionary_entry_writer_2a->SetKeyValue(kKey2A, kValue2A);
|
||||
simple_string_dictionary_writer_2->AddEntry(
|
||||
simple_string_dictionary_entry_writer_2a.Pass());
|
||||
crashpad::move(simple_string_dictionary_entry_writer_2a));
|
||||
auto simple_string_dictionary_entry_writer_2b =
|
||||
make_scoped_ptr(new MinidumpSimpleStringDictionaryEntryWriter());
|
||||
simple_string_dictionary_entry_writer_2b->SetKeyValue(kKey2B, kValue2B);
|
||||
simple_string_dictionary_writer_2->AddEntry(
|
||||
simple_string_dictionary_entry_writer_2b.Pass());
|
||||
crashpad::move(simple_string_dictionary_entry_writer_2b));
|
||||
module_writer_2->SetSimpleAnnotations(
|
||||
simple_string_dictionary_writer_2.Pass());
|
||||
crashpad::move(simple_string_dictionary_writer_2));
|
||||
EXPECT_TRUE(module_writer_2->IsUseful());
|
||||
module_list_writer->AddModule(module_writer_2.Pass(),
|
||||
module_list_writer->AddModule(crashpad::move(module_writer_2),
|
||||
kMinidumpModuleListIndex2);
|
||||
|
||||
EXPECT_TRUE(module_list_writer->IsUseful());
|
||||
|
@ -25,6 +25,7 @@
|
||||
#include "snapshot/module_snapshot.h"
|
||||
#include "util/file/file_writer.h"
|
||||
#include "util/misc/implicit_cast.h"
|
||||
#include "util/stdlib/move.h"
|
||||
#include "util/numeric/in_range_cast.h"
|
||||
#include "util/numeric/safe_assignment.h"
|
||||
|
||||
@ -244,7 +245,7 @@ void MinidumpModuleWriter::InitializeFromSnapshot(
|
||||
auto codeview_record =
|
||||
make_scoped_ptr(new MinidumpModuleCodeViewRecordPDB70Writer());
|
||||
codeview_record->InitializeFromSnapshot(module_snapshot);
|
||||
SetCodeViewRecord(codeview_record.Pass());
|
||||
SetCodeViewRecord(crashpad::move(codeview_record));
|
||||
}
|
||||
|
||||
const MINIDUMP_MODULE* MinidumpModuleWriter::MinidumpModule() const {
|
||||
@ -266,14 +267,14 @@ void MinidumpModuleWriter::SetCodeViewRecord(
|
||||
scoped_ptr<MinidumpModuleCodeViewRecordWriter> codeview_record) {
|
||||
DCHECK_EQ(state(), kStateMutable);
|
||||
|
||||
codeview_record_ = codeview_record.Pass();
|
||||
codeview_record_ = crashpad::move(codeview_record);
|
||||
}
|
||||
|
||||
void MinidumpModuleWriter::SetMiscDebugRecord(
|
||||
scoped_ptr<MinidumpModuleMiscDebugRecordWriter> misc_debug_record) {
|
||||
DCHECK_EQ(state(), kStateMutable);
|
||||
|
||||
misc_debug_record_ = misc_debug_record.Pass();
|
||||
misc_debug_record_ = crashpad::move(misc_debug_record);
|
||||
}
|
||||
|
||||
void MinidumpModuleWriter::SetTimestamp(time_t timestamp) {
|
||||
@ -385,7 +386,7 @@ void MinidumpModuleListWriter::InitializeFromSnapshot(
|
||||
for (const ModuleSnapshot* module_snapshot : module_snapshots) {
|
||||
auto module = make_scoped_ptr(new MinidumpModuleWriter());
|
||||
module->InitializeFromSnapshot(module_snapshot);
|
||||
AddModule(module.Pass());
|
||||
AddModule(crashpad::move(module));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -33,6 +33,7 @@
|
||||
#include "test/gtest_death_check.h"
|
||||
#include "util/file/string_file.h"
|
||||
#include "util/misc/implicit_cast.h"
|
||||
#include "util/stdlib/move.h"
|
||||
#include "util/misc/uuid.h"
|
||||
#include "util/stdlib/pointer_container.h"
|
||||
|
||||
@ -68,7 +69,7 @@ TEST(MinidumpModuleWriter, EmptyModuleList) {
|
||||
MinidumpFileWriter minidump_file_writer;
|
||||
auto module_list_writer = make_scoped_ptr(new MinidumpModuleListWriter());
|
||||
|
||||
minidump_file_writer.AddStream(module_list_writer.Pass());
|
||||
minidump_file_writer.AddStream(crashpad::move(module_list_writer));
|
||||
|
||||
StringFile string_file;
|
||||
ASSERT_TRUE(minidump_file_writer.WriteEverything(&string_file));
|
||||
@ -276,8 +277,8 @@ TEST(MinidumpModuleWriter, EmptyModule) {
|
||||
auto module_writer = make_scoped_ptr(new MinidumpModuleWriter());
|
||||
module_writer->SetName(kModuleName);
|
||||
|
||||
module_list_writer->AddModule(module_writer.Pass());
|
||||
minidump_file_writer.AddStream(module_list_writer.Pass());
|
||||
module_list_writer->AddModule(crashpad::move(module_writer));
|
||||
minidump_file_writer.AddStream(crashpad::move(module_list_writer));
|
||||
|
||||
StringFile string_file;
|
||||
ASSERT_TRUE(minidump_file_writer.WriteEverything(&string_file));
|
||||
@ -359,16 +360,16 @@ TEST(MinidumpModuleWriter, OneModule) {
|
||||
make_scoped_ptr(new MinidumpModuleCodeViewRecordPDB70Writer());
|
||||
codeview_pdb70_writer->SetPDBName(kPDBName);
|
||||
codeview_pdb70_writer->SetUUIDAndAge(pdb_uuid, kPDBAge);
|
||||
module_writer->SetCodeViewRecord(codeview_pdb70_writer.Pass());
|
||||
module_writer->SetCodeViewRecord(crashpad::move(codeview_pdb70_writer));
|
||||
|
||||
auto misc_debug_writer =
|
||||
make_scoped_ptr(new MinidumpModuleMiscDebugRecordWriter());
|
||||
misc_debug_writer->SetDataType(kDebugType);
|
||||
misc_debug_writer->SetData(kDebugName, kDebugUTF16);
|
||||
module_writer->SetMiscDebugRecord(misc_debug_writer.Pass());
|
||||
module_writer->SetMiscDebugRecord(crashpad::move(misc_debug_writer));
|
||||
|
||||
module_list_writer->AddModule(module_writer.Pass());
|
||||
minidump_file_writer.AddStream(module_list_writer.Pass());
|
||||
module_list_writer->AddModule(crashpad::move(module_writer));
|
||||
minidump_file_writer.AddStream(crashpad::move(module_list_writer));
|
||||
|
||||
StringFile string_file;
|
||||
ASSERT_TRUE(minidump_file_writer.WriteEverything(&string_file));
|
||||
@ -434,16 +435,16 @@ TEST(MinidumpModuleWriter, OneModule_CodeViewUsesPDB20_MiscUsesUTF16) {
|
||||
make_scoped_ptr(new MinidumpModuleCodeViewRecordPDB20Writer());
|
||||
codeview_pdb20_writer->SetPDBName(kPDBName);
|
||||
codeview_pdb20_writer->SetTimestampAndAge(kPDBTimestamp, kPDBAge);
|
||||
module_writer->SetCodeViewRecord(codeview_pdb20_writer.Pass());
|
||||
module_writer->SetCodeViewRecord(crashpad::move(codeview_pdb20_writer));
|
||||
|
||||
auto misc_debug_writer =
|
||||
make_scoped_ptr(new MinidumpModuleMiscDebugRecordWriter());
|
||||
misc_debug_writer->SetDataType(kDebugType);
|
||||
misc_debug_writer->SetData(kDebugName, kDebugUTF16);
|
||||
module_writer->SetMiscDebugRecord(misc_debug_writer.Pass());
|
||||
module_writer->SetMiscDebugRecord(crashpad::move(misc_debug_writer));
|
||||
|
||||
module_list_writer->AddModule(module_writer.Pass());
|
||||
minidump_file_writer.AddStream(module_list_writer.Pass());
|
||||
module_list_writer->AddModule(crashpad::move(module_writer));
|
||||
minidump_file_writer.AddStream(crashpad::move(module_list_writer));
|
||||
|
||||
StringFile string_file;
|
||||
ASSERT_TRUE(minidump_file_writer.WriteEverything(&string_file));
|
||||
@ -511,16 +512,16 @@ TEST(MinidumpModuleWriter, ThreeModules) {
|
||||
make_scoped_ptr(new MinidumpModuleCodeViewRecordPDB70Writer());
|
||||
codeview_pdb70_writer_0->SetPDBName(kPDBName0);
|
||||
codeview_pdb70_writer_0->SetUUIDAndAge(pdb_uuid_0, kPDBAge0);
|
||||
module_writer_0->SetCodeViewRecord(codeview_pdb70_writer_0.Pass());
|
||||
module_writer_0->SetCodeViewRecord(crashpad::move(codeview_pdb70_writer_0));
|
||||
|
||||
module_list_writer->AddModule(module_writer_0.Pass());
|
||||
module_list_writer->AddModule(crashpad::move(module_writer_0));
|
||||
|
||||
auto module_writer_1 = make_scoped_ptr(new MinidumpModuleWriter());
|
||||
module_writer_1->SetName(kModuleName1);
|
||||
module_writer_1->SetImageBaseAddress(kModuleBase1);
|
||||
module_writer_1->SetImageSize(kModuleSize1);
|
||||
|
||||
module_list_writer->AddModule(module_writer_1.Pass());
|
||||
module_list_writer->AddModule(crashpad::move(module_writer_1));
|
||||
|
||||
auto module_writer_2 = make_scoped_ptr(new MinidumpModuleWriter());
|
||||
module_writer_2->SetName(kModuleName2);
|
||||
@ -531,11 +532,11 @@ TEST(MinidumpModuleWriter, ThreeModules) {
|
||||
make_scoped_ptr(new MinidumpModuleCodeViewRecordPDB20Writer());
|
||||
codeview_pdb70_writer_2->SetPDBName(kPDBName2);
|
||||
codeview_pdb70_writer_2->SetTimestampAndAge(kPDBTimestamp2, kPDBAge2);
|
||||
module_writer_2->SetCodeViewRecord(codeview_pdb70_writer_2.Pass());
|
||||
module_writer_2->SetCodeViewRecord(crashpad::move(codeview_pdb70_writer_2));
|
||||
|
||||
module_list_writer->AddModule(module_writer_2.Pass());
|
||||
module_list_writer->AddModule(crashpad::move(module_writer_2));
|
||||
|
||||
minidump_file_writer.AddStream(module_list_writer.Pass());
|
||||
minidump_file_writer.AddStream(crashpad::move(module_list_writer));
|
||||
|
||||
StringFile string_file;
|
||||
ASSERT_TRUE(minidump_file_writer.WriteEverything(&string_file));
|
||||
@ -728,7 +729,7 @@ TEST(MinidumpModuleWriter, InitializeFromSnapshot) {
|
||||
module_list_writer->InitializeFromSnapshot(module_snapshots);
|
||||
|
||||
MinidumpFileWriter minidump_file_writer;
|
||||
minidump_file_writer.AddStream(module_list_writer.Pass());
|
||||
minidump_file_writer.AddStream(crashpad::move(module_list_writer));
|
||||
|
||||
StringFile string_file;
|
||||
ASSERT_TRUE(minidump_file_writer.WriteEverything(&string_file));
|
||||
@ -759,8 +760,8 @@ TEST(MinidumpModuleWriterDeathTest, NoModuleName) {
|
||||
MinidumpFileWriter minidump_file_writer;
|
||||
auto module_list_writer = make_scoped_ptr(new MinidumpModuleListWriter());
|
||||
auto module_writer = make_scoped_ptr(new MinidumpModuleWriter());
|
||||
module_list_writer->AddModule(module_writer.Pass());
|
||||
minidump_file_writer.AddStream(module_list_writer.Pass());
|
||||
module_list_writer->AddModule(crashpad::move(module_writer));
|
||||
minidump_file_writer.AddStream(crashpad::move(module_list_writer));
|
||||
|
||||
StringFile string_file;
|
||||
ASSERT_DEATH_CHECK(minidump_file_writer.WriteEverything(&string_file),
|
||||
|
@ -20,6 +20,7 @@
|
||||
#include "minidump/test/minidump_rva_list_test_util.h"
|
||||
#include "minidump/test/minidump_writable_test_util.h"
|
||||
#include "util/file/string_file.h"
|
||||
#include "util/stdlib/move.h"
|
||||
|
||||
namespace crashpad {
|
||||
namespace test {
|
||||
@ -32,7 +33,7 @@ class TestMinidumpRVAListWriter final : public internal::MinidumpRVAListWriter {
|
||||
|
||||
void AddChild(uint32_t value) {
|
||||
auto child = make_scoped_ptr(new TestUInt32MinidumpWritable(value));
|
||||
MinidumpRVAListWriter::AddChild(child.Pass());
|
||||
MinidumpRVAListWriter::AddChild(crashpad::move(child));
|
||||
}
|
||||
|
||||
private:
|
||||
|
@ -17,6 +17,7 @@
|
||||
#include "base/logging.h"
|
||||
#include "base/stl_util.h"
|
||||
#include "util/file/file_writer.h"
|
||||
#include "util/stdlib/move.h"
|
||||
#include "util/numeric/safe_assignment.h"
|
||||
|
||||
namespace crashpad {
|
||||
@ -109,7 +110,7 @@ void MinidumpSimpleStringDictionaryWriter::InitializeFromMap(
|
||||
auto entry =
|
||||
make_scoped_ptr(new MinidumpSimpleStringDictionaryEntryWriter());
|
||||
entry->SetKeyValue(iterator.first, iterator.second);
|
||||
AddEntry(entry.Pass());
|
||||
AddEntry(crashpad::move(entry));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -22,6 +22,7 @@
|
||||
#include "minidump/test/minidump_string_writer_test_util.h"
|
||||
#include "minidump/test/minidump_writable_test_util.h"
|
||||
#include "util/file/string_file.h"
|
||||
#include "util/stdlib/move.h"
|
||||
|
||||
namespace crashpad {
|
||||
namespace test {
|
||||
@ -62,7 +63,7 @@ TEST(MinidumpSimpleStringDictionaryWriter, EmptyKeyValue) {
|
||||
MinidumpSimpleStringDictionaryWriter dictionary_writer;
|
||||
auto entry_writer =
|
||||
make_scoped_ptr(new MinidumpSimpleStringDictionaryEntryWriter());
|
||||
dictionary_writer.AddEntry(entry_writer.Pass());
|
||||
dictionary_writer.AddEntry(crashpad::move(entry_writer));
|
||||
|
||||
EXPECT_TRUE(dictionary_writer.IsUseful());
|
||||
|
||||
@ -96,7 +97,7 @@ TEST(MinidumpSimpleStringDictionaryWriter, OneKeyValue) {
|
||||
auto entry_writer =
|
||||
make_scoped_ptr(new MinidumpSimpleStringDictionaryEntryWriter());
|
||||
entry_writer->SetKeyValue(kKey, kValue);
|
||||
dictionary_writer.AddEntry(entry_writer.Pass());
|
||||
dictionary_writer.AddEntry(crashpad::move(entry_writer));
|
||||
|
||||
EXPECT_TRUE(dictionary_writer.IsUseful());
|
||||
|
||||
@ -134,15 +135,15 @@ TEST(MinidumpSimpleStringDictionaryWriter, ThreeKeysValues) {
|
||||
auto entry_writer_0 =
|
||||
make_scoped_ptr(new MinidumpSimpleStringDictionaryEntryWriter());
|
||||
entry_writer_0->SetKeyValue(kKey0, kValue0);
|
||||
dictionary_writer.AddEntry(entry_writer_0.Pass());
|
||||
dictionary_writer.AddEntry(crashpad::move(entry_writer_0));
|
||||
auto entry_writer_1 =
|
||||
make_scoped_ptr(new MinidumpSimpleStringDictionaryEntryWriter());
|
||||
entry_writer_1->SetKeyValue(kKey1, kValue1);
|
||||
dictionary_writer.AddEntry(entry_writer_1.Pass());
|
||||
dictionary_writer.AddEntry(crashpad::move(entry_writer_1));
|
||||
auto entry_writer_2 =
|
||||
make_scoped_ptr(new MinidumpSimpleStringDictionaryEntryWriter());
|
||||
entry_writer_2->SetKeyValue(kKey2, kValue2);
|
||||
dictionary_writer.AddEntry(entry_writer_2.Pass());
|
||||
dictionary_writer.AddEntry(crashpad::move(entry_writer_2));
|
||||
|
||||
EXPECT_TRUE(dictionary_writer.IsUseful());
|
||||
|
||||
@ -202,11 +203,11 @@ TEST(MinidumpSimpleStringDictionaryWriter, DuplicateKeyValue) {
|
||||
auto entry_writer_0 =
|
||||
make_scoped_ptr(new MinidumpSimpleStringDictionaryEntryWriter());
|
||||
entry_writer_0->SetKeyValue(kKey, kValue0);
|
||||
dictionary_writer.AddEntry(entry_writer_0.Pass());
|
||||
dictionary_writer.AddEntry(crashpad::move(entry_writer_0));
|
||||
auto entry_writer_1 =
|
||||
make_scoped_ptr(new MinidumpSimpleStringDictionaryEntryWriter());
|
||||
entry_writer_1->SetKeyValue(kKey, kValue1);
|
||||
dictionary_writer.AddEntry(entry_writer_1.Pass());
|
||||
dictionary_writer.AddEntry(crashpad::move(entry_writer_1));
|
||||
|
||||
EXPECT_TRUE(dictionary_writer.IsUseful());
|
||||
|
||||
|
@ -19,6 +19,7 @@
|
||||
#include "base/logging.h"
|
||||
#include "minidump/minidump_writer_util.h"
|
||||
#include "util/file/file_writer.h"
|
||||
#include "util/stdlib/move.h"
|
||||
#include "util/numeric/safe_assignment.h"
|
||||
|
||||
namespace crashpad {
|
||||
@ -121,7 +122,7 @@ void MinidumpStringListWriter<MinidumpStringWriterType>::AddStringUTF8(
|
||||
const std::string& string_utf8) {
|
||||
auto string_writer = make_scoped_ptr(new MinidumpStringWriterType());
|
||||
string_writer->SetUTF8(string_utf8);
|
||||
AddChild(string_writer.Pass());
|
||||
AddChild(crashpad::move(string_writer));
|
||||
}
|
||||
|
||||
template <typename MinidumpStringWriterType>
|
||||
|
@ -31,6 +31,7 @@
|
||||
#include "snapshot/test/test_system_snapshot.h"
|
||||
#include "test/gtest_death_check.h"
|
||||
#include "util/file/string_file.h"
|
||||
#include "util/stdlib/move.h"
|
||||
|
||||
namespace crashpad {
|
||||
namespace test {
|
||||
@ -83,7 +84,7 @@ TEST(MinidumpSystemInfoWriter, Empty) {
|
||||
|
||||
system_info_writer->SetCSDVersion(std::string());
|
||||
|
||||
minidump_file_writer.AddStream(system_info_writer.Pass());
|
||||
minidump_file_writer.AddStream(crashpad::move(system_info_writer));
|
||||
|
||||
StringFile string_file;
|
||||
ASSERT_TRUE(minidump_file_writer.WriteEverything(&string_file));
|
||||
@ -154,7 +155,7 @@ TEST(MinidumpSystemInfoWriter, X86_Win) {
|
||||
system_info_writer->SetCPUX86VersionAndFeatures(kCPUVersion, kCPUFeatures);
|
||||
system_info_writer->SetCPUX86AMDExtendedFeatures(kAMDFeatures);
|
||||
|
||||
minidump_file_writer.AddStream(system_info_writer.Pass());
|
||||
minidump_file_writer.AddStream(crashpad::move(system_info_writer));
|
||||
|
||||
StringFile string_file;
|
||||
ASSERT_TRUE(minidump_file_writer.WriteEverything(&string_file));
|
||||
@ -214,7 +215,7 @@ TEST(MinidumpSystemInfoWriter, AMD64_Mac) {
|
||||
system_info_writer->SetCSDVersion(kCSDVersion);
|
||||
system_info_writer->SetCPUOtherFeatures(kCPUFeatures[0], kCPUFeatures[1]);
|
||||
|
||||
minidump_file_writer.AddStream(system_info_writer.Pass());
|
||||
minidump_file_writer.AddStream(crashpad::move(system_info_writer));
|
||||
|
||||
StringFile string_file;
|
||||
ASSERT_TRUE(minidump_file_writer.WriteEverything(&string_file));
|
||||
@ -256,7 +257,7 @@ TEST(MinidumpSystemInfoWriter, X86_CPUVendorFromRegisters) {
|
||||
kCPUVendor[0], kCPUVendor[1], kCPUVendor[2]);
|
||||
system_info_writer->SetCSDVersion(std::string());
|
||||
|
||||
minidump_file_writer.AddStream(system_info_writer.Pass());
|
||||
minidump_file_writer.AddStream(crashpad::move(system_info_writer));
|
||||
|
||||
StringFile string_file;
|
||||
ASSERT_TRUE(minidump_file_writer.WriteEverything(&string_file));
|
||||
@ -336,7 +337,7 @@ TEST(MinidumpSystemInfoWriter, InitializeFromSnapshot_X86) {
|
||||
system_info_writer->InitializeFromSnapshot(&system_snapshot);
|
||||
|
||||
MinidumpFileWriter minidump_file_writer;
|
||||
minidump_file_writer.AddStream(system_info_writer.Pass());
|
||||
minidump_file_writer.AddStream(crashpad::move(system_info_writer));
|
||||
|
||||
StringFile string_file;
|
||||
ASSERT_TRUE(minidump_file_writer.WriteEverything(&string_file));
|
||||
@ -431,7 +432,7 @@ TEST(MinidumpSystemInfoWriter, InitializeFromSnapshot_AMD64) {
|
||||
system_info_writer->InitializeFromSnapshot(&system_snapshot);
|
||||
|
||||
MinidumpFileWriter minidump_file_writer;
|
||||
minidump_file_writer.AddStream(system_info_writer.Pass());
|
||||
minidump_file_writer.AddStream(crashpad::move(system_info_writer));
|
||||
|
||||
StringFile string_file;
|
||||
ASSERT_TRUE(minidump_file_writer.WriteEverything(&string_file));
|
||||
@ -469,7 +470,7 @@ TEST(MinidumpSystemInfoWriter, InitializeFromSnapshot_AMD64) {
|
||||
TEST(MinidumpSystemInfoWriterDeathTest, NoCSDVersion) {
|
||||
MinidumpFileWriter minidump_file_writer;
|
||||
auto system_info_writer = make_scoped_ptr(new MinidumpSystemInfoWriter());
|
||||
minidump_file_writer.AddStream(system_info_writer.Pass());
|
||||
minidump_file_writer.AddStream(crashpad::move(system_info_writer));
|
||||
|
||||
StringFile string_file;
|
||||
ASSERT_DEATH_CHECK(minidump_file_writer.WriteEverything(&string_file),
|
||||
|
@ -22,6 +22,7 @@
|
||||
#include "snapshot/memory_snapshot.h"
|
||||
#include "snapshot/thread_snapshot.h"
|
||||
#include "util/file/file_writer.h"
|
||||
#include "util/stdlib/move.h"
|
||||
#include "util/numeric/safe_assignment.h"
|
||||
|
||||
namespace crashpad {
|
||||
@ -52,12 +53,12 @@ void MinidumpThreadWriter::InitializeFromSnapshot(
|
||||
if (stack_snapshot && stack_snapshot->Size() > 0) {
|
||||
scoped_ptr<MinidumpMemoryWriter> stack =
|
||||
MinidumpMemoryWriter::CreateFromSnapshot(stack_snapshot);
|
||||
SetStack(stack.Pass());
|
||||
SetStack(crashpad::move(stack));
|
||||
}
|
||||
|
||||
scoped_ptr<MinidumpContextWriter> context =
|
||||
MinidumpContextWriter::CreateFromSnapshot(thread_snapshot->Context());
|
||||
SetContext(context.Pass());
|
||||
SetContext(crashpad::move(context));
|
||||
}
|
||||
|
||||
const MINIDUMP_THREAD* MinidumpThreadWriter::MinidumpThread() const {
|
||||
@ -69,14 +70,14 @@ const MINIDUMP_THREAD* MinidumpThreadWriter::MinidumpThread() const {
|
||||
void MinidumpThreadWriter::SetStack(scoped_ptr<MinidumpMemoryWriter> stack) {
|
||||
DCHECK_EQ(state(), kStateMutable);
|
||||
|
||||
stack_ = stack.Pass();
|
||||
stack_ = crashpad::move(stack);
|
||||
}
|
||||
|
||||
void MinidumpThreadWriter::SetContext(
|
||||
scoped_ptr<MinidumpContextWriter> context) {
|
||||
DCHECK_EQ(state(), kStateMutable);
|
||||
|
||||
context_ = context.Pass();
|
||||
context_ = crashpad::move(context);
|
||||
}
|
||||
|
||||
bool MinidumpThreadWriter::Freeze() {
|
||||
@ -148,7 +149,7 @@ void MinidumpThreadListWriter::InitializeFromSnapshot(
|
||||
for (const ThreadSnapshot* thread_snapshot : thread_snapshots) {
|
||||
auto thread = make_scoped_ptr(new MinidumpThreadWriter());
|
||||
thread->InitializeFromSnapshot(thread_snapshot, thread_id_map);
|
||||
AddThread(thread.Pass());
|
||||
AddThread(crashpad::move(thread));
|
||||
}
|
||||
|
||||
// Do this in a separate loop to keep the thread stacks earlier in the dump,
|
||||
|
@ -37,6 +37,7 @@
|
||||
#include "snapshot/test/test_thread_snapshot.h"
|
||||
#include "test/gtest_death_check.h"
|
||||
#include "util/file/string_file.h"
|
||||
#include "util/stdlib/move.h"
|
||||
|
||||
namespace crashpad {
|
||||
namespace test {
|
||||
@ -83,7 +84,7 @@ TEST(MinidumpThreadWriter, EmptyThreadList) {
|
||||
MinidumpFileWriter minidump_file_writer;
|
||||
auto thread_list_writer = make_scoped_ptr(new MinidumpThreadListWriter());
|
||||
|
||||
minidump_file_writer.AddStream(thread_list_writer.Pass());
|
||||
minidump_file_writer.AddStream(crashpad::move(thread_list_writer));
|
||||
|
||||
StringFile string_file;
|
||||
ASSERT_TRUE(minidump_file_writer.WriteEverything(&string_file));
|
||||
@ -160,10 +161,10 @@ TEST(MinidumpThreadWriter, OneThread_x86_NoStack) {
|
||||
|
||||
auto context_x86_writer = make_scoped_ptr(new MinidumpContextX86Writer());
|
||||
InitializeMinidumpContextX86(context_x86_writer->context(), kSeed);
|
||||
thread_writer->SetContext(context_x86_writer.Pass());
|
||||
thread_writer->SetContext(crashpad::move(context_x86_writer));
|
||||
|
||||
thread_list_writer->AddThread(thread_writer.Pass());
|
||||
minidump_file_writer.AddStream(thread_list_writer.Pass());
|
||||
thread_list_writer->AddThread(crashpad::move(thread_writer));
|
||||
minidump_file_writer.AddStream(crashpad::move(thread_list_writer));
|
||||
|
||||
StringFile string_file;
|
||||
ASSERT_TRUE(minidump_file_writer.WriteEverything(&string_file));
|
||||
@ -222,15 +223,15 @@ TEST(MinidumpThreadWriter, OneThread_AMD64_Stack) {
|
||||
|
||||
auto memory_writer = make_scoped_ptr(
|
||||
new TestMinidumpMemoryWriter(kMemoryBase, kMemorySize, kMemoryValue));
|
||||
thread_writer->SetStack(memory_writer.Pass());
|
||||
thread_writer->SetStack(crashpad::move(memory_writer));
|
||||
|
||||
MSVC_SUPPRESS_WARNING(4316); // Object allocated on heap may not be aligned.
|
||||
auto context_amd64_writer = make_scoped_ptr(new MinidumpContextAMD64Writer());
|
||||
InitializeMinidumpContextAMD64(context_amd64_writer->context(), kSeed);
|
||||
thread_writer->SetContext(context_amd64_writer.Pass());
|
||||
thread_writer->SetContext(crashpad::move(context_amd64_writer));
|
||||
|
||||
thread_list_writer->AddThread(thread_writer.Pass());
|
||||
minidump_file_writer.AddStream(thread_list_writer.Pass());
|
||||
thread_list_writer->AddThread(crashpad::move(thread_writer));
|
||||
minidump_file_writer.AddStream(crashpad::move(thread_list_writer));
|
||||
|
||||
StringFile string_file;
|
||||
ASSERT_TRUE(minidump_file_writer.WriteEverything(&string_file));
|
||||
@ -300,13 +301,13 @@ TEST(MinidumpThreadWriter, ThreeThreads_x86_MemoryList) {
|
||||
|
||||
auto memory_writer_0 = make_scoped_ptr(
|
||||
new TestMinidumpMemoryWriter(kMemoryBase0, kMemorySize0, kMemoryValue0));
|
||||
thread_writer_0->SetStack(memory_writer_0.Pass());
|
||||
thread_writer_0->SetStack(crashpad::move(memory_writer_0));
|
||||
|
||||
auto context_x86_writer_0 = make_scoped_ptr(new MinidumpContextX86Writer());
|
||||
InitializeMinidumpContextX86(context_x86_writer_0->context(), kSeed0);
|
||||
thread_writer_0->SetContext(context_x86_writer_0.Pass());
|
||||
thread_writer_0->SetContext(crashpad::move(context_x86_writer_0));
|
||||
|
||||
thread_list_writer->AddThread(thread_writer_0.Pass());
|
||||
thread_list_writer->AddThread(crashpad::move(thread_writer_0));
|
||||
|
||||
const uint32_t kThreadID1 = 2222222;
|
||||
const uint32_t kSuspendCount1 = 222222;
|
||||
@ -327,13 +328,13 @@ TEST(MinidumpThreadWriter, ThreeThreads_x86_MemoryList) {
|
||||
|
||||
auto memory_writer_1 = make_scoped_ptr(
|
||||
new TestMinidumpMemoryWriter(kMemoryBase1, kMemorySize1, kMemoryValue1));
|
||||
thread_writer_1->SetStack(memory_writer_1.Pass());
|
||||
thread_writer_1->SetStack(crashpad::move(memory_writer_1));
|
||||
|
||||
auto context_x86_writer_1 = make_scoped_ptr(new MinidumpContextX86Writer());
|
||||
InitializeMinidumpContextX86(context_x86_writer_1->context(), kSeed1);
|
||||
thread_writer_1->SetContext(context_x86_writer_1.Pass());
|
||||
thread_writer_1->SetContext(crashpad::move(context_x86_writer_1));
|
||||
|
||||
thread_list_writer->AddThread(thread_writer_1.Pass());
|
||||
thread_list_writer->AddThread(crashpad::move(thread_writer_1));
|
||||
|
||||
const uint32_t kThreadID2 = 3333333;
|
||||
const uint32_t kSuspendCount2 = 333333;
|
||||
@ -354,16 +355,16 @@ TEST(MinidumpThreadWriter, ThreeThreads_x86_MemoryList) {
|
||||
|
||||
auto memory_writer_2 = make_scoped_ptr(
|
||||
new TestMinidumpMemoryWriter(kMemoryBase2, kMemorySize2, kMemoryValue2));
|
||||
thread_writer_2->SetStack(memory_writer_2.Pass());
|
||||
thread_writer_2->SetStack(crashpad::move(memory_writer_2));
|
||||
|
||||
auto context_x86_writer_2 = make_scoped_ptr(new MinidumpContextX86Writer());
|
||||
InitializeMinidumpContextX86(context_x86_writer_2->context(), kSeed2);
|
||||
thread_writer_2->SetContext(context_x86_writer_2.Pass());
|
||||
thread_writer_2->SetContext(crashpad::move(context_x86_writer_2));
|
||||
|
||||
thread_list_writer->AddThread(thread_writer_2.Pass());
|
||||
thread_list_writer->AddThread(crashpad::move(thread_writer_2));
|
||||
|
||||
minidump_file_writer.AddStream(thread_list_writer.Pass());
|
||||
minidump_file_writer.AddStream(memory_list_writer.Pass());
|
||||
minidump_file_writer.AddStream(crashpad::move(thread_list_writer));
|
||||
minidump_file_writer.AddStream(crashpad::move(memory_list_writer));
|
||||
|
||||
StringFile string_file;
|
||||
ASSERT_TRUE(minidump_file_writer.WriteEverything(&string_file));
|
||||
@ -600,7 +601,7 @@ void RunInitializeFromSnapshotTest(bool thread_id_collision) {
|
||||
expect_threads[index].Stack.StartOfMemoryRange);
|
||||
memory_snapshot->SetSize(expect_threads[index].Stack.Memory.DataSize);
|
||||
memory_snapshot->SetValue(memory_values[index]);
|
||||
thread_snapshot->SetStack(memory_snapshot.Pass());
|
||||
thread_snapshot->SetStack(crashpad::move(memory_snapshot));
|
||||
}
|
||||
|
||||
Traits::InitializeCPUContext(thread_snapshot->MutableContext(),
|
||||
@ -610,7 +611,7 @@ void RunInitializeFromSnapshotTest(bool thread_id_collision) {
|
||||
teb_snapshot->SetAddress(expect_threads[index].Teb);
|
||||
teb_snapshot->SetSize(kTebSize);
|
||||
teb_snapshot->SetValue(static_cast<char>('t' + index));
|
||||
thread_snapshot->AddExtraMemory(teb_snapshot.Pass());
|
||||
thread_snapshot->AddExtraMemory(crashpad::move(teb_snapshot));
|
||||
|
||||
thread_snapshots.push_back(thread_snapshot);
|
||||
}
|
||||
@ -622,8 +623,8 @@ void RunInitializeFromSnapshotTest(bool thread_id_collision) {
|
||||
thread_list_writer->InitializeFromSnapshot(thread_snapshots, &thread_id_map);
|
||||
|
||||
MinidumpFileWriter minidump_file_writer;
|
||||
minidump_file_writer.AddStream(thread_list_writer.Pass());
|
||||
minidump_file_writer.AddStream(memory_list_writer.Pass());
|
||||
minidump_file_writer.AddStream(crashpad::move(thread_list_writer));
|
||||
minidump_file_writer.AddStream(crashpad::move(memory_list_writer));
|
||||
|
||||
StringFile string_file;
|
||||
ASSERT_TRUE(minidump_file_writer.WriteEverything(&string_file));
|
||||
@ -700,8 +701,8 @@ TEST(MinidumpThreadWriterDeathTest, NoContext) {
|
||||
|
||||
auto thread_writer = make_scoped_ptr(new MinidumpThreadWriter());
|
||||
|
||||
thread_list_writer->AddThread(thread_writer.Pass());
|
||||
minidump_file_writer.AddStream(thread_list_writer.Pass());
|
||||
thread_list_writer->AddThread(crashpad::move(thread_writer));
|
||||
minidump_file_writer.AddStream(crashpad::move(thread_list_writer));
|
||||
|
||||
StringFile string_file;
|
||||
ASSERT_DEATH_CHECK(minidump_file_writer.WriteEverything(&string_file),
|
||||
|
@ -32,6 +32,7 @@
|
||||
#include "snapshot/process_snapshot.h"
|
||||
#include "snapshot/system_snapshot.h"
|
||||
#include "snapshot/thread_snapshot.h"
|
||||
#include "util/stdlib/move.h"
|
||||
#include "util/misc/uuid.h"
|
||||
#include "util/stdlib/pointer_container.h"
|
||||
|
||||
@ -71,7 +72,9 @@ class TestProcessSnapshot final : public ProcessSnapshot {
|
||||
//!
|
||||
//! \param[in] system The system snapshot that System() will return. The
|
||||
//! TestProcessSnapshot object takes ownership of \a system.
|
||||
void SetSystem(scoped_ptr<SystemSnapshot> system) { system_ = system.Pass(); }
|
||||
void SetSystem(scoped_ptr<SystemSnapshot> system) {
|
||||
system_ = crashpad::move(system);
|
||||
}
|
||||
|
||||
//! \brief Adds a thread snapshot to be returned by Threads().
|
||||
//!
|
||||
@ -94,7 +97,7 @@ class TestProcessSnapshot final : public ProcessSnapshot {
|
||||
//! \param[in] exception The exception snapshot that Exception() will return.
|
||||
//! The TestProcessSnapshot object takes ownership of \a exception.
|
||||
void SetException(scoped_ptr<ExceptionSnapshot> exception) {
|
||||
exception_ = exception.Pass();
|
||||
exception_ = crashpad::move(exception);
|
||||
}
|
||||
|
||||
//! \brief Adds a memory map region snapshot to be returned by MemoryMap().
|
||||
|
@ -24,6 +24,7 @@
|
||||
#include "snapshot/cpu_context.h"
|
||||
#include "snapshot/memory_snapshot.h"
|
||||
#include "snapshot/thread_snapshot.h"
|
||||
#include "util/stdlib/move.h"
|
||||
#include "util/stdlib/pointer_container.h"
|
||||
|
||||
namespace crashpad {
|
||||
@ -55,7 +56,9 @@ class TestThreadSnapshot final : public ThreadSnapshot {
|
||||
//!
|
||||
//! \param[in] stack The memory region that Stack() will return. The
|
||||
//! TestThreadSnapshot object takes ownership of \a stack.
|
||||
void SetStack(scoped_ptr<MemorySnapshot> stack) { stack_ = stack.Pass(); }
|
||||
void SetStack(scoped_ptr<MemorySnapshot> stack) {
|
||||
stack_ = crashpad::move(stack);
|
||||
}
|
||||
|
||||
void SetThreadID(uint64_t thread_id) { thread_id_ = thread_id; }
|
||||
void SetSuspendCount(int suspend_count) { suspend_count_ = suspend_count; }
|
||||
|
@ -23,6 +23,7 @@
|
||||
#include "base/strings/stringprintf.h"
|
||||
#include "base/strings/utf_string_conversions.h"
|
||||
#include "gtest/gtest.h"
|
||||
#include "util/stdlib/move.h"
|
||||
#include "util/stdlib/string_number_conversion.h"
|
||||
#include "util/string/split_string.h"
|
||||
#include "util/win/handle.h"
|
||||
@ -125,8 +126,8 @@ bool CreateInheritablePipe(ScopedFileHANDLE* read_handle,
|
||||
if (!write_inheritable && !UnsetHandleInheritance(temp_write.get()))
|
||||
return false;
|
||||
|
||||
*read_handle = temp_read.Pass();
|
||||
*write_handle = temp_write.Pass();
|
||||
*read_handle = crashpad::move(temp_read);
|
||||
*write_handle = crashpad::move(temp_write);
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -212,7 +213,7 @@ scoped_ptr<WinChildProcess::Handles> WinChildProcess::Launch() {
|
||||
return scoped_ptr<Handles>();
|
||||
}
|
||||
|
||||
return handles_for_parent.Pass();
|
||||
return crashpad::move(handles_for_parent);
|
||||
}
|
||||
|
||||
FileHandle WinChildProcess::ReadPipeHandle() const {
|
||||
|
@ -36,6 +36,7 @@
|
||||
#include "tools/tool_support.h"
|
||||
#include "util/file/file_io.h"
|
||||
#include "util/file/file_reader.h"
|
||||
#include "util/stdlib/move.h"
|
||||
#include "util/misc/uuid.h"
|
||||
|
||||
namespace crashpad {
|
||||
@ -552,7 +553,7 @@ int DatabaseUtilMain(int argc, char* argv[]) {
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
file_reader = file_path_reader.Pass();
|
||||
file_reader = crashpad::move(file_path_reader);
|
||||
}
|
||||
|
||||
CrashReportDatabase::NewReport* new_report;
|
||||
|
@ -37,6 +37,7 @@
|
||||
#include "util/mach/mach_message.h"
|
||||
#include "util/mach/mach_message_server.h"
|
||||
#include "util/misc/implicit_cast.h"
|
||||
#include "util/stdlib/move.h"
|
||||
#include "util/misc/random_string.h"
|
||||
|
||||
namespace crashpad {
|
||||
@ -352,30 +353,30 @@ ChildPortHandshake::~ChildPortHandshake() {
|
||||
|
||||
base::ScopedFD ChildPortHandshake::ClientReadFD() {
|
||||
DCHECK(client_read_fd_.is_valid());
|
||||
return client_read_fd_.Pass();
|
||||
return crashpad::move(client_read_fd_);
|
||||
}
|
||||
|
||||
base::ScopedFD ChildPortHandshake::ServerWriteFD() {
|
||||
DCHECK(server_write_fd_.is_valid());
|
||||
return server_write_fd_.Pass();
|
||||
return crashpad::move(server_write_fd_);
|
||||
}
|
||||
|
||||
mach_port_t ChildPortHandshake::RunServer(PortRightType port_right_type) {
|
||||
client_read_fd_.reset();
|
||||
return RunServerForFD(server_write_fd_.Pass(), port_right_type);
|
||||
return RunServerForFD(crashpad::move(server_write_fd_), port_right_type);
|
||||
}
|
||||
|
||||
bool ChildPortHandshake::RunClient(mach_port_t port,
|
||||
mach_msg_type_name_t right_type) {
|
||||
server_write_fd_.reset();
|
||||
return RunClientForFD(client_read_fd_.Pass(), port, right_type);
|
||||
return RunClientForFD(crashpad::move(client_read_fd_), port, right_type);
|
||||
}
|
||||
|
||||
// static
|
||||
mach_port_t ChildPortHandshake::RunServerForFD(base::ScopedFD server_write_fd,
|
||||
PortRightType port_right_type) {
|
||||
ChildPortHandshakeServer server;
|
||||
return server.RunServer(server_write_fd.Pass(), port_right_type);
|
||||
return server.RunServer(crashpad::move(server_write_fd), port_right_type);
|
||||
}
|
||||
|
||||
// static
|
||||
|
@ -138,7 +138,7 @@ class ChildPortHandshakeTest;
|
||||
//! // Obtain a receive right from the parent process.
|
||||
//! base::mac::ScopedMachReceiveRight receive_right(
|
||||
//! ChildPortHandshake::RunServerForFD(
|
||||
//! server_write_fd.Pass(),
|
||||
//! crashpad::move(server_write_fd),
|
||||
//! ChildPortHandshake::PortRightType::kReceiveRight));
|
||||
//! }
|
||||
//! \endcode
|
||||
|
@ -14,6 +14,7 @@
|
||||
|
||||
#include "util/net/http_transport.h"
|
||||
|
||||
#include "util/stdlib/move.h"
|
||||
#include "util/net/http_body.h"
|
||||
|
||||
namespace crashpad {
|
||||
@ -43,7 +44,7 @@ void HTTPTransport::SetHeader(const std::string& header,
|
||||
}
|
||||
|
||||
void HTTPTransport::SetBodyStream(scoped_ptr<HTTPBodyStream> stream) {
|
||||
body_stream_ = stream.Pass();
|
||||
body_stream_ = crashpad::move(stream);
|
||||
}
|
||||
|
||||
void HTTPTransport::SetTimeout(double timeout) {
|
||||
|
@ -31,6 +31,7 @@
|
||||
#include "test/multiprocess_exec.h"
|
||||
#include "test/paths.h"
|
||||
#include "util/file/file_io.h"
|
||||
#include "util/stdlib/move.h"
|
||||
#include "util/misc/random_string.h"
|
||||
#include "util/net/http_body.h"
|
||||
#include "util/net/http_headers.h"
|
||||
@ -51,7 +52,7 @@ class HTTPTransportTestFixture : public MultiprocessExec {
|
||||
RequestValidator request_validator)
|
||||
: MultiprocessExec(),
|
||||
headers_(headers),
|
||||
body_stream_(body_stream.Pass()),
|
||||
body_stream_(crashpad::move(body_stream)),
|
||||
response_code_(http_response_code),
|
||||
request_validator_(request_validator) {
|
||||
base::FilePath server_path = Paths::TestDataRoot().Append(
|
||||
@ -102,7 +103,7 @@ class HTTPTransportTestFixture : public MultiprocessExec {
|
||||
for (const auto& pair : headers_) {
|
||||
transport->SetHeader(pair.first, pair.second);
|
||||
}
|
||||
transport->SetBodyStream(body_stream_.Pass());
|
||||
transport->SetBodyStream(crashpad::move(body_stream_));
|
||||
|
||||
std::string response_body;
|
||||
bool success = transport->ExecuteSynchronously(&response_body);
|
||||
@ -270,7 +271,7 @@ TEST(HTTPTransport, UnchunkedPlainText) {
|
||||
headers[kContentType] = kTextPlain;
|
||||
headers[kContentLength] = base::StringPrintf("%" PRIuS, strlen(kTextBody));
|
||||
|
||||
HTTPTransportTestFixture test(headers, body_stream.Pass(), 200,
|
||||
HTTPTransportTestFixture test(headers, crashpad::move(body_stream), 200,
|
||||
&UnchunkedPlainText);
|
||||
test.Run();
|
||||
}
|
||||
@ -291,7 +292,7 @@ void RunUpload33k(bool has_content_length) {
|
||||
headers[kContentLength] =
|
||||
base::StringPrintf("%" PRIuS, request_string.size());
|
||||
}
|
||||
HTTPTransportTestFixture test(headers, body_stream.Pass(), 200,
|
||||
HTTPTransportTestFixture test(headers, crashpad::move(body_stream), 200,
|
||||
[](HTTPTransportTestFixture* fixture, const std::string& request) {
|
||||
size_t body_start = request.rfind("\r\n");
|
||||
EXPECT_EQ(33 * 1024u + 2, request.size() - body_start);
|
||||
|
54
util/stdlib/move.h
Normal file
54
util/stdlib/move.h
Normal file
@ -0,0 +1,54 @@
|
||||
// Copyright 2015 The Crashpad Authors. All rights reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
#ifndef CRASHPAD_UTIL_STDLIB_MOVE_H_
|
||||
#define CRASHPAD_UTIL_STDLIB_MOVE_H_
|
||||
|
||||
#include "util/stdlib/cxx.h"
|
||||
|
||||
namespace crashpad {
|
||||
|
||||
#if CXX_LIBRARY_VERSION >= 2011
|
||||
//! \brief A typedef for std::remove_reference until C++11 library support is
|
||||
// always available.
|
||||
template <typename T>
|
||||
using remove_reference = std::remove_reference<T>;
|
||||
#else
|
||||
//! \brief A replacement for std::remove_reference until C++11 library support
|
||||
// is always available.
|
||||
template <class T>
|
||||
struct remove_reference { using type = T; };
|
||||
template <class T>
|
||||
struct remove_reference<T&> { using type = T; };
|
||||
#endif // CXX_LIBRARY_VERSION
|
||||
|
||||
#if CXX_LIBRARY_VERSION >= 2011
|
||||
//! \brief A wrapper around std::move() until C++11 library support is
|
||||
// always available.
|
||||
template <typename T>
|
||||
typename std::remove_reference<T>::type&& move(T&& t) {
|
||||
return std::move(t);
|
||||
}
|
||||
#else
|
||||
//! \brief A replacement for std::move() until C++11 library support is
|
||||
// always available.
|
||||
template <typename T>
|
||||
typename remove_reference<T>::type&& move(T&& t) {
|
||||
return static_cast<typename remove_reference<T>::type&&>(t);
|
||||
}
|
||||
#endif // CXX_LIBRARY_VERSION
|
||||
|
||||
} // namespace crashpad
|
||||
|
||||
#endif // CRASHPAD_UTIL_STDLIB_MOVE_H_
|
@ -130,6 +130,7 @@
|
||||
'posix/symbolic_constants_posix.h',
|
||||
'stdlib/cxx.h',
|
||||
'stdlib/map_insert.h',
|
||||
'stdlib/move.h',
|
||||
'stdlib/objc.h',
|
||||
'stdlib/pointer_container.h',
|
||||
'stdlib/string_number_conversion.cc',
|
||||
|
@ -26,6 +26,7 @@
|
||||
#include "snapshot/crashpad_info_client_options.h"
|
||||
#include "snapshot/win/process_snapshot_win.h"
|
||||
#include "util/file/file_writer.h"
|
||||
#include "util/stdlib/move.h"
|
||||
#include "util/misc/random_string.h"
|
||||
#include "util/misc/tri_state.h"
|
||||
#include "util/misc/uuid.h"
|
||||
@ -179,7 +180,7 @@ class ClientData {
|
||||
CreateEvent(nullptr, false /* auto reset */, false, nullptr)),
|
||||
non_crash_dump_completed_event_(
|
||||
CreateEvent(nullptr, false /* auto reset */, false, nullptr)),
|
||||
process_(process.Pass()),
|
||||
process_(crashpad::move(process)),
|
||||
crash_exception_information_address_(
|
||||
crash_exception_information_address),
|
||||
non_crash_exception_information_address_(
|
||||
|
@ -150,11 +150,11 @@ scoped_ptr<uint8_t[]> QueryObject(
|
||||
|
||||
if (!NT_SUCCESS(status)) {
|
||||
NTSTATUS_LOG(ERROR, status) << "NtQueryObject";
|
||||
return scoped_ptr<uint8_t[]>();
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
DCHECK_GE(return_length, minimum_size);
|
||||
return buffer.Pass();
|
||||
return buffer;
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
Loading…
x
Reference in New Issue
Block a user