зеркало из https://github.com/electron/electron.git
refactor: use C++11 class member variable initialization (#27477)
This commit is contained in:
Родитель
f083380c38
Коммит
ddf3ef0a5f
|
@ -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
|
||||
|
||||
|
|
|
@ -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_;
|
||||
|
||||
|
|
|
@ -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)) {
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -82,7 +82,7 @@ class ElectronCrashReporterClient : public crash_reporter::CrashReporterClient {
|
|||
friend class base::NoDestructor<ElectronCrashReporterClient>;
|
||||
|
||||
std::string upload_url_;
|
||||
bool collect_stats_consent_;
|
||||
bool collect_stats_consent_ = false;
|
||||
bool rate_limit_ = false;
|
||||
bool compress_uploads_ = false;
|
||||
std::map<std::string, std::string> global_annotations_;
|
||||
|
|
|
@ -76,8 +76,7 @@ v8::Local<v8::Value> ToBuffer(v8::Isolate* isolate, void* val, int size) {
|
|||
} // namespace
|
||||
|
||||
BaseWindow::BaseWindow(v8::Isolate* isolate,
|
||||
const gin_helper::Dictionary& options)
|
||||
: weak_factory_(this) {
|
||||
const gin_helper::Dictionary& options) {
|
||||
// The parent window.
|
||||
gin::Handle<BaseWindow> parent;
|
||||
if (options.Get("parent", &parent) && !parent.IsEmpty())
|
||||
|
|
|
@ -274,7 +274,7 @@ class BaseWindow : public gin_helper::TrackableObject<BaseWindow>,
|
|||
// Reference to JS wrapper to prevent garbage collection.
|
||||
v8::Global<v8::Value> self_ref_;
|
||||
|
||||
base::WeakPtrFactory<BaseWindow> weak_factory_;
|
||||
base::WeakPtrFactory<BaseWindow> weak_factory_{this};
|
||||
};
|
||||
|
||||
} // namespace api
|
||||
|
|
|
@ -32,7 +32,7 @@ namespace api {
|
|||
|
||||
BrowserWindow::BrowserWindow(gin::Arguments* args,
|
||||
const gin_helper::Dictionary& options)
|
||||
: BaseWindow(args->isolate(), options), weak_factory_(this) {
|
||||
: BaseWindow(args->isolate(), options) {
|
||||
// Use options.webPreferences in WebContents.
|
||||
v8::Isolate* isolate = args->isolate();
|
||||
gin_helper::Dictionary web_preferences =
|
||||
|
|
|
@ -126,7 +126,7 @@ class BrowserWindow : public BaseWindow,
|
|||
v8::Global<v8::Value> web_contents_;
|
||||
base::WeakPtr<api::WebContents> api_web_contents_;
|
||||
|
||||
base::WeakPtrFactory<BrowserWindow> weak_factory_;
|
||||
base::WeakPtrFactory<BrowserWindow> weak_factory_{this};
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(BrowserWindow);
|
||||
};
|
||||
|
|
|
@ -47,7 +47,7 @@ class MenuMac : public Menu {
|
|||
// window ID -> open context menu
|
||||
std::map<int32_t, scoped_nsobject<ElectronMenuController>> popup_controllers_;
|
||||
|
||||
base::WeakPtrFactory<MenuMac> weak_factory_;
|
||||
base::WeakPtrFactory<MenuMac> weak_factory_{this};
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(MenuMac);
|
||||
};
|
||||
|
|
|
@ -30,7 +30,7 @@ namespace electron {
|
|||
|
||||
namespace api {
|
||||
|
||||
MenuMac::MenuMac(gin::Arguments* args) : Menu(args), weak_factory_(this) {}
|
||||
MenuMac::MenuMac(gin::Arguments* args) : Menu(args) {}
|
||||
|
||||
MenuMac::~MenuMac() = default;
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@ namespace electron {
|
|||
|
||||
namespace api {
|
||||
|
||||
MenuViews::MenuViews(gin::Arguments* args) : Menu(args), weak_factory_(this) {}
|
||||
MenuViews::MenuViews(gin::Arguments* args) : Menu(args) {}
|
||||
|
||||
MenuViews::~MenuViews() = default;
|
||||
|
||||
|
|
|
@ -36,7 +36,7 @@ class MenuViews : public Menu {
|
|||
// window ID -> open context menu
|
||||
std::map<int32_t, std::unique_ptr<views::MenuRunner>> menu_runners_;
|
||||
|
||||
base::WeakPtrFactory<MenuViews> weak_factory_;
|
||||
base::WeakPtrFactory<MenuViews> weak_factory_{this};
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(MenuViews);
|
||||
};
|
||||
|
|
|
@ -79,7 +79,7 @@ namespace api {
|
|||
gin::WrapperInfo NetLog::kWrapperInfo = {gin::kEmbedderNativeGin};
|
||||
|
||||
NetLog::NetLog(v8::Isolate* isolate, ElectronBrowserContext* browser_context)
|
||||
: browser_context_(browser_context), weak_ptr_factory_(this) {
|
||||
: browser_context_(browser_context) {
|
||||
file_task_runner_ = CreateFileTaskRunner();
|
||||
}
|
||||
|
||||
|
|
|
@ -65,7 +65,7 @@ class NetLog : public gin::Wrappable<NetLog> {
|
|||
|
||||
scoped_refptr<base::TaskRunner> file_task_runner_;
|
||||
|
||||
base::WeakPtrFactory<NetLog> weak_ptr_factory_;
|
||||
base::WeakPtrFactory<NetLog> weak_ptr_factory_{this};
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(NetLog);
|
||||
};
|
||||
|
|
|
@ -45,8 +45,7 @@ namespace api {
|
|||
gin::WrapperInfo PowerSaveBlocker::kWrapperInfo = {gin::kEmbedderNativeGin};
|
||||
|
||||
PowerSaveBlocker::PowerSaveBlocker(v8::Isolate* isolate)
|
||||
: current_lock_type_(device::mojom::WakeLockType::kPreventAppSuspension),
|
||||
is_wake_lock_active_(false) {}
|
||||
: current_lock_type_(device::mojom::WakeLockType::kPreventAppSuspension) {}
|
||||
|
||||
PowerSaveBlocker::~PowerSaveBlocker() = default;
|
||||
|
||||
|
|
|
@ -44,7 +44,7 @@ class PowerSaveBlocker : public gin::Wrappable<PowerSaveBlocker> {
|
|||
device::mojom::WakeLockType current_lock_type_;
|
||||
|
||||
// Whether the wake lock is currently active.
|
||||
bool is_wake_lock_active_;
|
||||
bool is_wake_lock_active_ = false;
|
||||
|
||||
// Map from id to the corresponding blocker type for each request.
|
||||
using WakeLockTypeMap = std::map<int, device::mojom::WakeLockType>;
|
||||
|
|
|
@ -74,7 +74,7 @@ gin::WrapperInfo ServiceWorkerContext::kWrapperInfo = {gin::kEmbedderNativeGin};
|
|||
ServiceWorkerContext::ServiceWorkerContext(
|
||||
v8::Isolate* isolate,
|
||||
ElectronBrowserContext* browser_context)
|
||||
: browser_context_(browser_context), weak_ptr_factory_(this) {
|
||||
: browser_context_(browser_context) {
|
||||
service_worker_context_ =
|
||||
content::BrowserContext::GetDefaultStoragePartition(browser_context_)
|
||||
->GetServiceWorkerContext();
|
||||
|
|
|
@ -52,7 +52,7 @@ class ServiceWorkerContext
|
|||
|
||||
content::ServiceWorkerContext* service_worker_context_;
|
||||
|
||||
base::WeakPtrFactory<ServiceWorkerContext> weak_ptr_factory_;
|
||||
base::WeakPtrFactory<ServiceWorkerContext> weak_ptr_factory_{this};
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(ServiceWorkerContext);
|
||||
};
|
||||
|
|
|
@ -156,9 +156,9 @@ class SystemPreferences
|
|||
|
||||
std::string current_color_;
|
||||
|
||||
bool invertered_color_scheme_;
|
||||
bool invertered_color_scheme_ = false;
|
||||
|
||||
bool high_contrast_color_scheme_;
|
||||
bool high_contrast_color_scheme_ = false;
|
||||
|
||||
std::unique_ptr<gfx::ScopedSysColorChangeListener> color_change_listener_;
|
||||
#endif
|
||||
|
|
|
@ -617,11 +617,12 @@ WebContents::WebContents(v8::Isolate* isolate,
|
|||
id_(GetAllWebContents().Add(this)),
|
||||
devtools_file_system_indexer_(new DevToolsFileSystemIndexer),
|
||||
file_task_runner_(
|
||||
base::ThreadPool::CreateSequencedTaskRunner({base::MayBlock()})),
|
||||
base::ThreadPool::CreateSequencedTaskRunner({base::MayBlock()}))
|
||||
#if BUILDFLAG(ENABLE_PRINTING)
|
||||
print_task_runner_(CreatePrinterHandlerTaskRunner()),
|
||||
,
|
||||
print_task_runner_(CreatePrinterHandlerTaskRunner())
|
||||
#endif
|
||||
weak_factory_(this) {
|
||||
{
|
||||
#if BUILDFLAG(ENABLE_ELECTRON_EXTENSIONS)
|
||||
// WebContents created by extension host will have valid ViewType set.
|
||||
extensions::ViewType view_type = extensions::GetViewType(web_contents);
|
||||
|
@ -653,11 +654,12 @@ WebContents::WebContents(v8::Isolate* isolate,
|
|||
id_(GetAllWebContents().Add(this)),
|
||||
devtools_file_system_indexer_(new DevToolsFileSystemIndexer),
|
||||
file_task_runner_(
|
||||
base::ThreadPool::CreateSequencedTaskRunner({base::MayBlock()})),
|
||||
base::ThreadPool::CreateSequencedTaskRunner({base::MayBlock()}))
|
||||
#if BUILDFLAG(ENABLE_PRINTING)
|
||||
print_task_runner_(CreatePrinterHandlerTaskRunner()),
|
||||
,
|
||||
print_task_runner_(CreatePrinterHandlerTaskRunner())
|
||||
#endif
|
||||
weak_factory_(this) {
|
||||
{
|
||||
DCHECK(type != Type::kRemote)
|
||||
<< "Can't take ownership of a remote WebContents";
|
||||
auto session = Session::CreateFrom(isolate, GetBrowserContext());
|
||||
|
@ -671,11 +673,12 @@ WebContents::WebContents(v8::Isolate* isolate,
|
|||
: id_(GetAllWebContents().Add(this)),
|
||||
devtools_file_system_indexer_(new DevToolsFileSystemIndexer),
|
||||
file_task_runner_(
|
||||
base::ThreadPool::CreateSequencedTaskRunner({base::MayBlock()})),
|
||||
base::ThreadPool::CreateSequencedTaskRunner({base::MayBlock()}))
|
||||
#if BUILDFLAG(ENABLE_PRINTING)
|
||||
print_task_runner_(CreatePrinterHandlerTaskRunner()),
|
||||
,
|
||||
print_task_runner_(CreatePrinterHandlerTaskRunner())
|
||||
#endif
|
||||
weak_factory_(this) {
|
||||
{
|
||||
// Read options.
|
||||
options.Get("backgroundThrottling", &background_throttling_);
|
||||
|
||||
|
|
|
@ -787,7 +787,7 @@ class WebContents : public gin::Wrappable<WebContents>,
|
|||
|
||||
service_manager::BinderRegistryWithArgs<content::RenderFrameHost*> registry_;
|
||||
|
||||
base::WeakPtrFactory<WebContents> weak_factory_;
|
||||
base::WeakPtrFactory<WebContents> weak_factory_{this};
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(WebContents);
|
||||
};
|
||||
|
|
|
@ -26,8 +26,7 @@ FrameSubscriber::FrameSubscriber(content::WebContents* web_contents,
|
|||
bool only_dirty)
|
||||
: content::WebContentsObserver(web_contents),
|
||||
callback_(callback),
|
||||
only_dirty_(only_dirty),
|
||||
weak_ptr_factory_(this) {
|
||||
only_dirty_(only_dirty) {
|
||||
content::RenderViewHost* rvh = web_contents->GetRenderViewHost();
|
||||
if (rvh)
|
||||
AttachToHost(rvh->GetWidget());
|
||||
|
|
|
@ -67,7 +67,7 @@ class FrameSubscriber : public content::WebContentsObserver,
|
|||
content::RenderWidgetHost* host_;
|
||||
std::unique_ptr<viz::ClientFrameSinkVideoCapturer> video_capturer_;
|
||||
|
||||
base::WeakPtrFactory<FrameSubscriber> weak_ptr_factory_;
|
||||
base::WeakPtrFactory<FrameSubscriber> weak_ptr_factory_{this};
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(FrameSubscriber);
|
||||
};
|
||||
|
|
|
@ -102,12 +102,10 @@ ElectronBrowserContext::browser_context_map() {
|
|||
ElectronBrowserContext::ElectronBrowserContext(const std::string& partition,
|
||||
bool in_memory,
|
||||
base::DictionaryValue options)
|
||||
: in_memory_pref_store_(nullptr),
|
||||
storage_policy_(new SpecialStoragePolicy),
|
||||
: storage_policy_(new SpecialStoragePolicy),
|
||||
protocol_registry_(new ProtocolRegistry),
|
||||
in_memory_(in_memory),
|
||||
ssl_config_(network::mojom::SSLConfig::New()),
|
||||
weak_factory_(this) {
|
||||
ssl_config_(network::mojom::SSLConfig::New()) {
|
||||
user_agent_ = ElectronBrowserClient::Get()->GetUserAgent();
|
||||
|
||||
// Read options.
|
||||
|
|
|
@ -165,7 +165,7 @@ class ElectronBrowserContext
|
|||
// Initialize pref registry.
|
||||
void InitPrefs();
|
||||
|
||||
ValueMapPrefStore* in_memory_pref_store_;
|
||||
ValueMapPrefStore* in_memory_pref_store_ = nullptr;
|
||||
|
||||
std::unique_ptr<content::ResourceContext> resource_context_;
|
||||
std::unique_ptr<CookieChangeNotifier> cookie_change_notifier_;
|
||||
|
@ -197,7 +197,7 @@ class ElectronBrowserContext
|
|||
network::mojom::SSLConfigPtr ssl_config_;
|
||||
mojo::Remote<network::mojom::SSLConfigClient> ssl_config_client_;
|
||||
|
||||
base::WeakPtrFactory<ElectronBrowserContext> weak_factory_;
|
||||
base::WeakPtrFactory<ElectronBrowserContext> weak_factory_{this};
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(ElectronBrowserContext);
|
||||
};
|
||||
|
|
|
@ -17,8 +17,7 @@ ElectronBrowserHandlerImpl::ElectronBrowserHandlerImpl(
|
|||
content::RenderFrameHost* frame_host,
|
||||
mojo::PendingReceiver<mojom::ElectronBrowser> receiver)
|
||||
: render_process_id_(frame_host->GetProcess()->GetID()),
|
||||
render_frame_id_(frame_host->GetRoutingID()),
|
||||
weak_factory_(this) {
|
||||
render_frame_id_(frame_host->GetRoutingID()) {
|
||||
content::WebContents* web_contents =
|
||||
content::WebContents::FromRenderFrameHost(frame_host);
|
||||
DCHECK(web_contents);
|
||||
|
|
|
@ -74,7 +74,7 @@ class ElectronBrowserHandlerImpl : public mojom::ElectronBrowser,
|
|||
|
||||
mojo::Receiver<mojom::ElectronBrowser> receiver_{this};
|
||||
|
||||
base::WeakPtrFactory<ElectronBrowserHandlerImpl> weak_factory_;
|
||||
base::WeakPtrFactory<ElectronBrowserHandlerImpl> weak_factory_{this};
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(ElectronBrowserHandlerImpl);
|
||||
};
|
||||
|
|
|
@ -52,7 +52,7 @@ base::FilePath CreateDownloadPath(const GURL& url,
|
|||
|
||||
ElectronDownloadManagerDelegate::ElectronDownloadManagerDelegate(
|
||||
content::DownloadManager* manager)
|
||||
: download_manager_(manager), weak_ptr_factory_(this) {}
|
||||
: download_manager_(manager) {}
|
||||
|
||||
ElectronDownloadManagerDelegate::~ElectronDownloadManagerDelegate() {
|
||||
if (download_manager_) {
|
||||
|
|
|
@ -53,7 +53,7 @@ class ElectronDownloadManagerDelegate
|
|||
gin_helper::Dictionary result);
|
||||
|
||||
content::DownloadManager* download_manager_;
|
||||
base::WeakPtrFactory<ElectronDownloadManagerDelegate> weak_ptr_factory_;
|
||||
base::WeakPtrFactory<ElectronDownloadManagerDelegate> weak_ptr_factory_{this};
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(ElectronDownloadManagerDelegate);
|
||||
};
|
||||
|
|
|
@ -69,8 +69,7 @@ std::pair<scoped_refptr<const Extension>, std::string> LoadUnpacked(
|
|||
ElectronExtensionLoader::ElectronExtensionLoader(
|
||||
content::BrowserContext* browser_context)
|
||||
: browser_context_(browser_context),
|
||||
extension_registrar_(browser_context, this),
|
||||
weak_factory_(this) {}
|
||||
extension_registrar_(browser_context, this) {}
|
||||
|
||||
ElectronExtensionLoader::~ElectronExtensionLoader() = default;
|
||||
|
||||
|
|
|
@ -90,7 +90,7 @@ class ElectronExtensionLoader : public ExtensionRegistrar::Delegate {
|
|||
// LoadExtensionForReload().
|
||||
bool did_schedule_reload_ = false;
|
||||
|
||||
base::WeakPtrFactory<ElectronExtensionLoader> weak_factory_;
|
||||
base::WeakPtrFactory<ElectronExtensionLoader> weak_factory_{this};
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(ElectronExtensionLoader);
|
||||
};
|
||||
|
|
|
@ -49,8 +49,7 @@ namespace extensions {
|
|||
ElectronExtensionSystem::ElectronExtensionSystem(
|
||||
BrowserContext* browser_context)
|
||||
: browser_context_(browser_context),
|
||||
store_factory_(new ValueStoreFactoryImpl(browser_context->GetPath())),
|
||||
weak_factory_(this) {}
|
||||
store_factory_(new ValueStoreFactoryImpl(browser_context->GetPath())) {}
|
||||
|
||||
ElectronExtensionSystem::~ElectronExtensionSystem() = default;
|
||||
|
||||
|
|
|
@ -113,7 +113,7 @@ class ElectronExtensionSystem : public ExtensionSystem {
|
|||
// Signaled when the extension system has completed its startup tasks.
|
||||
base::OneShotEvent ready_;
|
||||
|
||||
base::WeakPtrFactory<ElectronExtensionSystem> weak_factory_;
|
||||
base::WeakPtrFactory<ElectronExtensionSystem> weak_factory_{this};
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(ElectronExtensionSystem);
|
||||
};
|
||||
|
|
|
@ -53,7 +53,7 @@ class TransactionObserver {
|
|||
private:
|
||||
InAppTransactionObserver* observer_;
|
||||
|
||||
base::WeakPtrFactory<TransactionObserver> weak_ptr_factory_;
|
||||
base::WeakPtrFactory<TransactionObserver> weak_ptr_factory_{this};
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(TransactionObserver);
|
||||
};
|
||||
|
|
|
@ -182,7 +182,7 @@ Transaction::Transaction() = default;
|
|||
Transaction::Transaction(const Transaction&) = default;
|
||||
Transaction::~Transaction() = default;
|
||||
|
||||
TransactionObserver::TransactionObserver() : weak_ptr_factory_(this) {
|
||||
TransactionObserver::TransactionObserver() {
|
||||
observer_ = [[InAppTransactionObserver alloc]
|
||||
initWithCallback:base::BindRepeating(
|
||||
&TransactionObserver::OnTransactionsUpdated,
|
||||
|
|
|
@ -33,8 +33,7 @@ MediaCaptureDevicesDispatcher* MediaCaptureDevicesDispatcher::GetInstance() {
|
|||
return base::Singleton<MediaCaptureDevicesDispatcher>::get();
|
||||
}
|
||||
|
||||
MediaCaptureDevicesDispatcher::MediaCaptureDevicesDispatcher()
|
||||
: is_device_enumeration_disabled_(false) {
|
||||
MediaCaptureDevicesDispatcher::MediaCaptureDevicesDispatcher() {
|
||||
// MediaCaptureDevicesDispatcher is a singleton. It should be created on
|
||||
// UI thread.
|
||||
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
|
||||
|
|
|
@ -80,7 +80,7 @@ class MediaCaptureDevicesDispatcher : public content::MediaObserver {
|
|||
blink::MediaStreamDevices test_video_devices_;
|
||||
|
||||
// Flag used by unittests to disable device enumeration.
|
||||
bool is_device_enumeration_disabled_;
|
||||
bool is_device_enumeration_disabled_ = false;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(MediaCaptureDevicesDispatcher);
|
||||
};
|
||||
|
|
|
@ -48,7 +48,7 @@ gfx::Size GetExpandedWindowSize(const NativeWindow* window, gfx::Size size) {
|
|||
|
||||
NativeWindow::NativeWindow(const gin_helper::Dictionary& options,
|
||||
NativeWindow* parent)
|
||||
: widget_(new views::Widget), parent_(parent), weak_factory_(this) {
|
||||
: widget_(new views::Widget), parent_(parent) {
|
||||
++next_id_;
|
||||
|
||||
options.Get(options::kFrame, &has_frame_);
|
||||
|
|
|
@ -382,7 +382,7 @@ class NativeWindow : public base::SupportsUserData,
|
|||
// Accessible title.
|
||||
base::string16 accessible_title_;
|
||||
|
||||
base::WeakPtrFactory<NativeWindow> weak_factory_;
|
||||
base::WeakPtrFactory<NativeWindow> weak_factory_{this};
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(NativeWindow);
|
||||
};
|
||||
|
|
|
@ -21,8 +21,7 @@ NodeStreamLoader::NodeStreamLoader(
|
|||
: binding_(this, std::move(loader)),
|
||||
client_(std::move(client)),
|
||||
isolate_(isolate),
|
||||
emitter_(isolate, emitter),
|
||||
weak_factory_(this) {
|
||||
emitter_(isolate, emitter) {
|
||||
binding_.set_connection_error_handler(
|
||||
base::BindOnce(&NodeStreamLoader::NotifyComplete,
|
||||
weak_factory_.GetWeakPtr(), net::ERR_FAILED));
|
||||
|
|
|
@ -95,7 +95,7 @@ class NodeStreamLoader : public network::mojom::URLLoader {
|
|||
// Store the V8 callbacks to unsubscribe them later.
|
||||
std::map<std::string, v8::Global<v8::Value>> handlers_;
|
||||
|
||||
base::WeakPtrFactory<NodeStreamLoader> weak_factory_;
|
||||
base::WeakPtrFactory<NodeStreamLoader> weak_factory_{this};
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(NodeStreamLoader);
|
||||
};
|
||||
|
|
|
@ -19,9 +19,7 @@ URLPipeLoader::URLPipeLoader(
|
|||
mojo::PendingRemote<network::mojom::URLLoaderClient> client,
|
||||
const net::NetworkTrafficAnnotationTag& annotation,
|
||||
base::DictionaryValue upload_data)
|
||||
: binding_(this, std::move(loader)),
|
||||
client_(std::move(client)),
|
||||
weak_factory_(this) {
|
||||
: binding_(this, std::move(loader)), client_(std::move(client)) {
|
||||
binding_.set_connection_error_handler(base::BindOnce(
|
||||
&URLPipeLoader::NotifyComplete, base::Unretained(this), net::ERR_FAILED));
|
||||
|
||||
|
|
|
@ -75,7 +75,7 @@ class URLPipeLoader : public network::mojom::URLLoader,
|
|||
std::unique_ptr<mojo::DataPipeProducer> producer_;
|
||||
std::unique_ptr<network::SimpleURLLoader> loader_;
|
||||
|
||||
base::WeakPtrFactory<URLPipeLoader> weak_factory_;
|
||||
base::WeakPtrFactory<URLPipeLoader> weak_factory_{this};
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(URLPipeLoader);
|
||||
};
|
||||
|
|
|
@ -75,7 +75,7 @@ bool LibnotifyNotification::Initialize() {
|
|||
|
||||
LibnotifyNotification::LibnotifyNotification(NotificationDelegate* delegate,
|
||||
NotificationPresenter* presenter)
|
||||
: Notification(delegate, presenter), notification_(nullptr) {}
|
||||
: Notification(delegate, presenter) {}
|
||||
|
||||
LibnotifyNotification::~LibnotifyNotification() {
|
||||
if (notification_) {
|
||||
|
|
|
@ -37,7 +37,7 @@ class LibnotifyNotification : public Notification {
|
|||
NotifyNotification*,
|
||||
char*);
|
||||
|
||||
NotifyNotification* notification_;
|
||||
NotifyNotification* notification_ = nullptr;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(LibnotifyNotification);
|
||||
};
|
||||
|
|
|
@ -14,7 +14,7 @@ NotificationOptions::~NotificationOptions() = default;
|
|||
|
||||
Notification::Notification(NotificationDelegate* delegate,
|
||||
NotificationPresenter* presenter)
|
||||
: delegate_(delegate), presenter_(presenter), weak_factory_(this) {}
|
||||
: delegate_(delegate), presenter_(presenter) {}
|
||||
|
||||
Notification::~Notification() {
|
||||
if (delegate())
|
||||
|
|
|
@ -82,7 +82,7 @@ class Notification {
|
|||
NotificationPresenter* presenter_;
|
||||
std::string notification_id_;
|
||||
|
||||
base::WeakPtrFactory<Notification> weak_factory_;
|
||||
base::WeakPtrFactory<Notification> weak_factory_{this};
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(Notification);
|
||||
};
|
||||
|
|
|
@ -182,11 +182,9 @@ OffScreenRenderWidgetHostView::OffScreenRenderWidgetHostView(
|
|||
frame_rate_(frame_rate),
|
||||
size_(initial_size),
|
||||
painting_(painting),
|
||||
is_showing_(false),
|
||||
cursor_manager_(new content::CursorManager(this)),
|
||||
mouse_wheel_phase_handler_(this),
|
||||
backing_(new SkBitmap),
|
||||
weak_ptr_factory_(this) {
|
||||
backing_(new SkBitmap) {
|
||||
DCHECK(render_widget_host_);
|
||||
DCHECK(!render_widget_host_->GetView());
|
||||
|
||||
|
|
|
@ -280,7 +280,7 @@ class OffScreenRenderWidgetHostView : public content::RenderWidgetHostViewBase,
|
|||
|
||||
std::unique_ptr<SkBitmap> backing_;
|
||||
|
||||
base::WeakPtrFactory<OffScreenRenderWidgetHostView> weak_ptr_factory_;
|
||||
base::WeakPtrFactory<OffScreenRenderWidgetHostView> weak_ptr_factory_{this};
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(OffScreenRenderWidgetHostView);
|
||||
};
|
||||
|
|
|
@ -18,8 +18,7 @@ OffScreenVideoConsumer::OffScreenVideoConsumer(
|
|||
OnPaintCallback callback)
|
||||
: callback_(callback),
|
||||
view_(view),
|
||||
video_capturer_(view->CreateVideoCapturer()),
|
||||
weak_ptr_factory_(this) {
|
||||
video_capturer_(view->CreateVideoCapturer()) {
|
||||
video_capturer_->SetResolutionConstraints(view_->SizeInPixels(),
|
||||
view_->SizeInPixels(), true);
|
||||
video_capturer_->SetAutoThrottlingEnabled(false);
|
||||
|
|
|
@ -48,7 +48,7 @@ class OffScreenVideoConsumer : public viz::mojom::FrameSinkVideoConsumer {
|
|||
OffScreenRenderWidgetHostView* view_;
|
||||
std::unique_ptr<viz::ClientFrameSinkVideoCapturer> video_capturer_;
|
||||
|
||||
base::WeakPtrFactory<OffScreenVideoConsumer> weak_ptr_factory_;
|
||||
base::WeakPtrFactory<OffScreenVideoConsumer> weak_ptr_factory_{this};
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(OffScreenVideoConsumer);
|
||||
};
|
||||
|
|
|
@ -14,7 +14,7 @@ namespace electron {
|
|||
OffScreenWebContentsView::OffScreenWebContentsView(
|
||||
bool transparent,
|
||||
const OnPaintCallback& callback)
|
||||
: native_window_(nullptr), transparent_(transparent), callback_(callback) {
|
||||
: transparent_(transparent), callback_(callback) {
|
||||
#if defined(OS_MAC)
|
||||
PlatformCreate();
|
||||
#endif
|
||||
|
|
|
@ -88,7 +88,7 @@ class OffScreenWebContentsView : public content::WebContentsView,
|
|||
|
||||
OffScreenRenderWidgetHostView* GetView() const;
|
||||
|
||||
NativeWindow* native_window_;
|
||||
NativeWindow* native_window_ = nullptr;
|
||||
|
||||
const bool transparent_;
|
||||
bool painting_ = true;
|
||||
|
|
|
@ -53,7 +53,7 @@ void StopWorker(int document_cookie) {
|
|||
|
||||
PrintPreviewMessageHandler::PrintPreviewMessageHandler(
|
||||
content::WebContents* web_contents)
|
||||
: content::WebContentsObserver(web_contents), weak_ptr_factory_(this) {
|
||||
: content::WebContentsObserver(web_contents) {
|
||||
DCHECK(web_contents);
|
||||
}
|
||||
|
||||
|
|
|
@ -96,7 +96,7 @@ class PrintPreviewMessageHandler
|
|||
|
||||
mojo::AssociatedReceiver<printing::mojom::PrintPreviewUI> receiver_{this};
|
||||
|
||||
base::WeakPtrFactory<PrintPreviewMessageHandler> weak_ptr_factory_;
|
||||
base::WeakPtrFactory<PrintPreviewMessageHandler> weak_ptr_factory_{this};
|
||||
|
||||
WEB_CONTENTS_USER_DATA_KEY_DECL();
|
||||
|
||||
|
|
|
@ -158,7 +158,7 @@ namespace gtkui {
|
|||
AppIndicatorIcon::AppIndicatorIcon(std::string id,
|
||||
const gfx::ImageSkia& image,
|
||||
const base::string16& tool_tip)
|
||||
: id_(id), icon_(nullptr), menu_model_(nullptr), icon_change_count_(0) {
|
||||
: id_(id) {
|
||||
std::unique_ptr<base::Environment> env(base::Environment::Create());
|
||||
desktop_env_ = base::nix::GetDesktopEnvironment(env.get());
|
||||
|
||||
|
|
|
@ -96,13 +96,13 @@ class AppIndicatorIcon : public views::StatusIconLinux {
|
|||
base::nix::DesktopEnvironment desktop_env_;
|
||||
|
||||
// Gtk status icon wrapper
|
||||
AppIndicator* icon_;
|
||||
AppIndicator* icon_ = nullptr;
|
||||
|
||||
std::unique_ptr<AppIndicatorIconMenu> menu_;
|
||||
ui::MenuModel* menu_model_;
|
||||
ui::MenuModel* menu_model_ = nullptr;
|
||||
|
||||
base::FilePath temp_dir_;
|
||||
int icon_change_count_;
|
||||
int icon_change_count_ = 0;
|
||||
|
||||
base::WeakPtrFactory<AppIndicatorIcon> weak_factory_{this};
|
||||
|
||||
|
|
|
@ -16,10 +16,7 @@ namespace electron {
|
|||
namespace gtkui {
|
||||
|
||||
AppIndicatorIconMenu::AppIndicatorIconMenu(ui::MenuModel* model)
|
||||
: menu_model_(model),
|
||||
click_action_replacement_menu_item_added_(false),
|
||||
gtk_menu_(nullptr),
|
||||
block_activation_(false) {
|
||||
: menu_model_(model) {
|
||||
{
|
||||
ANNOTATE_SCOPED_MEMORY_LEAK; // http://crbug.com/378770
|
||||
gtk_menu_ = gtk_menu_new();
|
||||
|
|
|
@ -54,16 +54,16 @@ class AppIndicatorIconMenu {
|
|||
ui::MenuModel* menu_model_;
|
||||
|
||||
// Whether a "click action replacement" menu item has been added to the menu.
|
||||
bool click_action_replacement_menu_item_added_;
|
||||
bool click_action_replacement_menu_item_added_ = false;
|
||||
|
||||
// Called when the click action replacement menu item is activated. When a
|
||||
// menu item from |menu_model_| is activated, MenuModel::ActivatedAt() is
|
||||
// invoked and is assumed to do any necessary processing.
|
||||
base::Closure click_action_replacement_callback_;
|
||||
|
||||
GtkWidget* gtk_menu_;
|
||||
GtkWidget* gtk_menu_ = nullptr;
|
||||
|
||||
bool block_activation_;
|
||||
bool block_activation_ = false;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(AppIndicatorIconMenu);
|
||||
};
|
||||
|
|
|
@ -337,14 +337,10 @@ InspectableWebContents::InspectableWebContents(
|
|||
content::WebContents* web_contents,
|
||||
PrefService* pref_service,
|
||||
bool is_guest)
|
||||
: frontend_loaded_(false),
|
||||
can_dock_(true),
|
||||
delegate_(nullptr),
|
||||
pref_service_(pref_service),
|
||||
: pref_service_(pref_service),
|
||||
web_contents_(web_contents),
|
||||
is_guest_(is_guest),
|
||||
view_(CreateInspectableContentsView(this)),
|
||||
weak_factory_(this) {
|
||||
view_(CreateInspectableContentsView(this)) {
|
||||
const base::Value* bounds_dict = pref_service_->Get(kDevToolsBoundsPref);
|
||||
if (bounds_dict->is_dict()) {
|
||||
devtools_bounds_ = DictionaryToRect(bounds_dict);
|
||||
|
|
|
@ -201,7 +201,7 @@ class InspectableWebContents
|
|||
void AddDevToolsExtensionsToClient();
|
||||
#endif
|
||||
|
||||
bool frontend_loaded_;
|
||||
bool frontend_loaded_ = false;
|
||||
scoped_refptr<content::DevToolsAgentHost> agent_host_;
|
||||
std::unique_ptr<content::DevToolsFrontendHost> frontend_host_;
|
||||
std::unique_ptr<DevToolsEmbedderMessageDispatcher>
|
||||
|
@ -209,11 +209,11 @@ class InspectableWebContents
|
|||
|
||||
DevToolsContentsResizingStrategy contents_resizing_strategy_;
|
||||
gfx::Rect devtools_bounds_;
|
||||
bool can_dock_;
|
||||
bool can_dock_ = true;
|
||||
std::string dock_state_;
|
||||
bool activate_ = true;
|
||||
|
||||
InspectableWebContentsDelegate* delegate_; // weak references.
|
||||
InspectableWebContentsDelegate* delegate_ = nullptr; // weak references.
|
||||
|
||||
PrefService* pref_service_; // weak reference.
|
||||
|
||||
|
@ -235,7 +235,7 @@ class InspectableWebContents
|
|||
using ExtensionsAPIs = std::map<std::string, std::string>;
|
||||
ExtensionsAPIs extensions_api_;
|
||||
|
||||
base::WeakPtrFactory<InspectableWebContents> weak_factory_;
|
||||
base::WeakPtrFactory<InspectableWebContents> weak_factory_{this};
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(InspectableWebContents);
|
||||
};
|
||||
|
|
|
@ -23,7 +23,7 @@ class InspectableWebContentsViewDelegate;
|
|||
|
||||
class InspectableWebContentsView {
|
||||
public:
|
||||
InspectableWebContentsView() : delegate_(nullptr) {}
|
||||
InspectableWebContentsView() {}
|
||||
virtual ~InspectableWebContentsView() {}
|
||||
|
||||
// The delegate manages its own life.
|
||||
|
@ -54,7 +54,7 @@ class InspectableWebContentsView {
|
|||
virtual void SetTitle(const base::string16& title) = 0;
|
||||
|
||||
private:
|
||||
InspectableWebContentsViewDelegate* delegate_; // weak references.
|
||||
InspectableWebContentsViewDelegate* delegate_ = nullptr; // weak references.
|
||||
};
|
||||
|
||||
} // namespace electron
|
||||
|
|
|
@ -43,7 +43,7 @@ class TrayIconCocoa : public TrayIcon {
|
|||
// Status menu shown when right-clicking the system icon.
|
||||
base::scoped_nsobject<ElectronMenuController> menu_;
|
||||
|
||||
base::WeakPtrFactory<TrayIconCocoa> weak_factory_;
|
||||
base::WeakPtrFactory<TrayIconCocoa> weak_factory_{this};
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(TrayIconCocoa);
|
||||
};
|
||||
|
|
|
@ -315,7 +315,7 @@
|
|||
|
||||
namespace electron {
|
||||
|
||||
TrayIconCocoa::TrayIconCocoa() : weak_factory_(this) {
|
||||
TrayIconCocoa::TrayIconCocoa() {
|
||||
status_item_view_.reset([[StatusItemView alloc] initWithIcon:this]);
|
||||
}
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@ void AutofillPopupChildView::GetAccessibleNodeData(ui::AXNodeData* node_data) {
|
|||
|
||||
AutofillPopupView::AutofillPopupView(AutofillPopup* popup,
|
||||
views::Widget* parent_widget)
|
||||
: popup_(popup), parent_widget_(parent_widget), weak_ptr_factory_(this) {
|
||||
: popup_(popup), parent_widget_(parent_widget) {
|
||||
CreateChildViews();
|
||||
SetFocusBehavior(FocusBehavior::ALWAYS);
|
||||
set_drag_controller(this);
|
||||
|
|
|
@ -147,7 +147,7 @@ class AutofillPopupView : public views::WidgetDelegateView,
|
|||
// key presses
|
||||
content::RenderWidgetHost::KeyPressEventCallback keypress_callback_;
|
||||
|
||||
base::WeakPtrFactory<AutofillPopupView> weak_ptr_factory_;
|
||||
base::WeakPtrFactory<AutofillPopupView> weak_ptr_factory_{this};
|
||||
};
|
||||
|
||||
} // namespace electron
|
||||
|
|
|
@ -81,11 +81,7 @@ InspectableWebContentsView* CreateInspectableContentsView(
|
|||
InspectableWebContentsViewViews::InspectableWebContentsViewViews(
|
||||
InspectableWebContents* inspectable_web_contents)
|
||||
: inspectable_web_contents_(inspectable_web_contents),
|
||||
devtools_window_web_view_(nullptr),
|
||||
contents_web_view_(nullptr),
|
||||
devtools_web_view_(new views::WebView(nullptr)),
|
||||
devtools_visible_(false),
|
||||
devtools_window_delegate_(nullptr),
|
||||
title_(base::ASCIIToUTF16("Developer Tools")) {
|
||||
if (!inspectable_web_contents_->IsGuest() &&
|
||||
inspectable_web_contents_->GetWebContents()->GetNativeView()) {
|
||||
|
|
|
@ -55,13 +55,13 @@ class InspectableWebContentsViewViews : public InspectableWebContentsView,
|
|||
InspectableWebContents* inspectable_web_contents_;
|
||||
|
||||
std::unique_ptr<views::Widget> devtools_window_;
|
||||
views::WebView* devtools_window_web_view_;
|
||||
views::View* contents_web_view_;
|
||||
views::WebView* devtools_web_view_;
|
||||
views::WebView* devtools_window_web_view_ = nullptr;
|
||||
views::View* contents_web_view_ = nullptr;
|
||||
views::WebView* devtools_web_view_ = nullptr;
|
||||
|
||||
DevToolsContentsResizingStrategy strategy_;
|
||||
bool devtools_visible_;
|
||||
views::WidgetDelegate* devtools_window_delegate_;
|
||||
bool devtools_visible_ = false;
|
||||
views::WidgetDelegate* devtools_window_delegate_ = nullptr;
|
||||
base::string16 title_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(InspectableWebContentsViewViews);
|
||||
|
|
|
@ -18,8 +18,7 @@
|
|||
|
||||
namespace electron {
|
||||
|
||||
MenuDelegate::MenuDelegate(MenuBar* menu_bar)
|
||||
: menu_bar_(menu_bar), id_(-1), hold_first_switch_(false) {}
|
||||
MenuDelegate::MenuDelegate(MenuBar* menu_bar) : menu_bar_(menu_bar) {}
|
||||
|
||||
MenuDelegate::~MenuDelegate() = default;
|
||||
|
||||
|
|
|
@ -62,13 +62,13 @@ class MenuDelegate : public views::MenuDelegate {
|
|||
|
||||
private:
|
||||
MenuBar* menu_bar_;
|
||||
int id_;
|
||||
int id_ = -1;
|
||||
std::unique_ptr<views::MenuDelegate> adapter_;
|
||||
std::unique_ptr<views::MenuRunner> menu_runner_;
|
||||
|
||||
// The menu button to switch to.
|
||||
views::MenuButton* button_to_open_ = nullptr;
|
||||
bool hold_first_switch_;
|
||||
bool hold_first_switch_ = false;
|
||||
|
||||
base::ObserverList<Observer>::Unchecked observers_;
|
||||
|
||||
|
|
|
@ -105,7 +105,7 @@ file_dialog::Filters GetFileTypesFromAcceptType(
|
|||
namespace electron {
|
||||
|
||||
WebDialogHelper::WebDialogHelper(NativeWindow* window, bool offscreen)
|
||||
: window_(window), offscreen_(offscreen), weak_factory_(this) {}
|
||||
: window_(window), offscreen_(offscreen) {}
|
||||
|
||||
WebDialogHelper::~WebDialogHelper() = default;
|
||||
|
||||
|
|
|
@ -41,7 +41,7 @@ class WebDialogHelper {
|
|||
NativeWindow* window_;
|
||||
bool offscreen_;
|
||||
|
||||
base::WeakPtrFactory<WebDialogHelper> weak_factory_;
|
||||
base::WeakPtrFactory<WebDialogHelper> weak_factory_{this};
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(WebDialogHelper);
|
||||
};
|
||||
|
|
|
@ -8,15 +8,15 @@
|
|||
|
||||
namespace electron {
|
||||
|
||||
ScopedHString::ScopedHString(const wchar_t* source) : str_(nullptr) {
|
||||
ScopedHString::ScopedHString(const wchar_t* source) {
|
||||
Reset(source);
|
||||
}
|
||||
|
||||
ScopedHString::ScopedHString(const std::wstring& source) : str_(nullptr) {
|
||||
ScopedHString::ScopedHString(const std::wstring& source) {
|
||||
Reset(source);
|
||||
}
|
||||
|
||||
ScopedHString::ScopedHString() : str_(nullptr) {}
|
||||
ScopedHString::ScopedHString() {}
|
||||
|
||||
ScopedHString::~ScopedHString() {
|
||||
Reset();
|
||||
|
|
|
@ -35,7 +35,7 @@ class ScopedHString {
|
|||
bool success() const { return str_; }
|
||||
|
||||
private:
|
||||
HSTRING str_;
|
||||
HSTRING str_ = nullptr;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(ScopedHString);
|
||||
};
|
||||
|
|
|
@ -45,7 +45,7 @@ void ZoomLevelDelegate::RegisterPrefs(PrefRegistrySimple* registry) {
|
|||
|
||||
ZoomLevelDelegate::ZoomLevelDelegate(PrefService* pref_service,
|
||||
const base::FilePath& partition_path)
|
||||
: pref_service_(pref_service), host_zoom_map_(nullptr) {
|
||||
: pref_service_(pref_service) {
|
||||
DCHECK(pref_service_);
|
||||
partition_key_ = GetHash(partition_path);
|
||||
}
|
||||
|
|
|
@ -52,7 +52,7 @@ class ZoomLevelDelegate : public content::ZoomLevelDelegate {
|
|||
void OnZoomLevelChanged(const content::HostZoomMap::ZoomLevelChange& change);
|
||||
|
||||
PrefService* pref_service_;
|
||||
content::HostZoomMap* host_zoom_map_;
|
||||
content::HostZoomMap* host_zoom_map_ = nullptr;
|
||||
base::CallbackListSubscription zoom_subscription_;
|
||||
std::string partition_key_;
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@ namespace electron {
|
|||
|
||||
ObjectLifeMonitor::ObjectLifeMonitor(v8::Isolate* isolate,
|
||||
v8::Local<v8::Object> target)
|
||||
: target_(isolate, target), weak_ptr_factory_(this) {
|
||||
: target_(isolate, target) {
|
||||
target_.SetWeak(this, OnObjectGC, v8::WeakCallbackType::kParameter);
|
||||
}
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@ class ObjectLifeMonitor {
|
|||
|
||||
v8::Global<v8::Object> target_;
|
||||
|
||||
base::WeakPtrFactory<ObjectLifeMonitor> weak_ptr_factory_;
|
||||
base::WeakPtrFactory<ObjectLifeMonitor> weak_ptr_factory_{this};
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(ObjectLifeMonitor);
|
||||
};
|
||||
|
|
|
@ -31,7 +31,7 @@ class IDUserData : public base::SupportsUserData::Data {
|
|||
|
||||
} // namespace
|
||||
|
||||
TrackableObjectBase::TrackableObjectBase() : weak_factory_(this) {
|
||||
TrackableObjectBase::TrackableObjectBase() {
|
||||
// TODO(zcbenz): Make TrackedObject work in renderer process.
|
||||
DCHECK(gin_helper::Locker::IsBrowserProcess())
|
||||
<< "This class only works for browser process";
|
||||
|
|
|
@ -43,7 +43,7 @@ class TrackableObjectBase {
|
|||
private:
|
||||
void Destroy();
|
||||
|
||||
base::WeakPtrFactory<TrackableObjectBase> weak_factory_;
|
||||
base::WeakPtrFactory<TrackableObjectBase> weak_factory_{this};
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(TrackableObjectBase);
|
||||
};
|
||||
|
|
|
@ -302,7 +302,7 @@ base::FilePath GetResourcesPath() {
|
|||
} // namespace
|
||||
|
||||
NodeBindings::NodeBindings(BrowserEnvironment browser_env)
|
||||
: browser_env_(browser_env), weak_factory_(this) {
|
||||
: browser_env_(browser_env) {
|
||||
if (browser_env == BrowserEnvironment::kWorker) {
|
||||
uv_loop_init(&worker_loop_);
|
||||
uv_loop_ = &worker_loop_;
|
||||
|
|
|
@ -159,7 +159,7 @@ class NodeBindings {
|
|||
// Isolate data used in creating the environment
|
||||
node::IsolateData* isolate_data_ = nullptr;
|
||||
|
||||
base::WeakPtrFactory<NodeBindings> weak_factory_;
|
||||
base::WeakPtrFactory<NodeBindings> weak_factory_{this};
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(NodeBindings);
|
||||
};
|
||||
|
|
|
@ -73,8 +73,7 @@ class SpellCheckClient::SpellcheckRequest {
|
|||
SpellCheckClient::SpellCheckClient(const std::string& language,
|
||||
v8::Isolate* isolate,
|
||||
v8::Local<v8::Object> provider)
|
||||
: pending_request_param_(nullptr),
|
||||
isolate_(isolate),
|
||||
: isolate_(isolate),
|
||||
context_(isolate, isolate->GetCurrentContext()),
|
||||
provider_(isolate, provider) {
|
||||
DCHECK(!context_.IsEmpty());
|
||||
|
|
|
@ -104,8 +104,7 @@ ElectronApiServiceImpl::ElectronApiServiceImpl(
|
|||
content::RenderFrame* render_frame,
|
||||
RendererClientBase* renderer_client)
|
||||
: content::RenderFrameObserver(render_frame),
|
||||
renderer_client_(renderer_client),
|
||||
weak_factory_(this) {}
|
||||
renderer_client_(renderer_client) {}
|
||||
|
||||
void ElectronApiServiceImpl::BindTo(
|
||||
mojo::PendingAssociatedReceiver<mojom::ElectronRenderer> receiver) {
|
||||
|
|
|
@ -57,7 +57,7 @@ class ElectronApiServiceImpl : public mojom::ElectronRenderer,
|
|||
mojo::AssociatedReceiver<mojom::ElectronRenderer> receiver_{this};
|
||||
|
||||
RendererClientBase* renderer_client_;
|
||||
base::WeakPtrFactory<ElectronApiServiceImpl> weak_factory_;
|
||||
base::WeakPtrFactory<ElectronApiServiceImpl> weak_factory_{this};
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(ElectronApiServiceImpl);
|
||||
};
|
||||
|
|
|
@ -51,7 +51,7 @@ void TrimStringVectorForIPC(std::vector<base::string16>* strings) {
|
|||
|
||||
AutofillAgent::AutofillAgent(content::RenderFrame* frame,
|
||||
blink::AssociatedInterfaceRegistry* registry)
|
||||
: content::RenderFrameObserver(frame), weak_ptr_factory_(this) {
|
||||
: content::RenderFrameObserver(frame) {
|
||||
render_frame()->GetWebFrame()->SetAutofillClient(this);
|
||||
registry->AddInterface(base::BindRepeating(&AutofillAgent::BindReceiver,
|
||||
base::Unretained(this)));
|
||||
|
|
|
@ -84,7 +84,7 @@ class AutofillAgent : public content::RenderFrameObserver,
|
|||
|
||||
mojo::AssociatedReceiver<mojom::ElectronAutofillAgent> receiver_{this};
|
||||
|
||||
base::WeakPtrFactory<AutofillAgent> weak_ptr_factory_;
|
||||
base::WeakPtrFactory<AutofillAgent> weak_ptr_factory_{this};
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(AutofillAgent);
|
||||
};
|
||||
|
|
|
@ -22,8 +22,7 @@ static base::LazyInstance<GuestViewContainerMap>::DestructorAtExit
|
|||
|
||||
} // namespace
|
||||
|
||||
GuestViewContainer::GuestViewContainer(content::RenderFrame* render_frame)
|
||||
: weak_ptr_factory_(this) {}
|
||||
GuestViewContainer::GuestViewContainer(content::RenderFrame* render_frame) {}
|
||||
|
||||
GuestViewContainer::~GuestViewContainer() {
|
||||
if (element_instance_id_ > 0)
|
||||
|
|
|
@ -32,7 +32,7 @@ class GuestViewContainer {
|
|||
|
||||
ResizeCallback element_resize_callback_;
|
||||
|
||||
base::WeakPtrFactory<GuestViewContainer> weak_ptr_factory_;
|
||||
base::WeakPtrFactory<GuestViewContainer> weak_ptr_factory_{this};
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(GuestViewContainer);
|
||||
};
|
||||
|
|
|
@ -77,8 +77,7 @@ auto RunProxyResolver(
|
|||
|
||||
} // namespace
|
||||
|
||||
ElectronContentUtilityClient::ElectronContentUtilityClient()
|
||||
: utility_process_running_elevated_(false) {
|
||||
ElectronContentUtilityClient::ElectronContentUtilityClient() {
|
||||
#if BUILDFLAG(ENABLE_PRINT_PREVIEW) && defined(OS_WIN)
|
||||
printing_handler_ = std::make_unique<printing::PrintingHandler>();
|
||||
#endif
|
||||
|
|
|
@ -40,7 +40,7 @@ class ElectronContentUtilityClient : public content::ContentUtilityClient {
|
|||
#endif
|
||||
|
||||
// True if the utility process runs with elevated privileges.
|
||||
bool utility_process_running_elevated_;
|
||||
bool utility_process_running_elevated_ = false;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(ElectronContentUtilityClient);
|
||||
};
|
||||
|
|
Загрузка…
Ссылка в новой задаче