Refactoring: use C++11 class member variable initialization

This commit is contained in:
Milan Burda 2018-05-22 00:18:38 +02:00
parent ee57c95aa6
commit 2337237d58
94 changed files with 218 additions and 377 deletions

View file

@ -35,8 +35,7 @@ static const off_t kMaxMinidumpFileSize = 1258291;
} // namespace
CrashReporterLinux::CrashReporterLinux()
: process_start_time_(0), pid_(getpid()), upload_to_server_(true) {
CrashReporterLinux::CrashReporterLinux() : pid_(getpid()) {
// Set the base process start time value.
struct timeval tv;
if (!gettimeofday(&tv, NULL)) {

View file

@ -54,10 +54,10 @@ class CrashReporterLinux : public CrashReporter {
std::unique_ptr<google_breakpad::ExceptionHandler> breakpad_;
std::unique_ptr<CrashKeyStorage> crash_keys_;
uint64_t process_start_time_;
pid_t pid_;
uint64_t process_start_time_ = 0;
pid_t pid_ = 0;
std::string upload_url_;
bool upload_to_server_;
bool upload_to_server_ = true;
DISALLOW_COPY_AND_ASSIGN(CrashReporterLinux);
};

View file

@ -137,8 +137,7 @@ void UnregisterNonABICompliantCodeRange(void* start) {
} // namespace
CrashReporterWin::CrashReporterWin()
: skip_system_crash_handler_(false), code_range_registered_(false) {}
CrashReporterWin::CrashReporterWin() {}
CrashReporterWin::~CrashReporterWin() {}

View file

@ -64,8 +64,8 @@ class CrashReporterWin : public CrashReporter {
std::vector<google_breakpad::CustomInfoEntry> custom_info_entries_;
google_breakpad::CustomClientInfo custom_info_;
bool skip_system_crash_handler_;
bool code_range_registered_;
bool skip_system_crash_handler_ = false;
bool code_range_registered_ = false;
std::unique_ptr<google_breakpad::ExceptionHandler> breakpad_;
DISALLOW_COPY_AND_ASSIGN(CrashReporterWin);

View file

@ -152,10 +152,10 @@ class MimeWriter {
void AddItemWithoutTrailingSpaces(const void* base, size_t size);
struct kernel_iovec iov_[kIovCapacity];
int iov_index_;
int iov_index_ = 0;
// Output file descriptor.
int fd_;
int fd_ = -1;
const char* const mime_boundary_;
@ -164,7 +164,7 @@ class MimeWriter {
};
MimeWriter::MimeWriter(int fd, const char* const mime_boundary)
: iov_index_(0), fd_(fd), mime_boundary_(mime_boundary) {}
: fd_(fd), mime_boundary_(mime_boundary) {}
MimeWriter::~MimeWriter() {}

View file

@ -188,13 +188,7 @@ const char CrashService::kDumpsDir[] = "dumps-dir";
const char CrashService::kPipeName[] = "pipe-name";
const char CrashService::kReporterURL[] = "reporter-url";
CrashService::CrashService()
: sender_(NULL),
dumper_(NULL),
requests_handled_(0),
requests_sent_(0),
clients_connected_(0),
clients_terminated_(0) {}
CrashService::CrashService() {}
CrashService::~CrashService() {
base::AutoLock lock(sending_);

View file

@ -102,8 +102,8 @@ class CrashService {
// LocalFree.
PSECURITY_DESCRIPTOR GetSecurityDescriptorForLowIntegrity();
google_breakpad::CrashGenerationServer* dumper_;
google_breakpad::CrashReportSender* sender_;
google_breakpad::CrashGenerationServer* dumper_ = nullptr;
google_breakpad::CrashReportSender* sender_ = nullptr;
// the extra tag sent to the server with each dump.
std::wstring reporter_tag_;
@ -112,10 +112,10 @@ class CrashService {
std::wstring reporter_url_;
// clients serviced statistics:
int requests_handled_;
int requests_sent_;
volatile LONG clients_connected_;
volatile LONG clients_terminated_;
int requests_handled_ = 0;
int requests_sent_ = 0;
volatile LONG clients_connected_ = 0;
volatile LONG clients_terminated_ = 0;
base::Lock sending_;
DISALLOW_COPY_AND_ASSIGN(CrashService);