refactor: use C++11 class member variable initialization (#27477)

This commit is contained in:
Milan Burda 2021-01-26 19:16:21 +01:00 committed by GitHub
parent f083380c38
commit ddf3ef0a5f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
93 changed files with 130 additions and 163 deletions

View file

@ -127,10 +127,11 @@ class ProcessSingleton {
NotificationCallback notification_callback_; // Handler for notifications.
#if defined(OS_WIN)
HWND remote_window_; // The HWND_MESSAGE of another browser.
HWND remote_window_ = nullptr; // The HWND_MESSAGE of another browser.
base::win::MessageWindow window_; // The message-only window.
bool is_virtualized_; // Stuck inside Microsoft Softricity VM environment.
HANDLE lock_file_;
bool is_virtualized_ =
false; // Stuck inside Microsoft Softricity VM environment.
HANDLE lock_file_ = INVALID_HANDLE_VALUE;
base::FilePath user_data_dir_;
ShouldKillRemoteProcessCallback should_kill_remote_process_callback_;
#elif defined(OS_POSIX) && !defined(OS_ANDROID)
@ -175,7 +176,7 @@ class ProcessSingleton {
// because it posts messages between threads.
class LinuxWatcher;
scoped_refptr<LinuxWatcher> watcher_;
int sock_;
int sock_ = -1;
bool listen_on_ready_ = false;
#endif

View file

@ -333,7 +333,7 @@ bool IsChromeProcess(pid_t pid) {
// A helper class to hold onto a socket.
class ScopedSocket {
public:
ScopedSocket() : fd_(-1) { Reset(); }
ScopedSocket() { Reset(); }
~ScopedSocket() { Close(); }
int fd() { return fd_; }
void Reset() {
@ -347,7 +347,7 @@ class ScopedSocket {
}
private:
int fd_;
int fd_ = -1;
};
// Returns a random string for uniquifying profile connections.
@ -473,10 +473,7 @@ class ProcessSingleton::LinuxWatcher
SocketReader(ProcessSingleton::LinuxWatcher* parent,
scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner,
int fd)
: parent_(parent),
ui_task_runner_(ui_task_runner),
fd_(fd),
bytes_read_(0) {
: parent_(parent), ui_task_runner_(ui_task_runner), fd_(fd) {
DCHECK_CURRENTLY_ON(BrowserThread::IO);
// Wait for reads.
fd_watch_controller_ = base::FileDescriptorWatcher::WatchReadable(
@ -508,20 +505,20 @@ class ProcessSingleton::LinuxWatcher
fd_watch_controller_;
// The ProcessSingleton::LinuxWatcher that owns us.
ProcessSingleton::LinuxWatcher* const parent_;
ProcessSingleton::LinuxWatcher* const parent_ = nullptr;
// A reference to the UI task runner.
scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner_;
// The file descriptor we're reading.
const int fd_;
const int fd_ = -1;
// Store the message in this buffer.
char buf_[kMaxMessageLength];
// Tracks the number of bytes we've read in case we're getting partial
// reads.
size_t bytes_read_;
size_t bytes_read_ = 0;
base::OneShotTimer timer_;

View file

@ -172,8 +172,6 @@ ProcessSingleton::ProcessSingleton(
const base::FilePath& user_data_dir,
const NotificationCallback& notification_callback)
: notification_callback_(notification_callback),
is_virtualized_(false),
lock_file_(INVALID_HANDLE_VALUE),
user_data_dir_(user_data_dir),
should_kill_remote_process_callback_(
base::BindRepeating(&TerminateAppWithError)) {

View file

@ -38,8 +38,7 @@ void GlobalMenuBarRegistrarX11::OnWindowUnmapped(x11::Window window) {
live_windows_.erase(window);
}
GlobalMenuBarRegistrarX11::GlobalMenuBarRegistrarX11()
: registrar_proxy_(nullptr) {
GlobalMenuBarRegistrarX11::GlobalMenuBarRegistrarX11() {
// libdbusmenu uses the gio version of dbus; I tried using the code in dbus/,
// but it looks like that's isn't sharing the bus name with the gio version,
// even when |connection_type| is set to SHARED.

View file

@ -48,7 +48,7 @@ class GlobalMenuBarRegistrarX11 {
GObject*,
GParamSpec*);
GDBusProxy* registrar_proxy_;
GDBusProxy* registrar_proxy_ = nullptr;
// x11::Window which want to be registered, but haven't yet been because
// we're waiting for the proxy to become available.