Refactoring: use C++11 class member variable initialization
This commit is contained in:
parent
ee57c95aa6
commit
2337237d58
94 changed files with 218 additions and 377 deletions
|
@ -117,15 +117,13 @@ bool FillFileInfoWithNode(Archive::FileInfo* info,
|
|||
} // namespace
|
||||
|
||||
Archive::Archive(const base::FilePath& path)
|
||||
: path_(path), file_(base::File::FILE_OK), header_size_(0) {
|
||||
: path_(path), file_(base::File::FILE_OK) {
|
||||
base::ThreadRestrictions::ScopedAllowIO allow_io;
|
||||
file_.Initialize(path_, base::File::FLAG_OPEN | base::File::FLAG_READ);
|
||||
#if defined(OS_WIN)
|
||||
fd_ = _open_osfhandle(reinterpret_cast<intptr_t>(file_.GetPlatformFile()), 0);
|
||||
#elif defined(OS_POSIX)
|
||||
fd_ = file_.GetPlatformFile();
|
||||
#else
|
||||
fd_ = -1;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
@ -70,8 +70,8 @@ class Archive {
|
|||
private:
|
||||
base::FilePath path_;
|
||||
base::File file_;
|
||||
int fd_;
|
||||
uint32_t header_size_;
|
||||
int fd_ = -1;
|
||||
uint32_t header_size_ = 0;
|
||||
std::unique_ptr<base::DictionaryValue> header_;
|
||||
|
||||
// Cached external temporary files.
|
||||
|
|
|
@ -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)) {
|
||||
|
|
|
@ -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);
|
||||
};
|
||||
|
|
|
@ -137,8 +137,7 @@ void UnregisterNonABICompliantCodeRange(void* start) {
|
|||
|
||||
} // namespace
|
||||
|
||||
CrashReporterWin::CrashReporterWin()
|
||||
: skip_system_crash_handler_(false), code_range_registered_(false) {}
|
||||
CrashReporterWin::CrashReporterWin() {}
|
||||
|
||||
CrashReporterWin::~CrashReporterWin() {}
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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() {}
|
||||
|
||||
|
|
|
@ -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_);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -122,11 +122,7 @@ class V8ValueConverter::ScopedUniquenessGuard {
|
|||
DISALLOW_COPY_AND_ASSIGN(ScopedUniquenessGuard);
|
||||
};
|
||||
|
||||
V8ValueConverter::V8ValueConverter()
|
||||
: reg_exp_allowed_(false),
|
||||
function_allowed_(false),
|
||||
disable_node_(false),
|
||||
strip_null_from_objects_(false) {}
|
||||
V8ValueConverter::V8ValueConverter() {}
|
||||
|
||||
void V8ValueConverter::SetRegExpAllowed(bool val) {
|
||||
reg_exp_allowed_ = val;
|
||||
|
|
|
@ -58,21 +58,21 @@ class V8ValueConverter {
|
|||
v8::Isolate* isolate) const;
|
||||
|
||||
// If true, we will convert RegExp JavaScript objects to string.
|
||||
bool reg_exp_allowed_;
|
||||
bool reg_exp_allowed_ = false;
|
||||
|
||||
// If true, we will convert Function JavaScript objects to dictionaries.
|
||||
bool function_allowed_;
|
||||
bool function_allowed_ = false;
|
||||
|
||||
// If true, will not use node::Buffer::Copy to deserialize byte arrays.
|
||||
// node::Buffer::Copy depends on a working node.js environment, and this is
|
||||
// not desirable in sandboxed renderers. That means Buffer instances sent from
|
||||
// browser process will be deserialized as browserify-based Buffer(which are
|
||||
// wrappers around Uint8Array).
|
||||
bool disable_node_;
|
||||
bool disable_node_ = false;
|
||||
|
||||
// If true, undefined and null values are ignored when converting v8 objects
|
||||
// into Values.
|
||||
bool strip_null_from_objects_;
|
||||
bool strip_null_from_objects_ = false;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(V8ValueConverter);
|
||||
};
|
||||
|
|
|
@ -135,10 +135,7 @@ base::FilePath GetResourcesPath(bool is_browser) {
|
|||
} // namespace
|
||||
|
||||
NodeBindings::NodeBindings(BrowserEnvironment browser_env)
|
||||
: browser_env_(browser_env),
|
||||
embed_closed_(false),
|
||||
uv_env_(nullptr),
|
||||
weak_factory_(this) {
|
||||
: browser_env_(browser_env), weak_factory_(this) {
|
||||
if (browser_env == WORKER) {
|
||||
uv_loop_init(&worker_loop_);
|
||||
uv_loop_ = &worker_loop_;
|
||||
|
|
|
@ -87,7 +87,7 @@ class NodeBindings {
|
|||
static void EmbedThreadRunner(void* arg);
|
||||
|
||||
// Whether the libuv loop has ended.
|
||||
bool embed_closed_;
|
||||
bool embed_closed_ = false;
|
||||
|
||||
// Loop used when constructed in WORKER mode
|
||||
uv_loop_t worker_loop_;
|
||||
|
@ -102,7 +102,7 @@ class NodeBindings {
|
|||
uv_sem_t embed_sem_;
|
||||
|
||||
// Environment that to wrap the uv loop.
|
||||
node::Environment* uv_env_;
|
||||
node::Environment* uv_env_ = nullptr;
|
||||
|
||||
base::WeakPtrFactory<NodeBindings> weak_factory_;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue