Use in-class initializers for base::WeakPtrFactory (remaining uses on Windows).
Changed NULL to nullptr where the presubmit complained (due to new line wrapping).
Generated by: https://chromium-review.googlesource.com/c/chromium/src/+/1689216
Bug: 981415
Tbr: gab@chromium.org
Change-Id: I1f9c781cd980150ad1eecee9342be2e3116617b7
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1763040
Reviewed-by: Jeremy Roman <jbroman@chromium.org>
Reviewed-by: Gabriel Charette <gab@chromium.org>
Reviewed-by: Bruce Dawson <brucedawson@chromium.org>
Commit-Queue: Jeremy Roman <jbroman@chromium.org>
Cr-Commit-Position: refs/heads/master@{#689209}
diff --git a/base/util/memory_pressure/system_memory_pressure_evaluator_win.cc b/base/util/memory_pressure/system_memory_pressure_evaluator_win.cc
index 4791941..4aa36ac 100644
--- a/base/util/memory_pressure/system_memory_pressure_evaluator_win.cc
+++ b/base/util/memory_pressure/system_memory_pressure_evaluator_win.cc
@@ -58,8 +58,7 @@
: util::SystemMemoryPressureEvaluator(std::move(voter)),
moderate_threshold_mb_(0),
critical_threshold_mb_(0),
- moderate_pressure_repeat_count_(0),
- weak_ptr_factory_(this) {
+ moderate_pressure_repeat_count_(0) {
InferThresholds();
StartObserving();
}
@@ -71,8 +70,7 @@
: util::SystemMemoryPressureEvaluator(std::move(voter)),
moderate_threshold_mb_(moderate_threshold_mb),
critical_threshold_mb_(critical_threshold_mb),
- moderate_pressure_repeat_count_(0),
- weak_ptr_factory_(this) {
+ moderate_pressure_repeat_count_(0) {
DCHECK_GE(moderate_threshold_mb_, critical_threshold_mb_);
DCHECK_LE(0, critical_threshold_mb_);
StartObserving();
diff --git a/base/util/memory_pressure/system_memory_pressure_evaluator_win.h b/base/util/memory_pressure/system_memory_pressure_evaluator_win.h
index b0268f15..877d87a 100644
--- a/base/util/memory_pressure/system_memory_pressure_evaluator_win.h
+++ b/base/util/memory_pressure/system_memory_pressure_evaluator_win.h
@@ -121,7 +121,7 @@
// Weak pointer factory to ourself used for scheduling calls to
// CheckMemoryPressure/CheckMemoryPressureAndRecordStatistics via |timer_|.
- base::WeakPtrFactory<SystemMemoryPressureEvaluator> weak_ptr_factory_;
+ base::WeakPtrFactory<SystemMemoryPressureEvaluator> weak_ptr_factory_{this};
DISALLOW_COPY_AND_ASSIGN(SystemMemoryPressureEvaluator);
};
diff --git a/base/win/async_operation.h b/base/win/async_operation.h
index e2204635..3dc2801 100644
--- a/base/win/async_operation.h
+++ b/base/win/async_operation.h
@@ -102,7 +102,7 @@
using Handler = ABI::Windows::Foundation::IAsyncOperationCompletedHandler<T>;
using ResultCallback = base::OnceCallback<void(StorageT)>;
- AsyncOperation() : weak_factory_(this) {
+ AsyncOperation() {
// Note: This can't be done in the constructor initializer list. This is
// because it relies on weak_factory_ to be initialized, which needs to be
// the last class member. Also applies below.
@@ -150,7 +150,7 @@
OptionalStorageT results_;
THREAD_CHECKER(thread_checker_);
- base::WeakPtrFactory<AsyncOperation> weak_factory_;
+ base::WeakPtrFactory<AsyncOperation> weak_factory_{this};
DISALLOW_COPY_AND_ASSIGN(AsyncOperation);
};
diff --git a/base/win/object_watcher.cc b/base/win/object_watcher.cc
index 2a3824d..20f1466 100644
--- a/base/win/object_watcher.cc
+++ b/base/win/object_watcher.cc
@@ -15,7 +15,7 @@
//-----------------------------------------------------------------------------
-ObjectWatcher::ObjectWatcher() : weak_factory_(this) {}
+ObjectWatcher::ObjectWatcher() {}
ObjectWatcher::~ObjectWatcher() {
StopWatching();
diff --git a/base/win/object_watcher.h b/base/win/object_watcher.h
index 0d26276..0779c27 100644
--- a/base/win/object_watcher.h
+++ b/base/win/object_watcher.h
@@ -120,7 +120,7 @@
bool run_once_ = true;
- WeakPtrFactory<ObjectWatcher> weak_factory_;
+ WeakPtrFactory<ObjectWatcher> weak_factory_{this};
DISALLOW_COPY_AND_ASSIGN(ObjectWatcher);
};
diff --git a/chrome/browser/browser_switcher/browser_switcher_service_win.cc b/chrome/browser/browser_switcher/browser_switcher_service_win.cc
index 0ed7de5f..27414d9 100644
--- a/chrome/browser/browser_switcher/browser_switcher_service_win.cc
+++ b/chrome/browser/browser_switcher/browser_switcher_service_win.cc
@@ -147,8 +147,7 @@
sequenced_task_runner_(base::CreateSequencedTaskRunner(
{base::ThreadPool(), base::MayBlock(),
base::TaskPriority::BEST_EFFORT,
- base::TaskShutdownBehavior::BLOCK_SHUTDOWN})),
- weak_ptr_factory_(this) {
+ base::TaskShutdownBehavior::BLOCK_SHUTDOWN})) {
if (prefs().IsEnabled())
SavePrefsToFile();
else
diff --git a/chrome/browser/browser_switcher/browser_switcher_service_win.h b/chrome/browser/browser_switcher/browser_switcher_service_win.h
index be16004..14aefc56 100644
--- a/chrome/browser/browser_switcher/browser_switcher_service_win.h
+++ b/chrome/browser/browser_switcher/browser_switcher_service_win.h
@@ -55,7 +55,7 @@
scoped_refptr<base::SequencedTaskRunner> sequenced_task_runner_;
- base::WeakPtrFactory<BrowserSwitcherServiceWin> weak_ptr_factory_;
+ base::WeakPtrFactory<BrowserSwitcherServiceWin> weak_ptr_factory_{this};
DISALLOW_IMPLICIT_CONSTRUCTORS(BrowserSwitcherServiceWin);
};
diff --git a/chrome/browser/enterprise_reporting/report_generator.cc b/chrome/browser/enterprise_reporting/report_generator.cc
index 4952084..835c96c 100644
--- a/chrome/browser/enterprise_reporting/report_generator.cc
+++ b/chrome/browser/enterprise_reporting/report_generator.cc
@@ -40,8 +40,7 @@
} // namespace
-ReportGenerator::ReportGenerator()
- : maximum_report_size_(kMaximumReportSize), weak_ptr_factory_(this) {}
+ReportGenerator::ReportGenerator() : maximum_report_size_(kMaximumReportSize) {}
ReportGenerator::~ReportGenerator() = default;
diff --git a/chrome/browser/enterprise_reporting/report_generator.h b/chrome/browser/enterprise_reporting/report_generator.h
index 7468c90..bd31d11 100644
--- a/chrome/browser/enterprise_reporting/report_generator.h
+++ b/chrome/browser/enterprise_reporting/report_generator.h
@@ -74,7 +74,7 @@
size_t maximum_report_size_;
- base::WeakPtrFactory<ReportGenerator> weak_ptr_factory_;
+ base::WeakPtrFactory<ReportGenerator> weak_ptr_factory_{this};
DISALLOW_COPY_AND_ASSIGN(ReportGenerator);
};
diff --git a/chrome/browser/lookalikes/safety_tips/reputation_web_contents_observer.cc b/chrome/browser/lookalikes/safety_tips/reputation_web_contents_observer.cc
index 8cbb5f5..b1ecaf8 100644
--- a/chrome/browser/lookalikes/safety_tips/reputation_web_contents_observer.cc
+++ b/chrome/browser/lookalikes/safety_tips/reputation_web_contents_observer.cc
@@ -43,8 +43,8 @@
ReputationWebContentsObserver::ReputationWebContentsObserver(
content::WebContents* web_contents)
: WebContentsObserver(web_contents),
- profile_(Profile::FromBrowserContext(web_contents->GetBrowserContext())),
- weak_factory_(this) {}
+ profile_(Profile::FromBrowserContext(web_contents->GetBrowserContext())) {
+}
void ReputationWebContentsObserver::HandleReputationCheckResult(
SafetyTipType type,
diff --git a/chrome/browser/lookalikes/safety_tips/reputation_web_contents_observer.h b/chrome/browser/lookalikes/safety_tips/reputation_web_contents_observer.h
index c9309f18..6e34e980 100644
--- a/chrome/browser/lookalikes/safety_tips/reputation_web_contents_observer.h
+++ b/chrome/browser/lookalikes/safety_tips/reputation_web_contents_observer.h
@@ -55,7 +55,7 @@
// new top frame navigations.
safety_tips::SafetyTipType last_shown_safety_tip_type_ = SafetyTipType::kNone;
- base::WeakPtrFactory<ReputationWebContentsObserver> weak_factory_;
+ base::WeakPtrFactory<ReputationWebContentsObserver> weak_factory_{this};
WEB_CONTENTS_USER_DATA_KEY_DECL();
};
diff --git a/chrome/browser/media_galleries/win/mtp_device_delegate_impl_win.cc b/chrome/browser/media_galleries/win/mtp_device_delegate_impl_win.cc
index 39ea07c7..5626539 100644
--- a/chrome/browser/media_galleries/win/mtp_device_delegate_impl_win.cc
+++ b/chrome/browser/media_galleries/win/mtp_device_delegate_impl_win.cc
@@ -362,8 +362,7 @@
storage_device_info_(pnp_device_id,
registered_device_path,
storage_object_id),
- task_in_progress_(false),
- weak_ptr_factory_(this) {
+ task_in_progress_(false) {
DCHECK_CURRENTLY_ON(content::BrowserThread::IO);
DCHECK(!registered_device_path.empty());
DCHECK(!pnp_device_id.empty());
diff --git a/chrome/browser/media_galleries/win/mtp_device_delegate_impl_win.h b/chrome/browser/media_galleries/win/mtp_device_delegate_impl_win.h
index 55126da..0607bbc 100644
--- a/chrome/browser/media_galleries/win/mtp_device_delegate_impl_win.h
+++ b/chrome/browser/media_galleries/win/mtp_device_delegate_impl_win.h
@@ -260,7 +260,7 @@
bool task_in_progress_;
// For callbacks that may run after destruction.
- base::WeakPtrFactory<MTPDeviceDelegateImplWin> weak_ptr_factory_;
+ base::WeakPtrFactory<MTPDeviceDelegateImplWin> weak_ptr_factory_{this};
DISALLOW_COPY_AND_ASSIGN(MTPDeviceDelegateImplWin);
};
diff --git a/chrome/browser/metrics/google_update_metrics_provider_win.cc b/chrome/browser/metrics/google_update_metrics_provider_win.cc
index 71e59d90..7776c80 100644
--- a/chrome/browser/metrics/google_update_metrics_provider_win.cc
+++ b/chrome/browser/metrics/google_update_metrics_provider_win.cc
@@ -45,9 +45,7 @@
} // namespace
-GoogleUpdateMetricsProviderWin::GoogleUpdateMetricsProviderWin()
- : weak_ptr_factory_(this) {
-}
+GoogleUpdateMetricsProviderWin::GoogleUpdateMetricsProviderWin() {}
GoogleUpdateMetricsProviderWin::~GoogleUpdateMetricsProviderWin() {
}
diff --git a/chrome/browser/metrics/google_update_metrics_provider_win.h b/chrome/browser/metrics/google_update_metrics_provider_win.h
index 310f34df..08e1e6b 100644
--- a/chrome/browser/metrics/google_update_metrics_provider_win.h
+++ b/chrome/browser/metrics/google_update_metrics_provider_win.h
@@ -59,7 +59,7 @@
// filled in only after the successful completion of GetGoogleUpdateData().
GoogleUpdateMetrics google_update_metrics_;
- base::WeakPtrFactory<GoogleUpdateMetricsProviderWin> weak_ptr_factory_;
+ base::WeakPtrFactory<GoogleUpdateMetricsProviderWin> weak_ptr_factory_{this};
DISALLOW_COPY_AND_ASSIGN(GoogleUpdateMetricsProviderWin);
};
diff --git a/chrome/browser/notifications/win/notification_image_retainer.cc b/chrome/browser/notifications/win/notification_image_retainer.cc
index f000ddb..0e85635 100644
--- a/chrome/browser/notifications/win/notification_image_retainer.cc
+++ b/chrome/browser/notifications/win/notification_image_retainer.cc
@@ -79,8 +79,7 @@
: deletion_task_runner_(std::move(deletion_task_runner)),
image_dir_(DetermineImageDirectory()),
tick_clock_(tick_clock),
- deletion_timer_(tick_clock),
- weak_ptr_factory_(this) {
+ deletion_timer_(tick_clock) {
DCHECK(deletion_task_runner_);
DCHECK(tick_clock);
diff --git a/chrome/browser/notifications/win/notification_image_retainer.h b/chrome/browser/notifications/win/notification_image_retainer.h
index 04d91ec..563db2f 100644
--- a/chrome/browser/notifications/win/notification_image_retainer.h
+++ b/chrome/browser/notifications/win/notification_image_retainer.h
@@ -89,7 +89,7 @@
SEQUENCE_CHECKER(sequence_checker_);
// For callbacks may run after destruction.
- base::WeakPtrFactory<NotificationImageRetainer> weak_ptr_factory_;
+ base::WeakPtrFactory<NotificationImageRetainer> weak_ptr_factory_{this};
DISALLOW_COPY_AND_ASSIGN(NotificationImageRetainer);
};
diff --git a/chrome/browser/performance_monitor/metric_evaluator_helper_win.cc b/chrome/browser/performance_monitor/metric_evaluator_helper_win.cc
index 0088813..6c34f63 100644
--- a/chrome/browser/performance_monitor/metric_evaluator_helper_win.cc
+++ b/chrome/browser/performance_monitor/metric_evaluator_helper_win.cc
@@ -29,8 +29,7 @@
base::MayBlock(),
base::TaskShutdownBehavior::CONTINUE_ON_SHUTDOWN})),
wmi_refresher_(new win::WMIRefresher(),
- base::OnTaskRunnerDeleter(wmi_initialization_sequence_)),
- weak_factory_(this) {
+ base::OnTaskRunnerDeleter(wmi_initialization_sequence_)) {
DCHECK(!g_metric_evaluator_instance);
g_metric_evaluator_instance = this;
diff --git a/chrome/browser/performance_monitor/metric_evaluator_helper_win.h b/chrome/browser/performance_monitor/metric_evaluator_helper_win.h
index b8ca2b2e..61250a3 100644
--- a/chrome/browser/performance_monitor/metric_evaluator_helper_win.h
+++ b/chrome/browser/performance_monitor/metric_evaluator_helper_win.h
@@ -61,7 +61,7 @@
SEQUENCE_CHECKER(sequence_checker_);
- base::WeakPtrFactory<MetricEvaluatorsHelperWin> weak_factory_;
+ base::WeakPtrFactory<MetricEvaluatorsHelperWin> weak_factory_{this};
DISALLOW_COPY_AND_ASSIGN(MetricEvaluatorsHelperWin);
};
diff --git a/chrome/browser/policy/browser_dm_token_storage_win.cc b/chrome/browser/policy/browser_dm_token_storage_win.cc
index 497fa7e..0d171c7 100644
--- a/chrome/browser/policy/browser_dm_token_storage_win.cc
+++ b/chrome/browser/policy/browser_dm_token_storage_win.cc
@@ -214,9 +214,8 @@
}
BrowserDMTokenStorageWin::BrowserDMTokenStorageWin()
- : com_sta_task_runner_(
- base::CreateCOMSTATaskRunner({base::ThreadPool(), base::MayBlock()})),
- weak_factory_(this) {}
+ : com_sta_task_runner_(base::CreateCOMSTATaskRunner(
+ {base::ThreadPool(), base::MayBlock()})) {}
BrowserDMTokenStorageWin::~BrowserDMTokenStorageWin() {}
diff --git a/chrome/browser/policy/browser_dm_token_storage_win.h b/chrome/browser/policy/browser_dm_token_storage_win.h
index 3ef3539..822b103 100644
--- a/chrome/browser/policy/browser_dm_token_storage_win.h
+++ b/chrome/browser/policy/browser_dm_token_storage_win.h
@@ -37,7 +37,7 @@
scoped_refptr<base::SingleThreadTaskRunner> com_sta_task_runner_;
// This should always be the last member of the class.
- base::WeakPtrFactory<BrowserDMTokenStorageWin> weak_factory_;
+ base::WeakPtrFactory<BrowserDMTokenStorageWin> weak_factory_{this};
FRIEND_TEST_ALL_PREFIXES(BrowserDMTokenStorageWinTest, InitClientId);
FRIEND_TEST_ALL_PREFIXES(BrowserDMTokenStorageWinTest, InitEnrollmentToken);
diff --git a/chrome/browser/printing/pdf_to_emf_converter.cc b/chrome/browser/printing/pdf_to_emf_converter.cc
index 7f8ced8..962a023 100644
--- a/chrome/browser/printing/pdf_to_emf_converter.cc
+++ b/chrome/browser/printing/pdf_to_emf_converter.cc
@@ -195,7 +195,7 @@
mojom::PdfToEmfConverterFactoryPtr pdf_to_emf_converter_factory_;
- base::WeakPtrFactory<PdfConverterImpl> weak_ptr_factory_;
+ base::WeakPtrFactory<PdfConverterImpl> weak_ptr_factory_{this};
static bool simulate_failure_initializing_conversion_;
@@ -240,9 +240,7 @@
PdfConverterImpl::PdfConverterImpl(scoped_refptr<base::RefCountedMemory> data,
const PdfRenderSettings& settings,
StartCallback start_callback)
- : settings_(settings),
- start_callback_(std::move(start_callback)),
- weak_ptr_factory_(this) {
+ : settings_(settings), start_callback_(std::move(start_callback)) {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
DCHECK(start_callback_);
diff --git a/chrome/browser/safe_browsing/chrome_cleaner/chrome_cleaner_controller_impl_win.cc b/chrome/browser/safe_browsing/chrome_cleaner/chrome_cleaner_controller_impl_win.cc
index ee1baad..c18be04 100644
--- a/chrome/browser/safe_browsing/chrome_cleaner/chrome_cleaner_controller_impl_win.cc
+++ b/chrome/browser/safe_browsing/chrome_cleaner/chrome_cleaner_controller_impl_win.cc
@@ -532,8 +532,7 @@
ChromeCleanerControllerImpl::ChromeCleanerControllerImpl()
: real_delegate_(std::make_unique<ChromeCleanerControllerDelegate>()),
- delegate_(real_delegate_.get()),
- weak_factory_(this) {
+ delegate_(real_delegate_.get()) {
DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
}
diff --git a/chrome/browser/safe_browsing/chrome_cleaner/chrome_cleaner_controller_impl_win.h b/chrome/browser/safe_browsing/chrome_cleaner/chrome_cleaner_controller_impl_win.h
index 40cad9c..f12ddb8 100644
--- a/chrome/browser/safe_browsing/chrome_cleaner/chrome_cleaner_controller_impl_win.h
+++ b/chrome/browser/safe_browsing/chrome_cleaner/chrome_cleaner_controller_impl_win.h
@@ -152,7 +152,7 @@
THREAD_CHECKER(thread_checker_);
- base::WeakPtrFactory<ChromeCleanerControllerImpl> weak_factory_;
+ base::WeakPtrFactory<ChromeCleanerControllerImpl> weak_factory_{this};
DISALLOW_COPY_AND_ASSIGN(ChromeCleanerControllerImpl);
};
diff --git a/chrome/browser/safe_browsing/chrome_cleaner/chrome_prompt_channel_win.cc b/chrome/browser/safe_browsing/chrome_cleaner/chrome_prompt_channel_win.cc
index 31993d5..383fec4 100644
--- a/chrome/browser/safe_browsing/chrome_cleaner/chrome_prompt_channel_win.cc
+++ b/chrome/browser/safe_browsing/chrome_cleaner/chrome_prompt_channel_win.cc
@@ -420,8 +420,7 @@
scoped_refptr<base::SequencedTaskRunner> task_runner)
: ChromePromptChannel(std::move(on_connection_closed),
std::move(actions),
- std::move(task_runner)),
- weak_factory_(this) {}
+ std::move(task_runner)) {}
ChromePromptChannelMojo::~ChromePromptChannelMojo() = default;
@@ -476,8 +475,7 @@
scoped_refptr<base::SequencedTaskRunner> task_runner)
: ChromePromptChannel(std::move(on_connection_closed),
std::move(actions),
- std::move(task_runner)),
- weak_factory_(this) {
+ std::move(task_runner)) {
// The sequence checker validates that all handler methods and the destructor
// are called from the same sequence, which is not the same sequence as the
// constructor.
diff --git a/chrome/browser/safe_browsing/chrome_cleaner/chrome_prompt_channel_win.h b/chrome/browser/safe_browsing/chrome_cleaner/chrome_prompt_channel_win.h
index 6e3776f..34166fb 100644
--- a/chrome/browser/safe_browsing/chrome_cleaner/chrome_prompt_channel_win.h
+++ b/chrome/browser/safe_browsing/chrome_cleaner/chrome_prompt_channel_win.h
@@ -129,7 +129,7 @@
std::unique_ptr<internal::ChromePromptImpl> chrome_prompt_impl_;
- base::WeakPtrFactory<ChromePromptChannelMojo> weak_factory_;
+ base::WeakPtrFactory<ChromePromptChannelMojo> weak_factory_{this};
};
// Handles IPC to the Chrome Cleaner process by serializing protobufs over
@@ -246,7 +246,7 @@
base::win::ScopedHandle response_read_handle_;
base::win::ScopedHandle response_write_handle_;
- base::WeakPtrFactory<ChromePromptChannelProtobuf> weak_factory_;
+ base::WeakPtrFactory<ChromePromptChannelProtobuf> weak_factory_{this};
};
} // namespace safe_browsing
diff --git a/chrome/browser/safe_browsing/download_protection/binary_fcm_service.cc b/chrome/browser/safe_browsing/download_protection/binary_fcm_service.cc
index 8905583..9639979 100644
--- a/chrome/browser/safe_browsing/download_protection/binary_fcm_service.cc
+++ b/chrome/browser/safe_browsing/download_protection/binary_fcm_service.cc
@@ -57,9 +57,7 @@
BinaryFCMService::BinaryFCMService(
gcm::GCMDriver* gcm_driver,
instance_id::InstanceIDDriver* instance_id_driver)
- : gcm_driver_(gcm_driver),
- instance_id_(kInvalidId),
- weakptr_factory_(this) {
+ : gcm_driver_(gcm_driver), instance_id_(kInvalidId) {
gcm_driver->AddAppHandler(kBinaryFCMServiceAppId, this);
instance_id_driver->GetInstanceID(kBinaryFCMServiceAppId)
->GetToken(kBinaryFCMServiceSenderId, instance_id::kGCMScope,
diff --git a/chrome/browser/safe_browsing/download_protection/binary_fcm_service.h b/chrome/browser/safe_browsing/download_protection/binary_fcm_service.h
index 1d721235..71cf461 100644
--- a/chrome/browser/safe_browsing/download_protection/binary_fcm_service.h
+++ b/chrome/browser/safe_browsing/download_protection/binary_fcm_service.h
@@ -72,7 +72,7 @@
std::string instance_id_;
std::unordered_map<std::string, OnMessageCallback> message_token_map_;
- base::WeakPtrFactory<BinaryFCMService> weakptr_factory_;
+ base::WeakPtrFactory<BinaryFCMService> weakptr_factory_{this};
};
} // namespace safe_browsing
diff --git a/chrome/browser/safe_browsing/download_protection/multipart_uploader.cc b/chrome/browser/safe_browsing/download_protection/multipart_uploader.cc
index b829e0234..4caba2a 100644
--- a/chrome/browser/safe_browsing/download_protection/multipart_uploader.cc
+++ b/chrome/browser/safe_browsing/download_protection/multipart_uploader.cc
@@ -54,8 +54,7 @@
current_backoff_(base::TimeDelta::FromSeconds(kInitialBackoffSeconds)),
retry_count_(0),
url_loader_factory_(url_loader_factory),
- traffic_annotation_(traffic_annotation),
- weak_factory_(this) {
+ traffic_annotation_(traffic_annotation) {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
}
diff --git a/chrome/browser/safe_browsing/download_protection/multipart_uploader.h b/chrome/browser/safe_browsing/download_protection/multipart_uploader.h
index 1e79a9e..5bd22ab 100644
--- a/chrome/browser/safe_browsing/download_protection/multipart_uploader.h
+++ b/chrome/browser/safe_browsing/download_protection/multipart_uploader.h
@@ -93,7 +93,7 @@
std::unique_ptr<network::SimpleURLLoader> url_loader_;
net::NetworkTrafficAnnotationTag traffic_annotation_;
- base::WeakPtrFactory<MultipartUploadRequest> weak_factory_;
+ base::WeakPtrFactory<MultipartUploadRequest> weak_factory_{this};
};
} // namespace safe_browsing
diff --git a/chrome/browser/shell_integration_win.cc b/chrome/browser/shell_integration_win.cc
index d59b982c..876c55a 100644
--- a/chrome/browser/shell_integration_win.cc
+++ b/chrome/browser/shell_integration_win.cc
@@ -317,8 +317,7 @@
OpenSystemSettingsHelper(const wchar_t* const protocols[],
const base::Closure& on_finished_callback)
: scoped_user_protocol_entry_(protocols[0]),
- on_finished_callback_(on_finished_callback),
- weak_ptr_factory_(this) {
+ on_finished_callback_(on_finished_callback) {
static const wchar_t kUrlAssociationFormat[] =
L"SOFTWARE\\Microsoft\\Windows\\Shell\\Associations\\UrlAssociations\\"
L"%ls\\UserChoice";
@@ -418,7 +417,7 @@
// Weak ptrs are used to bind this class to the callbacks of the timer and the
// registry watcher. This makes it possible to self-delete after one of the
// callbacks is executed to cancel the remaining ones.
- base::WeakPtrFactory<OpenSystemSettingsHelper> weak_ptr_factory_;
+ base::WeakPtrFactory<OpenSystemSettingsHelper> weak_ptr_factory_{this};
DISALLOW_COPY_AND_ASSIGN(OpenSystemSettingsHelper);
};
diff --git a/chrome/browser/ui/views/apps/chrome_native_app_window_views_win.cc b/chrome/browser/ui/views/apps/chrome_native_app_window_views_win.cc
index f9d0803..aaf281e1 100644
--- a/chrome/browser/ui/views/apps/chrome_native_app_window_views_win.cc
+++ b/chrome/browser/ui/views/apps/chrome_native_app_window_views_win.cc
@@ -24,8 +24,7 @@
#include "ui/views/win/hwnd_util.h"
ChromeNativeAppWindowViewsWin::ChromeNativeAppWindowViewsWin()
- : glass_frame_view_(NULL), is_translucent_(false), weak_ptr_factory_(this) {
-}
+ : glass_frame_view_(nullptr), is_translucent_(false) {}
ChromeNativeAppWindowViewsWin::~ChromeNativeAppWindowViewsWin() {
}
diff --git a/chrome/browser/ui/views/apps/chrome_native_app_window_views_win.h b/chrome/browser/ui/views/apps/chrome_native_app_window_views_win.h
index cd5bbf1..2c007dab 100644
--- a/chrome/browser/ui/views/apps/chrome_native_app_window_views_win.h
+++ b/chrome/browser/ui/views/apps/chrome_native_app_window_views_win.h
@@ -56,7 +56,7 @@
// Whether the InitParams indicated that this window should be translucent.
bool is_translucent_;
- base::WeakPtrFactory<ChromeNativeAppWindowViewsWin> weak_ptr_factory_;
+ base::WeakPtrFactory<ChromeNativeAppWindowViewsWin> weak_ptr_factory_{this};
DISALLOW_COPY_AND_ASSIGN(ChromeNativeAppWindowViewsWin);
};
diff --git a/chrome/browser/ui/views/profiles/avatar_toolbar_button.cc b/chrome/browser/ui/views/profiles/avatar_toolbar_button.cc
index 7b74efdb..481b3a13 100644
--- a/chrome/browser/ui/views/profiles/avatar_toolbar_button.cc
+++ b/chrome/browser/ui/views/profiles/avatar_toolbar_button.cc
@@ -67,8 +67,7 @@
#endif // !defined(OS_CHROMEOS)
browser_list_observer_(this),
profile_observer_(this),
- identity_manager_observer_(this),
- weak_ptr_factory_(this) {
+ identity_manager_observer_(this) {
if (IsIncognito())
browser_list_observer_.Add(BrowserList::GetInstance());
diff --git a/chrome/browser/ui/views/profiles/avatar_toolbar_button.h b/chrome/browser/ui/views/profiles/avatar_toolbar_button.h
index b605bf1d..63ecd6f 100644
--- a/chrome/browser/ui/views/profiles/avatar_toolbar_button.h
+++ b/chrome/browser/ui/views/profiles/avatar_toolbar_button.h
@@ -111,7 +111,7 @@
ScopedObserver<ui::MaterialDesignController, AvatarToolbarButton>
md_observer_{this};
- base::WeakPtrFactory<AvatarToolbarButton> weak_ptr_factory_;
+ base::WeakPtrFactory<AvatarToolbarButton> weak_ptr_factory_{this};
DISALLOW_COPY_AND_ASSIGN(AvatarToolbarButton);
};
diff --git a/chrome/browser/ui/views/status_icons/status_tray_win.cc b/chrome/browser/ui/views/status_icons/status_tray_win.cc
index 9d0e5b0..02985e7 100644
--- a/chrome/browser/ui/views/status_icons/status_tray_win.cc
+++ b/chrome/browser/ui/views/status_icons/status_tray_win.cc
@@ -42,9 +42,7 @@
class StatusTrayStateChangerProxyImpl : public StatusTrayStateChangerProxy {
public:
StatusTrayStateChangerProxyImpl()
- : pending_requests_(0),
- worker_thread_("StatusIconCOMWorkerThread"),
- weak_factory_(this) {
+ : pending_requests_(0), worker_thread_("StatusIconCOMWorkerThread") {
worker_thread_.init_com_with_mta(false);
}
@@ -95,7 +93,7 @@
SEQUENCE_CHECKER(sequence_checker_);
- base::WeakPtrFactory<StatusTrayStateChangerProxyImpl> weak_factory_;
+ base::WeakPtrFactory<StatusTrayStateChangerProxyImpl> weak_factory_{this};
DISALLOW_COPY_AND_ASSIGN(StatusTrayStateChangerProxyImpl);
};
diff --git a/chrome/browser/ui/webui/conflicts/conflicts_handler.cc b/chrome/browser/ui/webui/conflicts/conflicts_handler.cc
index 55b5fc5e..013e6165 100644
--- a/chrome/browser/ui/webui/conflicts/conflicts_handler.cc
+++ b/chrome/browser/ui/webui/conflicts/conflicts_handler.cc
@@ -13,8 +13,7 @@
#include "content/public/browser/web_ui.h"
ConflictsHandler::ConflictsHandler()
- : conflicts_data_fetcher_(nullptr, base::OnTaskRunnerDeleter(nullptr)),
- weak_ptr_factory_(this) {}
+ : conflicts_data_fetcher_(nullptr, base::OnTaskRunnerDeleter(nullptr)) {}
ConflictsHandler::~ConflictsHandler() = default;
diff --git a/chrome/browser/ui/webui/conflicts/conflicts_handler.h b/chrome/browser/ui/webui/conflicts/conflicts_handler.h
index 35f4dcc..e10db79 100644
--- a/chrome/browser/ui/webui/conflicts/conflicts_handler.h
+++ b/chrome/browser/ui/webui/conflicts/conflicts_handler.h
@@ -40,7 +40,7 @@
// lives on a different sequence.
ConflictsDataFetcher::UniquePtr conflicts_data_fetcher_;
- base::WeakPtrFactory<ConflictsHandler> weak_ptr_factory_;
+ base::WeakPtrFactory<ConflictsHandler> weak_ptr_factory_{this};
DISALLOW_COPY_AND_ASSIGN(ConflictsHandler);
};
diff --git a/chrome/browser/ui/webui/flags_ui.cc b/chrome/browser/ui/webui/flags_ui.cc
index 40ece29..3d45a30 100644
--- a/chrome/browser/ui/webui/flags_ui.cc
+++ b/chrome/browser/ui/webui/flags_ui.cc
@@ -177,7 +177,7 @@
}
FlagsEnterpriseUI::FlagsEnterpriseUI(content::WebUI* web_ui)
- : WebUIController(web_ui), weak_factory_(this) {
+ : WebUIController(web_ui) {
Profile* profile = Profile::FromWebUI(web_ui);
auto* handler = InitializeHandler(web_ui, profile, weak_factory_);
DCHECK(handler);
diff --git a/chrome/browser/ui/webui/flags_ui.h b/chrome/browser/ui/webui/flags_ui.h
index ffa1d6a..74f9403 100644
--- a/chrome/browser/ui/webui/flags_ui.h
+++ b/chrome/browser/ui/webui/flags_ui.h
@@ -41,7 +41,7 @@
static bool IsEnterpriseUrl(const GURL& url);
private:
- base::WeakPtrFactory<FlagsEnterpriseUI> weak_factory_;
+ base::WeakPtrFactory<FlagsEnterpriseUI> weak_factory_{this};
DISALLOW_COPY_AND_ASSIGN(FlagsEnterpriseUI);
};
diff --git a/chrome/browser/ui/webui/version_handler_win.cc b/chrome/browser/ui/webui/version_handler_win.cc
index d743ba8..315ce14 100644
--- a/chrome/browser/ui/webui/version_handler_win.cc
+++ b/chrome/browser/ui/webui/version_handler_win.cc
@@ -11,7 +11,7 @@
#include "chrome/browser/ui/webui/version_util_win.h"
#include "content/public/browser/web_ui.h"
-VersionHandlerWindows::VersionHandlerWindows() : weak_factory_(this) {}
+VersionHandlerWindows::VersionHandlerWindows() {}
VersionHandlerWindows::~VersionHandlerWindows() {}
diff --git a/chrome/browser/ui/webui/version_handler_win.h b/chrome/browser/ui/webui/version_handler_win.h
index 83a41ec..2c424dcc 100644
--- a/chrome/browser/ui/webui/version_handler_win.h
+++ b/chrome/browser/ui/webui/version_handler_win.h
@@ -27,7 +27,7 @@
static std::string GetFullWindowsVersionForTesting();
private:
- base::WeakPtrFactory<VersionHandlerWindows> weak_factory_;
+ base::WeakPtrFactory<VersionHandlerWindows> weak_factory_{this};
DISALLOW_COPY_AND_ASSIGN(VersionHandlerWindows);
};
diff --git a/chrome/browser/win/automation_controller.cc b/chrome/browser/win/automation_controller.cc
index 58135de..4b6cb41 100644
--- a/chrome/browser/win/automation_controller.cc
+++ b/chrome/browser/win/automation_controller.cc
@@ -143,7 +143,7 @@
Microsoft::WRL::ComPtr<IUnknown> event_handler_;
// Weak pointers to the context are given to event handlers.
- base::WeakPtrFactory<Context> weak_ptr_factory_;
+ base::WeakPtrFactory<Context> weak_ptr_factory_{this};
DISALLOW_COPY_AND_ASSIGN(Context);
};
@@ -276,7 +276,7 @@
delete this;
}
-AutomationController::Context::Context() : weak_ptr_factory_(this) {
+AutomationController::Context::Context() {
DETACH_FROM_SEQUENCE(sequence_checker_);
}
diff --git a/chrome/browser/win/conflicts/module_inspector.cc b/chrome/browser/win/conflicts/module_inspector.cc
index cf3dc6e..ea7148b 100644
--- a/chrome/browser/win/conflicts/module_inspector.cc
+++ b/chrome/browser/win/conflicts/module_inspector.cc
@@ -102,8 +102,7 @@
has_new_inspection_results_(false),
connection_error_retry_count_(kConnectionErrorRetryCount),
background_inspection_disabled_(
- base::FeatureList::IsEnabled(kDisableBackgroundModuleInspection)),
- weak_ptr_factory_(this) {
+ base::FeatureList::IsEnabled(kDisableBackgroundModuleInspection)) {
// Use BEST_EFFORT as those will only run after startup is finished.
content::BrowserThread::PostBestEffortTask(
FROM_HERE, base::SequencedTaskRunnerHandle::Get(),
diff --git a/chrome/browser/win/conflicts/module_inspector.h b/chrome/browser/win/conflicts/module_inspector.h
index e12c85ab..f8e54cc 100644
--- a/chrome/browser/win/conflicts/module_inspector.h
+++ b/chrome/browser/win/conflicts/module_inspector.h
@@ -181,7 +181,7 @@
// Weak pointers are used to safely post the inspection result back to the
// ModuleInspector from the task scheduler.
- base::WeakPtrFactory<ModuleInspector> weak_ptr_factory_;
+ base::WeakPtrFactory<ModuleInspector> weak_ptr_factory_{this};
DISALLOW_COPY_AND_ASSIGN(ModuleInspector);
};
diff --git a/chrome/browser/win/jumplist.cc b/chrome/browser/win/jumplist.cc
index 6a5fb8a9..150b370 100644
--- a/chrome/browser/win/jumplist.cc
+++ b/chrome/browser/win/jumplist.cc
@@ -227,8 +227,7 @@
delete_jumplisticons_task_runner_(base::CreateSequencedTaskRunner(
{base::ThreadPool(), base::MayBlock(),
base::TaskPriority::BEST_EFFORT,
- base::TaskShutdownBehavior::CONTINUE_ON_SHUTDOWN})),
- weak_ptr_factory_(this) {
+ base::TaskShutdownBehavior::CONTINUE_ON_SHUTDOWN})) {
DCHECK(Enabled());
// To update JumpList when a tab is added or removed, we add this object to
// the observer list of the TabRestoreService class.
diff --git a/chrome/browser/win/jumplist.h b/chrome/browser/win/jumplist.h
index a851168..e59413de 100644
--- a/chrome/browser/win/jumplist.h
+++ b/chrome/browser/win/jumplist.h
@@ -333,7 +333,7 @@
SEQUENCE_CHECKER(sequence_checker_);
// For callbacks may run after destruction.
- base::WeakPtrFactory<JumpList> weak_ptr_factory_;
+ base::WeakPtrFactory<JumpList> weak_ptr_factory_{this};
DISALLOW_COPY_AND_ASSIGN(JumpList);
};
diff --git a/chrome/browser/win/settings_app_monitor.cc b/chrome/browser/win/settings_app_monitor.cc
index 61bfe44..bfe018096 100644
--- a/chrome/browser/win/settings_app_monitor.cc
+++ b/chrome/browser/win/settings_app_monitor.cc
@@ -258,7 +258,7 @@
}
SettingsAppMonitor::SettingsAppMonitor(Delegate* delegate)
- : delegate_(delegate), weak_ptr_factory_(this) {
+ : delegate_(delegate) {
// A fully initialized WeakPtrFactory is needed to create the
// AutomationControllerDelegate.
auto automation_controller_delegate =
diff --git a/chrome/browser/win/settings_app_monitor.h b/chrome/browser/win/settings_app_monitor.h
index 9fb0fb6..4177628 100644
--- a/chrome/browser/win/settings_app_monitor.h
+++ b/chrome/browser/win/settings_app_monitor.h
@@ -72,7 +72,7 @@
// Weak pointers are passed to the AutomationControllerDelegate so that it can
// safely call back the monitor from any thread.
- base::WeakPtrFactory<SettingsAppMonitor> weak_ptr_factory_;
+ base::WeakPtrFactory<SettingsAppMonitor> weak_ptr_factory_{this};
DISALLOW_COPY_AND_ASSIGN(SettingsAppMonitor);
};
diff --git a/chrome/chrome_cleaner/engines/controllers/main_controller.cc b/chrome/chrome_cleaner/engines/controllers/main_controller.cc
index ef241720..c509bf4 100644
--- a/chrome/chrome_cleaner/engines/controllers/main_controller.cc
+++ b/chrome/chrome_cleaner/engines/controllers/main_controller.cc
@@ -120,8 +120,7 @@
rebooter_(rebooter),
component_manager_(this),
result_code_(RESULT_CODE_INVALID),
- registry_logger_(registry_logger),
- weak_factory_(this) {
+ registry_logger_(registry_logger) {
Settings* settings = Settings::GetInstance();
ExecutionMode execution_mode = settings->execution_mode();
DCHECK(execution_mode == ExecutionMode::kScanning ||
diff --git a/chrome/chrome_cleaner/engines/controllers/main_controller.h b/chrome/chrome_cleaner/engines/controllers/main_controller.h
index f2e2f6b..ed5b3fd7 100644
--- a/chrome/chrome_cleaner/engines/controllers/main_controller.h
+++ b/chrome/chrome_cleaner/engines/controllers/main_controller.h
@@ -234,7 +234,7 @@
// The connection error handlers gets a weak pointer for the main controller,
// so that it doesn't try to access the object once it's destroyed.
- base::WeakPtrFactory<MainController> weak_factory_;
+ base::WeakPtrFactory<MainController> weak_factory_{this};
};
} // namespace chrome_cleaner
diff --git a/chrome/common/conflicts/module_watcher_win.cc b/chrome/common/conflicts/module_watcher_win.cc
index 40466d4..994b1056 100644
--- a/chrome/common/conflicts/module_watcher_win.cc
+++ b/chrome/common/conflicts/module_watcher_win.cc
@@ -156,7 +156,7 @@
g_module_watcher_instance = nullptr;
}
-ModuleWatcher::ModuleWatcher() : weak_ptr_factory_(this) {}
+ModuleWatcher::ModuleWatcher() {}
// Initializes the ModuleWatcher instance.
void ModuleWatcher::Initialize(OnModuleEventCallback callback) {
diff --git a/chrome/common/conflicts/module_watcher_win.h b/chrome/common/conflicts/module_watcher_win.h
index a4af43b..b050fdf 100644
--- a/chrome/common/conflicts/module_watcher_win.h
+++ b/chrome/common/conflicts/module_watcher_win.h
@@ -141,7 +141,7 @@
// Used by the DllNotification mechanism.
void* dll_notification_cookie_ = nullptr;
- base::WeakPtrFactory<ModuleWatcher> weak_ptr_factory_;
+ base::WeakPtrFactory<ModuleWatcher> weak_ptr_factory_{this};
DISALLOW_COPY_AND_ASSIGN(ModuleWatcher);
};
diff --git a/chrome/common/conflicts/remote_module_watcher_win.cc b/chrome/common/conflicts/remote_module_watcher_win.cc
index 8e73b2a..94ce3d9 100644
--- a/chrome/common/conflicts/remote_module_watcher_win.cc
+++ b/chrome/common/conflicts/remote_module_watcher_win.cc
@@ -53,8 +53,7 @@
delay_timer_(FROM_HERE,
kIdleDelay,
this,
- &RemoteModuleWatcher::OnTimerFired),
- weak_ptr_factory_(this) {}
+ &RemoteModuleWatcher::OnTimerFired) {}
void RemoteModuleWatcher::InitializeOnTaskRunner(
std::unique_ptr<service_manager::Connector> connector) {
diff --git a/chrome/common/conflicts/remote_module_watcher_win.h b/chrome/common/conflicts/remote_module_watcher_win.h
index 0621231..d53cdb7 100644
--- a/chrome/common/conflicts/remote_module_watcher_win.h
+++ b/chrome/common/conflicts/remote_module_watcher_win.h
@@ -82,7 +82,7 @@
// been received for |kIdleDelay| amount of time.
base::DelayTimer delay_timer_;
- base::WeakPtrFactory<RemoteModuleWatcher> weak_ptr_factory_;
+ base::WeakPtrFactory<RemoteModuleWatcher> weak_ptr_factory_{this};
DISALLOW_COPY_AND_ASSIGN(RemoteModuleWatcher);
};
diff --git a/chrome/service/service_utility_process_host.cc b/chrome/service/service_utility_process_host.cc
index cc0452c4..ecdd4d89 100644
--- a/chrome/service/service_utility_process_host.cc
+++ b/chrome/service/service_utility_process_host.cc
@@ -259,8 +259,7 @@
base::SingleThreadTaskRunner* client_task_runner)
: client_(client),
client_task_runner_(client_task_runner),
- waiting_for_reply_(false),
- weak_ptr_factory_(this) {
+ waiting_for_reply_(false) {
child_process_host_ = ChildProcessHost::Create(this);
}
diff --git a/chrome/service/service_utility_process_host.h b/chrome/service/service_utility_process_host.h
index f87cb87..0737c77 100644
--- a/chrome/service/service_utility_process_host.h
+++ b/chrome/service/service_utility_process_host.h
@@ -175,7 +175,7 @@
service_manager_connection_;
service_manager::Identity utility_service_instance_identity_;
- base::WeakPtrFactory<ServiceUtilityProcessHost> weak_ptr_factory_;
+ base::WeakPtrFactory<ServiceUtilityProcessHost> weak_ptr_factory_{this};
DISALLOW_COPY_AND_ASSIGN(ServiceUtilityProcessHost);
};
diff --git a/components/browser_watcher/watcher_metrics_provider_win.cc b/components/browser_watcher/watcher_metrics_provider_win.cc
index 905c96e1..d535722 100644
--- a/components/browser_watcher/watcher_metrics_provider_win.cc
+++ b/components/browser_watcher/watcher_metrics_provider_win.cc
@@ -189,8 +189,7 @@
user_data_dir_(user_data_dir),
crash_dir_(crash_dir),
exe_details_cb_(exe_details_cb),
- task_runner_(CreateBackgroundTaskRunner()),
- weak_ptr_factory_(this) {}
+ task_runner_(CreateBackgroundTaskRunner()) {}
WatcherMetricsProviderWin::~WatcherMetricsProviderWin() {
}
diff --git a/components/browser_watcher/watcher_metrics_provider_win.h b/components/browser_watcher/watcher_metrics_provider_win.h
index df792c9..ef3c981 100644
--- a/components/browser_watcher/watcher_metrics_provider_win.h
+++ b/components/browser_watcher/watcher_metrics_provider_win.h
@@ -65,7 +65,7 @@
// registry if metrics reporting is disabled.
scoped_refptr<base::TaskRunner> task_runner_;
- base::WeakPtrFactory<WatcherMetricsProviderWin> weak_ptr_factory_;
+ base::WeakPtrFactory<WatcherMetricsProviderWin> weak_ptr_factory_{this};
DISALLOW_COPY_AND_ASSIGN(WatcherMetricsProviderWin);
};
diff --git a/components/password_manager/core/browser/leak_detection/authenticated_leak_check.cc b/components/password_manager/core/browser/leak_detection/authenticated_leak_check.cc
index 529f2cd..d2bd8f2 100644
--- a/components/password_manager/core/browser/leak_detection/authenticated_leak_check.cc
+++ b/components/password_manager/core/browser/leak_detection/authenticated_leak_check.cc
@@ -171,8 +171,8 @@
payload_helper_(new RequestPayloadHelper(this,
identity_manager,
std::move(url_loader_factory))),
- network_request_factory_(std::make_unique<LeakDetectionRequestFactory>()),
- weak_ptr_factory_(this) {
+ network_request_factory_(
+ std::make_unique<LeakDetectionRequestFactory>()) {
DCHECK(delegate_);
}
diff --git a/components/password_manager/core/browser/leak_detection/authenticated_leak_check.h b/components/password_manager/core/browser/leak_detection/authenticated_leak_check.h
index cebf377..27adb93 100644
--- a/components/password_manager/core/browser/leak_detection/authenticated_leak_check.h
+++ b/components/password_manager/core/browser/leak_detection/authenticated_leak_check.h
@@ -101,7 +101,7 @@
// Encryption key used during the request.
std::string encryption_key_;
// Weak pointers for different callbacks.
- base::WeakPtrFactory<AuthenticatedLeakCheck> weak_ptr_factory_;
+ base::WeakPtrFactory<AuthenticatedLeakCheck> weak_ptr_factory_{this};
};
} // namespace password_manager
diff --git a/components/spellcheck/browser/spellcheck_platform_win.cc b/components/spellcheck/browser/spellcheck_platform_win.cc
index 6562be7..1ac94e7f 100644
--- a/components/spellcheck/browser/spellcheck_platform_win.cc
+++ b/components/spellcheck/browser/spellcheck_platform_win.cc
@@ -127,7 +127,7 @@
// used to post task to the background thread from main thread.
scoped_refptr<base::SingleThreadTaskRunner> main_task_runner_;
scoped_refptr<base::SingleThreadTaskRunner> background_task_runner_;
- base::WeakPtrFactory<WindowsSpellChecker> weak_ptr_factory_;
+ base::WeakPtrFactory<WindowsSpellChecker> weak_ptr_factory_{this};
DISALLOW_COPY_AND_ASSIGN(WindowsSpellChecker);
};
@@ -136,8 +136,7 @@
const scoped_refptr<base::SingleThreadTaskRunner> main_task_runner,
const scoped_refptr<base::SingleThreadTaskRunner> background_task_runner)
: main_task_runner_(main_task_runner),
- background_task_runner_(background_task_runner),
- weak_ptr_factory_(this) {
+ background_task_runner_(background_task_runner) {
background_task_runner_->PostTask(
FROM_HERE,
base::BindOnce(
diff --git a/components/storage_monitor/portable_device_watcher_win.cc b/components/storage_monitor/portable_device_watcher_win.cc
index 9936f41..ae44f0f0 100644
--- a/components/storage_monitor/portable_device_watcher_win.cc
+++ b/components/storage_monitor/portable_device_watcher_win.cc
@@ -496,9 +496,7 @@
}
PortableDeviceWatcherWin::PortableDeviceWatcherWin()
- : notifications_(nullptr),
- storage_notifications_(nullptr),
- weak_ptr_factory_(this) {}
+ : notifications_(nullptr), storage_notifications_(nullptr) {}
PortableDeviceWatcherWin::~PortableDeviceWatcherWin() {
UnregisterDeviceNotification(notifications_);
diff --git a/components/storage_monitor/portable_device_watcher_win.h b/components/storage_monitor/portable_device_watcher_win.h
index b991471..377a97c 100644
--- a/components/storage_monitor/portable_device_watcher_win.h
+++ b/components/storage_monitor/portable_device_watcher_win.h
@@ -141,7 +141,7 @@
StorageMonitor::Receiver* storage_notifications_;
// Used by |media_task_runner_| to create cancelable callbacks.
- base::WeakPtrFactory<PortableDeviceWatcherWin> weak_ptr_factory_;
+ base::WeakPtrFactory<PortableDeviceWatcherWin> weak_ptr_factory_{this};
DISALLOW_COPY_AND_ASSIGN(PortableDeviceWatcherWin);
};
diff --git a/components/storage_monitor/volume_mount_watcher_win.cc b/components/storage_monitor/volume_mount_watcher_win.cc
index 1e4915cd..b594a63 100644
--- a/components/storage_monitor/volume_mount_watcher_win.cc
+++ b/components/storage_monitor/volume_mount_watcher_win.cc
@@ -317,8 +317,7 @@
{base::ThreadPool(), base::MayBlock(),
base::TaskPriority::BEST_EFFORT,
base::TaskShutdownBehavior::CONTINUE_ON_SHUTDOWN})),
- notifications_(nullptr),
- weak_factory_(this) {}
+ notifications_(nullptr) {}
// static
base::FilePath VolumeMountWatcherWin::DriveNumberToFilePath(int drive_number) {
diff --git a/components/storage_monitor/volume_mount_watcher_win.h b/components/storage_monitor/volume_mount_watcher_win.h
index c8eafb2..0e60473 100644
--- a/components/storage_monitor/volume_mount_watcher_win.h
+++ b/components/storage_monitor/volume_mount_watcher_win.h
@@ -114,7 +114,7 @@
// removable devices will be notified.
StorageMonitor::Receiver* notifications_;
- base::WeakPtrFactory<VolumeMountWatcherWin> weak_factory_;
+ base::WeakPtrFactory<VolumeMountWatcherWin> weak_factory_{this};
DISALLOW_COPY_AND_ASSIGN(VolumeMountWatcherWin);
};
diff --git a/content/browser/background_sync/background_sync_proxy.cc b/content/browser/background_sync/background_sync_proxy.cc
index 18952f2..e71ca5b 100644
--- a/content/browser/background_sync/background_sync_proxy.cc
+++ b/content/browser/background_sync/background_sync_proxy.cc
@@ -25,8 +25,7 @@
Core(const base::WeakPtr<BackgroundSyncProxy>& io_parent,
scoped_refptr<ServiceWorkerContextWrapper> service_worker_context)
: io_parent_(io_parent),
- service_worker_context_(std::move(service_worker_context)),
- weak_ptr_factory_(this) {
+ service_worker_context_(std::move(service_worker_context)) {
DCHECK_CURRENTLY_ON(BrowserThread::IO);
DCHECK(service_worker_context_);
}
@@ -80,14 +79,13 @@
private:
base::WeakPtr<BackgroundSyncProxy> io_parent_;
scoped_refptr<ServiceWorkerContextWrapper> service_worker_context_;
- base::WeakPtrFactory<Core> weak_ptr_factory_;
+ base::WeakPtrFactory<Core> weak_ptr_factory_{this};
DISALLOW_COPY_AND_ASSIGN(Core);
};
BackgroundSyncProxy::BackgroundSyncProxy(
- scoped_refptr<ServiceWorkerContextWrapper> service_worker_context)
- : weak_ptr_factory_(this) {
+ scoped_refptr<ServiceWorkerContextWrapper> service_worker_context) {
DCHECK_CURRENTLY_ON(BrowserThread::IO);
DCHECK(service_worker_context);
ui_core_ = std::unique_ptr<Core, BrowserThread::DeleteOnUIThread>(new Core(
diff --git a/content/browser/background_sync/background_sync_proxy.h b/content/browser/background_sync/background_sync_proxy.h
index 90fe84e..7449177 100644
--- a/content/browser/background_sync/background_sync_proxy.h
+++ b/content/browser/background_sync/background_sync_proxy.h
@@ -40,7 +40,7 @@
std::unique_ptr<Core, BrowserThread::DeleteOnUIThread> ui_core_;
base::WeakPtr<Core> ui_core_weak_ptr_;
- base::WeakPtrFactory<BackgroundSyncProxy> weak_ptr_factory_;
+ base::WeakPtrFactory<BackgroundSyncProxy> weak_ptr_factory_{this};
DISALLOW_COPY_AND_ASSIGN(BackgroundSyncProxy);
};
diff --git a/content/browser/indexed_db/leveldb/transactional_leveldb_transaction.cc b/content/browser/indexed_db/leveldb/transactional_leveldb_transaction.cc
index 7a8a8190..951cdf9 100644
--- a/content/browser/indexed_db/leveldb/transactional_leveldb_transaction.cc
+++ b/content/browser/indexed_db/leveldb/transactional_leveldb_transaction.cc
@@ -25,7 +25,7 @@
TransactionalLevelDBTransaction::TransactionalLevelDBTransaction(
TransactionalLevelDBDatabase* db,
std::unique_ptr<LevelDBScope> scope)
- : db_(db), scope_(std::move(scope)), weak_factory_(this) {
+ : db_(db), scope_(std::move(scope)) {
DCHECK(db_);
DCHECK(scope_);
}
diff --git a/content/browser/indexed_db/leveldb/transactional_leveldb_transaction.h b/content/browser/indexed_db/leveldb/transactional_leveldb_transaction.h
index bfe61571..8337714 100644
--- a/content/browser/indexed_db/leveldb/transactional_leveldb_transaction.h
+++ b/content/browser/indexed_db/leveldb/transactional_leveldb_transaction.h
@@ -139,7 +139,7 @@
std::set<TransactionalLevelDBIterator*> evicted_iterators_;
bool is_evicting_all_loaded_iterators_ = false;
- base::WeakPtrFactory<TransactionalLevelDBTransaction> weak_factory_;
+ base::WeakPtrFactory<TransactionalLevelDBTransaction> weak_factory_{this};
DISALLOW_COPY_AND_ASSIGN(TransactionalLevelDBTransaction);
};
diff --git a/content/browser/loader/cached_navigation_url_loader.cc b/content/browser/loader/cached_navigation_url_loader.cc
index 6ba6c131..3bee02d 100644
--- a/content/browser/loader/cached_navigation_url_loader.cc
+++ b/content/browser/loader/cached_navigation_url_loader.cc
@@ -20,9 +20,7 @@
CachedNavigationURLLoader::CachedNavigationURLLoader(
std::unique_ptr<NavigationRequestInfo> request_info,
NavigationURLLoaderDelegate* delegate)
- : request_info_(std::move(request_info)),
- delegate_(delegate),
- weak_factory_(this) {
+ : request_info_(std::move(request_info)), delegate_(delegate) {
// Respond with a fake response. We use PostTask here to mimic the flow of
// a normal navigation.
//
diff --git a/content/browser/loader/cached_navigation_url_loader.h b/content/browser/loader/cached_navigation_url_loader.h
index 138e679..7200598 100644
--- a/content/browser/loader/cached_navigation_url_loader.h
+++ b/content/browser/loader/cached_navigation_url_loader.h
@@ -32,7 +32,7 @@
void OnResponseStarted();
std::unique_ptr<NavigationRequestInfo> request_info_;
NavigationURLLoaderDelegate* delegate_;
- base::WeakPtrFactory<CachedNavigationURLLoader> weak_factory_;
+ base::WeakPtrFactory<CachedNavigationURLLoader> weak_factory_{this};
};
} // namespace content
diff --git a/content/browser/speech/tts_win.cc b/content/browser/speech/tts_win.cc
index aab6450..816ae50 100644
--- a/content/browser/speech/tts_win.cc
+++ b/content/browser/speech/tts_win.cc
@@ -87,7 +87,7 @@
friend struct base::DefaultSingletonTraits<TtsPlatformImplWin>;
- base::WeakPtrFactory<TtsPlatformImplWin> weak_factory_;
+ base::WeakPtrFactory<TtsPlatformImplWin> weak_factory_{this};
DISALLOW_COPY_AND_ASSIGN(TtsPlatformImplWin);
};
@@ -340,8 +340,7 @@
prefix_len_(0),
stream_number_(0),
char_position_(0),
- paused_(false),
- weak_factory_(this) {
+ paused_(false) {
::CoCreateInstance(CLSID_SpVoice, nullptr, CLSCTX_ALL,
IID_PPV_ARGS(&speech_synthesizer_));
if (speech_synthesizer_.Get()) {
diff --git a/content/renderer/media/batching_media_log.cc b/content/renderer/media/batching_media_log.cc
index 3b593ca..2168d2a 100644
--- a/content/renderer/media/batching_media_log.cc
+++ b/content/renderer/media/batching_media_log.cc
@@ -44,8 +44,7 @@
event_handler_(std::move(event_handler)),
tick_clock_(base::DefaultTickClock::GetInstance()),
last_ipc_send_time_(tick_clock_->NowTicks()),
- ipc_send_pending_(false),
- weak_factory_(this) {
+ ipc_send_pending_(false) {
DCHECK(RenderThread::Get())
<< "BatchingMediaLog must be constructed on the render thread";
// Pre-bind the WeakPtr on the right thread since we'll receive calls from
diff --git a/content/renderer/media/batching_media_log.h b/content/renderer/media/batching_media_log.h
index 6574934..6b82bbf643 100644
--- a/content/renderer/media/batching_media_log.h
+++ b/content/renderer/media/batching_media_log.h
@@ -92,7 +92,7 @@
std::unique_ptr<media::MediaLogEvent> last_pipeline_error_;
base::WeakPtr<BatchingMediaLog> weak_this_;
- base::WeakPtrFactory<BatchingMediaLog> weak_factory_;
+ base::WeakPtrFactory<BatchingMediaLog> weak_factory_{this};
DISALLOW_COPY_AND_ASSIGN(BatchingMediaLog);
};
diff --git a/device/bluetooth/bluetooth_adapter_win.cc b/device/bluetooth/bluetooth_adapter_win.cc
index 874194d..85a34d4 100644
--- a/device/bluetooth/bluetooth_adapter_win.cc
+++ b/device/bluetooth/bluetooth_adapter_win.cc
@@ -68,8 +68,7 @@
initialized_(false),
powered_(false),
discovery_status_(NOT_DISCOVERING),
- force_update_device_for_test_(false),
- weak_ptr_factory_(this) {}
+ force_update_device_for_test_(false) {}
BluetoothAdapterWin::~BluetoothAdapterWin() {
if (task_manager_.get())
diff --git a/device/bluetooth/bluetooth_adapter_win.h b/device/bluetooth/bluetooth_adapter_win.h
index 5375000..8fb8375 100644
--- a/device/bluetooth/bluetooth_adapter_win.h
+++ b/device/bluetooth/bluetooth_adapter_win.h
@@ -154,7 +154,7 @@
// NOTE: This should remain the last member so it'll be destroyed and
// invalidate its weak pointers before any other members are destroyed.
- base::WeakPtrFactory<BluetoothAdapterWin> weak_ptr_factory_;
+ base::WeakPtrFactory<BluetoothAdapterWin> weak_ptr_factory_{this};
DISALLOW_COPY_AND_ASSIGN(BluetoothAdapterWin);
};
diff --git a/device/bluetooth/bluetooth_adapter_winrt.cc b/device/bluetooth/bluetooth_adapter_winrt.cc
index 002eca6..79bf5276 100644
--- a/device/bluetooth/bluetooth_adapter_winrt.cc
+++ b/device/bluetooth/bluetooth_adapter_winrt.cc
@@ -603,7 +603,7 @@
return powered_radio_watcher_.Get();
}
-BluetoothAdapterWinrt::BluetoothAdapterWinrt() : weak_ptr_factory_(this) {
+BluetoothAdapterWinrt::BluetoothAdapterWinrt() {
ui_task_runner_ = base::ThreadTaskRunnerHandle::Get();
}
diff --git a/device/bluetooth/bluetooth_adapter_winrt.h b/device/bluetooth/bluetooth_adapter_winrt.h
index ba36fa18..1c3019ce 100644
--- a/device/bluetooth/bluetooth_adapter_winrt.h
+++ b/device/bluetooth/bluetooth_adapter_winrt.h
@@ -248,7 +248,7 @@
// Note: This should remain the last member so it'll be destroyed and
// invalidate its weak pointers before any other members are destroyed.
- base::WeakPtrFactory<BluetoothAdapterWinrt> weak_ptr_factory_;
+ base::WeakPtrFactory<BluetoothAdapterWinrt> weak_ptr_factory_{this};
DISALLOW_COPY_AND_ASSIGN(BluetoothAdapterWinrt);
};
diff --git a/device/bluetooth/bluetooth_advertisement_winrt.cc b/device/bluetooth/bluetooth_advertisement_winrt.cc
index cfe8d44..bcfa0a7 100644
--- a/device/bluetooth/bluetooth_advertisement_winrt.cc
+++ b/device/bluetooth/bluetooth_advertisement_winrt.cc
@@ -64,8 +64,7 @@
} // namespace
-BluetoothAdvertisementWinrt::BluetoothAdvertisementWinrt()
- : weak_ptr_factory_(this) {}
+BluetoothAdvertisementWinrt::BluetoothAdvertisementWinrt() {}
bool BluetoothAdvertisementWinrt::Initialize(
std::unique_ptr<BluetoothAdvertisement::Data> advertisement_data) {
diff --git a/device/bluetooth/bluetooth_advertisement_winrt.h b/device/bluetooth/bluetooth_advertisement_winrt.h
index 7681e5f..6ef3dc9 100644
--- a/device/bluetooth/bluetooth_advertisement_winrt.h
+++ b/device/bluetooth/bluetooth_advertisement_winrt.h
@@ -74,7 +74,7 @@
std::unique_ptr<PendingCallbacks> pending_register_callbacks_;
std::unique_ptr<PendingCallbacks> pending_unregister_callbacks_;
- base::WeakPtrFactory<BluetoothAdvertisementWinrt> weak_ptr_factory_;
+ base::WeakPtrFactory<BluetoothAdvertisementWinrt> weak_ptr_factory_{this};
DISALLOW_COPY_AND_ASSIGN(BluetoothAdvertisementWinrt);
};
diff --git a/device/bluetooth/bluetooth_device_winrt.cc b/device/bluetooth/bluetooth_device_winrt.cc
index b0c3d50..f480e6c 100644
--- a/device/bluetooth/bluetooth_device_winrt.cc
+++ b/device/bluetooth/bluetooth_device_winrt.cc
@@ -155,8 +155,7 @@
uint64_t raw_address)
: BluetoothDevice(adapter),
raw_address_(raw_address),
- address_(CanonicalizeAddress(raw_address)),
- weak_ptr_factory_(this) {}
+ address_(CanonicalizeAddress(raw_address)) {}
BluetoothDeviceWinrt::~BluetoothDeviceWinrt() {
CloseDevice(ble_device_);
diff --git a/device/bluetooth/bluetooth_device_winrt.h b/device/bluetooth/bluetooth_device_winrt.h
index c7fe84a..6fba93b6 100644
--- a/device/bluetooth/bluetooth_device_winrt.h
+++ b/device/bluetooth/bluetooth_device_winrt.h
@@ -143,7 +143,7 @@
// Note: This should remain the last member so it'll be destroyed and
// invalidate its weak pointers before any other members are destroyed.
- base::WeakPtrFactory<BluetoothDeviceWinrt> weak_ptr_factory_;
+ base::WeakPtrFactory<BluetoothDeviceWinrt> weak_ptr_factory_{this};
DISALLOW_COPY_AND_ASSIGN(BluetoothDeviceWinrt);
};
diff --git a/device/bluetooth/bluetooth_gatt_discoverer_winrt.cc b/device/bluetooth/bluetooth_gatt_discoverer_winrt.cc
index b7ec0d7..511b00c 100644
--- a/device/bluetooth/bluetooth_gatt_discoverer_winrt.cc
+++ b/device/bluetooth/bluetooth_gatt_discoverer_winrt.cc
@@ -127,7 +127,7 @@
BluetoothGattDiscovererWinrt::BluetoothGattDiscovererWinrt(
ComPtr<IBluetoothLEDevice> ble_device)
- : ble_device_(std::move(ble_device)), weak_ptr_factory_(this) {}
+ : ble_device_(std::move(ble_device)) {}
BluetoothGattDiscovererWinrt::~BluetoothGattDiscovererWinrt() = default;
diff --git a/device/bluetooth/bluetooth_gatt_discoverer_winrt.h b/device/bluetooth/bluetooth_gatt_discoverer_winrt.h
index 47d13ff..8798ce7 100644
--- a/device/bluetooth/bluetooth_gatt_discoverer_winrt.h
+++ b/device/bluetooth/bluetooth_gatt_discoverer_winrt.h
@@ -101,7 +101,7 @@
// Note: This should remain the last member so it'll be destroyed and
// invalidate its weak pointers before any other members are destroyed.
- base::WeakPtrFactory<BluetoothGattDiscovererWinrt> weak_ptr_factory_;
+ base::WeakPtrFactory<BluetoothGattDiscovererWinrt> weak_ptr_factory_{this};
DISALLOW_COPY_AND_ASSIGN(BluetoothGattDiscovererWinrt);
};
diff --git a/device/bluetooth/bluetooth_pairing_winrt.cc b/device/bluetooth/bluetooth_pairing_winrt.cc
index 2cbf0f7b..5873994 100644
--- a/device/bluetooth/bluetooth_pairing_winrt.cc
+++ b/device/bluetooth/bluetooth_pairing_winrt.cc
@@ -62,8 +62,7 @@
pairing_delegate_(pairing_delegate),
custom_pairing_(std::move(custom_pairing)),
callback_(std::move(callback)),
- error_callback_(std::move(error_callback)),
- weak_ptr_factory_(this) {
+ error_callback_(std::move(error_callback)) {
DCHECK(device_);
DCHECK(pairing_delegate_);
DCHECK(custom_pairing_);
diff --git a/device/bluetooth/bluetooth_pairing_winrt.h b/device/bluetooth/bluetooth_pairing_winrt.h
index 88f57b6..c95e829 100644
--- a/device/bluetooth/bluetooth_pairing_winrt.h
+++ b/device/bluetooth/bluetooth_pairing_winrt.h
@@ -89,7 +89,7 @@
ABI::Windows::Devices::Enumeration::IDevicePairingRequestedEventArgs>
pairing_requested_;
- base::WeakPtrFactory<BluetoothPairingWinrt> weak_ptr_factory_;
+ base::WeakPtrFactory<BluetoothPairingWinrt> weak_ptr_factory_{this};
DISALLOW_COPY_AND_ASSIGN(BluetoothPairingWinrt);
};
diff --git a/device/bluetooth/bluetooth_remote_gatt_characteristic_win.cc b/device/bluetooth/bluetooth_remote_gatt_characteristic_win.cc
index c495b889..dfe278ab 100644
--- a/device/bluetooth/bluetooth_remote_gatt_characteristic_win.cc
+++ b/device/bluetooth/bluetooth_remote_gatt_characteristic_win.cc
@@ -27,8 +27,7 @@
characteristic_added_notified_(false),
characteristic_value_read_or_write_in_progress_(false),
gatt_event_handle_(nullptr),
- discovery_pending_count_(0),
- weak_ptr_factory_(this) {
+ discovery_pending_count_(0) {
DCHECK(ui_task_runner_->RunsTasksInCurrentSequence());
DCHECK(parent_service_);
DCHECK(characteristic_info_);
diff --git a/device/bluetooth/bluetooth_remote_gatt_characteristic_win.h b/device/bluetooth/bluetooth_remote_gatt_characteristic_win.h
index 714009f3..56a3212 100644
--- a/device/bluetooth/bluetooth_remote_gatt_characteristic_win.h
+++ b/device/bluetooth/bluetooth_remote_gatt_characteristic_win.h
@@ -124,7 +124,8 @@
// descriptors.
int discovery_pending_count_;
- base::WeakPtrFactory<BluetoothRemoteGattCharacteristicWin> weak_ptr_factory_;
+ base::WeakPtrFactory<BluetoothRemoteGattCharacteristicWin> weak_ptr_factory_{
+ this};
DISALLOW_COPY_AND_ASSIGN(BluetoothRemoteGattCharacteristicWin);
};
diff --git a/device/bluetooth/bluetooth_remote_gatt_characteristic_winrt.cc b/device/bluetooth/bluetooth_remote_gatt_characteristic_winrt.cc
index c58f1a8..8e340c5 100644
--- a/device/bluetooth/bluetooth_remote_gatt_characteristic_winrt.cc
+++ b/device/bluetooth/bluetooth_remote_gatt_characteristic_winrt.cc
@@ -448,8 +448,7 @@
identifier_(base::StringPrintf("%s/%s_%04x",
service_->GetIdentifier().c_str(),
uuid_.value().c_str(),
- attribute_handle_)),
- weak_ptr_factory_(this) {}
+ attribute_handle_)) {}
void BluetoothRemoteGattCharacteristicWinrt::WriteCccDescriptor(
GattClientCharacteristicConfigurationDescriptorValue value,
diff --git a/device/bluetooth/bluetooth_remote_gatt_characteristic_winrt.h b/device/bluetooth/bluetooth_remote_gatt_characteristic_winrt.h
index 4d45c4d..c1d7df05 100644
--- a/device/bluetooth/bluetooth_remote_gatt_characteristic_winrt.h
+++ b/device/bluetooth/bluetooth_remote_gatt_characteristic_winrt.h
@@ -146,7 +146,7 @@
base::Optional<EventRegistrationToken> value_changed_token_;
base::WeakPtrFactory<BluetoothRemoteGattCharacteristicWinrt>
- weak_ptr_factory_;
+ weak_ptr_factory_{this};
DISALLOW_COPY_AND_ASSIGN(BluetoothRemoteGattCharacteristicWinrt);
};
diff --git a/device/bluetooth/bluetooth_remote_gatt_descriptor_win.cc b/device/bluetooth/bluetooth_remote_gatt_descriptor_win.cc
index e577914..9197c23 100644
--- a/device/bluetooth/bluetooth_remote_gatt_descriptor_win.cc
+++ b/device/bluetooth/bluetooth_remote_gatt_descriptor_win.cc
@@ -17,8 +17,7 @@
scoped_refptr<base::SequencedTaskRunner>& ui_task_runner)
: parent_characteristic_(parent_characteristic),
descriptor_info_(descriptor_info),
- ui_task_runner_(ui_task_runner),
- weak_ptr_factory_(this) {
+ ui_task_runner_(ui_task_runner) {
DCHECK(ui_task_runner_->RunsTasksInCurrentSequence());
DCHECK(parent_characteristic_);
DCHECK(descriptor_info_.get());
diff --git a/device/bluetooth/bluetooth_remote_gatt_descriptor_win.h b/device/bluetooth/bluetooth_remote_gatt_descriptor_win.h
index 5974482..ffa7b324 100644
--- a/device/bluetooth/bluetooth_remote_gatt_descriptor_win.h
+++ b/device/bluetooth/bluetooth_remote_gatt_descriptor_win.h
@@ -61,7 +61,8 @@
std::string descriptor_identifier_;
std::vector<uint8_t> descriptor_value_;
- base::WeakPtrFactory<BluetoothRemoteGattDescriptorWin> weak_ptr_factory_;
+ base::WeakPtrFactory<BluetoothRemoteGattDescriptorWin> weak_ptr_factory_{
+ this};
DISALLOW_COPY_AND_ASSIGN(BluetoothRemoteGattDescriptorWin);
};
diff --git a/device/bluetooth/bluetooth_remote_gatt_descriptor_winrt.cc b/device/bluetooth/bluetooth_remote_gatt_descriptor_winrt.cc
index 85532b7..f43f3d1 100644
--- a/device/bluetooth/bluetooth_remote_gatt_descriptor_winrt.cc
+++ b/device/bluetooth/bluetooth_remote_gatt_descriptor_winrt.cc
@@ -243,8 +243,7 @@
identifier_(base::StringPrintf("%s/%s_%04x",
characteristic_->GetIdentifier().c_str(),
uuid_.value().c_str(),
- attribute_handle)),
- weak_ptr_factory_(this) {}
+ attribute_handle)) {}
void BluetoothRemoteGattDescriptorWinrt::OnReadValue(
ComPtr<IGattReadResult> read_result) {
diff --git a/device/bluetooth/bluetooth_remote_gatt_descriptor_winrt.h b/device/bluetooth/bluetooth_remote_gatt_descriptor_winrt.h
index e749c497..c042044 100644
--- a/device/bluetooth/bluetooth_remote_gatt_descriptor_winrt.h
+++ b/device/bluetooth/bluetooth_remote_gatt_descriptor_winrt.h
@@ -97,7 +97,8 @@
std::unique_ptr<PendingReadCallbacks> pending_read_callbacks_;
std::unique_ptr<PendingWriteCallbacks> pending_write_callbacks_;
- base::WeakPtrFactory<BluetoothRemoteGattDescriptorWinrt> weak_ptr_factory_;
+ base::WeakPtrFactory<BluetoothRemoteGattDescriptorWinrt> weak_ptr_factory_{
+ this};
DISALLOW_COPY_AND_ASSIGN(BluetoothRemoteGattDescriptorWinrt);
};
diff --git a/device/bluetooth/bluetooth_remote_gatt_service_win.cc b/device/bluetooth/bluetooth_remote_gatt_service_win.cc
index 8d0b5b9..796f628 100644
--- a/device/bluetooth/bluetooth_remote_gatt_service_win.cc
+++ b/device/bluetooth/bluetooth_remote_gatt_service_win.cc
@@ -31,8 +31,7 @@
service_attribute_handle_(service_attribute_handle),
is_primary_(is_primary),
parent_service_(parent_service),
- ui_task_runner_(std::move(ui_task_runner)),
- weak_ptr_factory_(this) {
+ ui_task_runner_(std::move(ui_task_runner)) {
DCHECK(ui_task_runner_->RunsTasksInCurrentSequence());
DCHECK(!service_path_.empty());
DCHECK(service_uuid_.IsValid());
diff --git a/device/bluetooth/bluetooth_remote_gatt_service_win.h b/device/bluetooth/bluetooth_remote_gatt_service_win.h
index 9ef078b..34bf2e3 100644
--- a/device/bluetooth/bluetooth_remote_gatt_service_win.h
+++ b/device/bluetooth/bluetooth_remote_gatt_service_win.h
@@ -109,7 +109,7 @@
// characteristics.
int discovery_pending_count_ = 0;
- base::WeakPtrFactory<BluetoothRemoteGattServiceWin> weak_ptr_factory_;
+ base::WeakPtrFactory<BluetoothRemoteGattServiceWin> weak_ptr_factory_{this};
DISALLOW_COPY_AND_ASSIGN(BluetoothRemoteGattServiceWin);
};
diff --git a/device/fido/win/discovery.cc b/device/fido/win/discovery.cc
index 4e72da5..fa41083 100644
--- a/device/fido/win/discovery.cc
+++ b/device/fido/win/discovery.cc
@@ -14,8 +14,7 @@
WinWebAuthnApiAuthenticatorDiscovery::WinWebAuthnApiAuthenticatorDiscovery(
HWND parent_window)
: FidoDiscoveryBase(FidoTransportProtocol::kUsbHumanInterfaceDevice),
- parent_window_(parent_window),
- weak_factory_(this) {}
+ parent_window_(parent_window) {}
WinWebAuthnApiAuthenticatorDiscovery::~WinWebAuthnApiAuthenticatorDiscovery() =
default;
diff --git a/device/fido/win/discovery.h b/device/fido/win/discovery.h
index 741a756..10f2b00 100644
--- a/device/fido/win/discovery.h
+++ b/device/fido/win/discovery.h
@@ -31,7 +31,8 @@
std::unique_ptr<WinWebAuthnApiAuthenticator> authenticator_;
const HWND parent_window_;
- base::WeakPtrFactory<WinWebAuthnApiAuthenticatorDiscovery> weak_factory_;
+ base::WeakPtrFactory<WinWebAuthnApiAuthenticatorDiscovery> weak_factory_{
+ this};
};
} // namespace device
diff --git a/device/vr/openvr/openvr_device.cc b/device/vr/openvr/openvr_device.cc
index 43a420e..138161d 100644
--- a/device/vr/openvr/openvr_device.cc
+++ b/device/vr/openvr/openvr_device.cc
@@ -126,8 +126,7 @@
main_thread_task_runner_(base::ThreadTaskRunnerHandle::Get()),
exclusive_controller_binding_(this),
gamepad_provider_factory_binding_(this),
- compositor_host_binding_(this),
- weak_ptr_factory_(this) {
+ compositor_host_binding_(this) {
render_loop_ = std::make_unique<OpenVRRenderLoop>();
OnPollingEvents();
diff --git a/device/vr/openvr/openvr_device.h b/device/vr/openvr/openvr_device.h
index f2cd4d4..d852eea19 100644
--- a/device/vr/openvr/openvr_device.h
+++ b/device/vr/openvr/openvr_device.h
@@ -81,7 +81,7 @@
mojo::Binding<mojom::XRCompositorHost> compositor_host_binding_;
mojom::ImmersiveOverlayRequest overlay_request_;
- base::WeakPtrFactory<OpenVRDevice> weak_ptr_factory_;
+ base::WeakPtrFactory<OpenVRDevice> weak_ptr_factory_{this};
DISALLOW_COPY_AND_ASSIGN(OpenVRDevice);
};
diff --git a/device/vr/windows_mixed_reality/mixed_reality_device.cc b/device/vr/windows_mixed_reality/mixed_reality_device.cc
index d49c71a..5a330db 100644
--- a/device/vr/windows_mixed_reality/mixed_reality_device.cc
+++ b/device/vr/windows_mixed_reality/mixed_reality_device.cc
@@ -64,8 +64,7 @@
: VRDeviceBase(device::mojom::XRDeviceId::WINDOWS_MIXED_REALITY_ID),
gamepad_provider_factory_binding_(this),
compositor_host_binding_(this),
- exclusive_controller_binding_(this),
- weak_ptr_factory_(this) {
+ exclusive_controller_binding_(this) {
SetVRDisplayInfo(CreateFakeVRDisplayInfo(GetId()));
}
diff --git a/device/vr/windows_mixed_reality/mixed_reality_device.h b/device/vr/windows_mixed_reality/mixed_reality_device.h
index 503b594..8b13a54 100644
--- a/device/vr/windows_mixed_reality/mixed_reality_device.h
+++ b/device/vr/windows_mixed_reality/mixed_reality_device.h
@@ -65,7 +65,7 @@
mojo::Binding<mojom::XRSessionController> exclusive_controller_binding_;
- base::WeakPtrFactory<MixedRealityDevice> weak_ptr_factory_;
+ base::WeakPtrFactory<MixedRealityDevice> weak_ptr_factory_{this};
DISALLOW_COPY_AND_ASSIGN(MixedRealityDevice);
};
diff --git a/device/vr/windows_mixed_reality/mixed_reality_input_helper.cc b/device/vr/windows_mixed_reality/mixed_reality_input_helper.cc
index 6cb8ba3..688c02cd 100644
--- a/device/vr/windows_mixed_reality/mixed_reality_input_helper.cc
+++ b/device/vr/windows_mixed_reality/mixed_reality_input_helper.cc
@@ -402,8 +402,7 @@
const base::WeakPtr<MixedRealityRenderLoop>& weak_render_loop)
: hwnd_(hwnd),
task_runner_(base::ThreadTaskRunnerHandle::Get()),
- weak_render_loop_(weak_render_loop),
- weak_ptr_factory_(this) {}
+ weak_render_loop_(weak_render_loop) {}
MixedRealityInputHelper::~MixedRealityInputHelper() {
// Dispose must be called before destruction, which ensures that we're
diff --git a/device/vr/windows_mixed_reality/mixed_reality_input_helper.h b/device/vr/windows_mixed_reality/mixed_reality_input_helper.h
index c09b85d..94ce765 100644
--- a/device/vr/windows_mixed_reality/mixed_reality_input_helper.h
+++ b/device/vr/windows_mixed_reality/mixed_reality_input_helper.h
@@ -104,7 +104,7 @@
// created on (and should correspond to the render loop thread)
base::WeakPtr<MixedRealityRenderLoop> weak_render_loop_;
- base::WeakPtrFactory<MixedRealityInputHelper> weak_ptr_factory_;
+ base::WeakPtrFactory<MixedRealityInputHelper> weak_ptr_factory_{this};
DISALLOW_COPY_AND_ASSIGN(MixedRealityInputHelper);
};
diff --git a/device/vr/windows_mixed_reality/mixed_reality_renderloop.cc b/device/vr/windows_mixed_reality/mixed_reality_renderloop.cc
index 93e3266..c7cc71c 100644
--- a/device/vr/windows_mixed_reality/mixed_reality_renderloop.cc
+++ b/device/vr/windows_mixed_reality/mixed_reality_renderloop.cc
@@ -136,9 +136,7 @@
base::RepeatingCallback<void(mojom::VRDisplayInfoPtr)>
on_display_info_changed)
: XRCompositorCommon(),
- on_display_info_changed_(std::move(on_display_info_changed)),
- weak_ptr_factory_(this) {
-}
+ on_display_info_changed_(std::move(on_display_info_changed)) {}
MixedRealityRenderLoop::~MixedRealityRenderLoop() {
Stop();
diff --git a/device/vr/windows_mixed_reality/mixed_reality_renderloop.h b/device/vr/windows_mixed_reality/mixed_reality_renderloop.h
index d532b4f..863d040 100644
--- a/device/vr/windows_mixed_reality/mixed_reality_renderloop.h
+++ b/device/vr/windows_mixed_reality/mixed_reality_renderloop.h
@@ -123,7 +123,7 @@
bool bounds_updated_ = false;
// This must be the last member
- base::WeakPtrFactory<MixedRealityRenderLoop> weak_ptr_factory_;
+ base::WeakPtrFactory<MixedRealityRenderLoop> weak_ptr_factory_{this};
DISALLOW_COPY_AND_ASSIGN(MixedRealityRenderLoop);
};
diff --git a/extensions/browser/api/networking_private/networking_private_service_client.cc b/extensions/browser/api/networking_private/networking_private_service_client.cc
index 242a70e5..18b69cb 100644
--- a/extensions/browser/api/networking_private/networking_private_service_client.cc
+++ b/extensions/browser/api/networking_private/networking_private_service_client.cc
@@ -51,8 +51,7 @@
NetworkingPrivateServiceClient::NetworkingPrivateServiceClient(
std::unique_ptr<WiFiService> wifi_service)
: wifi_service_(std::move(wifi_service)),
- task_runner_(g_sequenced_task_runner.Get()),
- weak_factory_(this) {
+ task_runner_(g_sequenced_task_runner.Get()) {
task_runner_->PostTask(
FROM_HERE,
base::BindOnce(&WiFiService::Initialize,
diff --git a/extensions/browser/api/networking_private/networking_private_service_client.h b/extensions/browser/api/networking_private/networking_private_service_client.h
index fe99000..3c918f391 100644
--- a/extensions/browser/api/networking_private/networking_private_service_client.h
+++ b/extensions/browser/api/networking_private/networking_private_service_client.h
@@ -180,7 +180,7 @@
// Task runner for worker tasks.
scoped_refptr<base::SequencedTaskRunner> task_runner_;
// Use WeakPtrs for callbacks from |wifi_service_|.
- base::WeakPtrFactory<NetworkingPrivateServiceClient> weak_factory_;
+ base::WeakPtrFactory<NetworkingPrivateServiceClient> weak_factory_{this};
DISALLOW_COPY_AND_ASSIGN(NetworkingPrivateServiceClient);
};
diff --git a/media/capture/video/win/video_capture_device_factory_win.cc b/media/capture/video/win/video_capture_device_factory_win.cc
index 5b13906..e843e15 100644
--- a/media/capture/video/win/video_capture_device_factory_win.cc
+++ b/media/capture/video/win/video_capture_device_factory_win.cc
@@ -360,8 +360,7 @@
VideoCaptureDeviceFactoryWin::VideoCaptureDeviceFactoryWin()
: use_media_foundation_(
base::FeatureList::IsEnabled(media::kMediaFoundationVideoCapture)),
- com_thread_("Windows Video Capture COM Thread"),
- weak_ptr_factory_(this) {
+ com_thread_("Windows Video Capture COM Thread") {
mf_enum_device_sources_func_ =
PlatformSupportsMediaFoundation() ? MFEnumDeviceSources : nullptr;
direct_show_enum_devices_func_ =
diff --git a/media/capture/video/win/video_capture_device_factory_win.h b/media/capture/video/win/video_capture_device_factory_win.h
index 3248a0cf..5d2cf9c 100644
--- a/media/capture/video/win/video_capture_device_factory_win.h
+++ b/media/capture/video/win/video_capture_device_factory_win.h
@@ -107,7 +107,7 @@
base::Thread com_thread_;
scoped_refptr<base::SingleThreadTaskRunner> origin_task_runner_;
std::unordered_set<IAsyncOperation<DeviceInformationCollection*>*> async_ops_;
- base::WeakPtrFactory<VideoCaptureDeviceFactoryWin> weak_ptr_factory_;
+ base::WeakPtrFactory<VideoCaptureDeviceFactoryWin> weak_ptr_factory_{this};
DISALLOW_COPY_AND_ASSIGN(VideoCaptureDeviceFactoryWin);
};
diff --git a/media/gpu/test/fake_video_decode_accelerator.cc b/media/gpu/test/fake_video_decode_accelerator.cc
index 21148ede..7cfa89c 100644
--- a/media/gpu/test/fake_video_decode_accelerator.cc
+++ b/media/gpu/test/fake_video_decode_accelerator.cc
@@ -37,8 +37,7 @@
client_(NULL),
make_context_current_cb_(make_context_current_cb),
frame_buffer_size_(size),
- flushing_(false),
- weak_this_factory_(this) {}
+ flushing_(false) {}
FakeVideoDecodeAccelerator::~FakeVideoDecodeAccelerator() = default;
diff --git a/media/gpu/test/fake_video_decode_accelerator.h b/media/gpu/test/fake_video_decode_accelerator.h
index 93f26ce..418956d 100644
--- a/media/gpu/test/fake_video_decode_accelerator.h
+++ b/media/gpu/test/fake_video_decode_accelerator.h
@@ -62,7 +62,7 @@
bool flushing_;
// The WeakPtrFactory for |weak_this_|.
- base::WeakPtrFactory<FakeVideoDecodeAccelerator> weak_this_factory_;
+ base::WeakPtrFactory<FakeVideoDecodeAccelerator> weak_this_factory_{this};
DISALLOW_COPY_AND_ASSIGN(FakeVideoDecodeAccelerator);
};
diff --git a/media/gpu/video_decode_accelerator_unittest.cc b/media/gpu/video_decode_accelerator_unittest.cc
index ddcbbc4c..9d47f88 100644
--- a/media/gpu/video_decode_accelerator_unittest.cc
+++ b/media/gpu/video_decode_accelerator_unittest.cc
@@ -403,7 +403,7 @@
const std::unique_ptr<media::test::VideoFrameFileWriter> video_frame_writer_;
base::WeakPtr<GLRenderingVDAClient> weak_this_;
- base::WeakPtrFactory<GLRenderingVDAClient> weak_this_factory_;
+ base::WeakPtrFactory<GLRenderingVDAClient> weak_this_factory_{this};
DISALLOW_IMPLICIT_CONSTRUCTORS(GLRenderingVDAClient);
};
@@ -442,8 +442,7 @@
std::move(encoded_data),
config_.profile)),
video_frame_validator_(std::move(video_frame_validator)),
- video_frame_writer_(std::move(video_frame_writer)),
- weak_this_factory_(this) {
+ video_frame_writer_(std::move(video_frame_writer)) {
DCHECK_NE(config.profile, VIDEO_CODEC_PROFILE_UNKNOWN);
LOG_ASSERT(config_.num_in_flight_decodes > 0);
LOG_ASSERT(config_.num_play_throughs > 0);
diff --git a/media/gpu/windows/d3d11_cdm_proxy.cc b/media/gpu/windows/d3d11_cdm_proxy.cc
index c493da1..a2687c2 100644
--- a/media/gpu/windows/d3d11_cdm_proxy.cc
+++ b/media/gpu/windows/d3d11_cdm_proxy.cc
@@ -195,7 +195,7 @@
class D3D11CdmContext : public CdmContext {
public:
explicit D3D11CdmContext(const GUID& key_info_guid)
- : cdm_proxy_context_(key_info_guid), weak_factory_(this) {}
+ : cdm_proxy_context_(key_info_guid) {}
~D3D11CdmContext() override = default;
// The pointers are owned by the caller.
@@ -242,7 +242,7 @@
CallbackRegistry<EventCB::RunType> event_callbacks_;
- base::WeakPtrFactory<D3D11CdmContext> weak_factory_;
+ base::WeakPtrFactory<D3D11CdmContext> weak_factory_{this};
DISALLOW_COPY_AND_ASSIGN(D3D11CdmContext);
};
@@ -254,8 +254,7 @@
protocol_(protocol),
function_id_map_(function_id_map),
cdm_context_(std::make_unique<D3D11CdmContext>(crypto_type)),
- create_device_func_(base::BindRepeating(D3D11CreateDevice)),
- weak_factory_(this) {}
+ create_device_func_(base::BindRepeating(D3D11CreateDevice)) {}
D3D11CdmProxy::~D3D11CdmProxy() {}
diff --git a/media/gpu/windows/d3d11_cdm_proxy.h b/media/gpu/windows/d3d11_cdm_proxy.h
index d05410e..572ed2ea 100644
--- a/media/gpu/windows/d3d11_cdm_proxy.h
+++ b/media/gpu/windows/d3d11_cdm_proxy.h
@@ -116,7 +116,7 @@
UINT private_input_size_ = 0;
UINT private_output_size_ = 0;
- base::WeakPtrFactory<D3D11CdmProxy> weak_factory_;
+ base::WeakPtrFactory<D3D11CdmProxy> weak_factory_{this};
DISALLOW_COPY_AND_ASSIGN(D3D11CdmProxy);
};
diff --git a/media/gpu/windows/d3d11_decryptor.cc b/media/gpu/windows/d3d11_decryptor.cc
index 2585609..e03346ec 100644
--- a/media/gpu/windows/d3d11_decryptor.cc
+++ b/media/gpu/windows/d3d11_decryptor.cc
@@ -134,7 +134,7 @@
} // namespace
D3D11Decryptor::D3D11Decryptor(CdmProxyContext* cdm_proxy_context)
- : cdm_proxy_context_(cdm_proxy_context), weak_factory_(this) {
+ : cdm_proxy_context_(cdm_proxy_context) {
DCHECK(cdm_proxy_context_);
}
diff --git a/media/gpu/windows/d3d11_decryptor.h b/media/gpu/windows/d3d11_decryptor.h
index b8a1a761..8ae3069e 100644
--- a/media/gpu/windows/d3d11_decryptor.h
+++ b/media/gpu/windows/d3d11_decryptor.h
@@ -87,7 +87,7 @@
// to.
ComPtr<ID3D11Buffer> cpu_accessible_buffer_;
- base::WeakPtrFactory<D3D11Decryptor> weak_factory_;
+ base::WeakPtrFactory<D3D11Decryptor> weak_factory_{this};
DISALLOW_COPY_AND_ASSIGN(D3D11Decryptor);
};
diff --git a/media/gpu/windows/d3d11_video_decoder.cc b/media/gpu/windows/d3d11_video_decoder.cc
index 1162a490..ab888eed 100644
--- a/media/gpu/windows/d3d11_video_decoder.cc
+++ b/media/gpu/windows/d3d11_video_decoder.cc
@@ -112,8 +112,7 @@
gpu_workarounds_(gpu_workarounds),
get_d3d11_device_cb_(std::move(get_d3d11_device_cb)),
get_helper_cb_(std::move(get_helper_cb)),
- supported_configs_(std::move(supported_configs)),
- weak_factory_(this) {
+ supported_configs_(std::move(supported_configs)) {
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
DCHECK(media_log_);
diff --git a/media/gpu/windows/d3d11_video_decoder.h b/media/gpu/windows/d3d11_video_decoder.h
index b76bf59..8bb999e 100644
--- a/media/gpu/windows/d3d11_video_decoder.h
+++ b/media/gpu/windows/d3d11_video_decoder.h
@@ -259,7 +259,7 @@
SupportedConfigs supported_configs_;
- base::WeakPtrFactory<D3D11VideoDecoder> weak_factory_;
+ base::WeakPtrFactory<D3D11VideoDecoder> weak_factory_{this};
DISALLOW_COPY_AND_ASSIGN(D3D11VideoDecoder);
};
diff --git a/media/gpu/windows/d3d11_video_decoder_impl.cc b/media/gpu/windows/d3d11_video_decoder_impl.cc
index ec542175d..da38ad7 100644
--- a/media/gpu/windows/d3d11_video_decoder_impl.cc
+++ b/media/gpu/windows/d3d11_video_decoder_impl.cc
@@ -17,8 +17,7 @@
std::unique_ptr<MediaLog> media_log,
base::RepeatingCallback<scoped_refptr<CommandBufferHelper>()> get_helper_cb)
: media_log_(std::move(media_log)),
- get_helper_cb_(std::move(get_helper_cb)),
- weak_factory_(this) {
+ get_helper_cb_(std::move(get_helper_cb)) {
// May be called from any thread.
}
diff --git a/media/gpu/windows/d3d11_video_decoder_impl.h b/media/gpu/windows/d3d11_video_decoder_impl.h
index 55862eaf..c654926 100644
--- a/media/gpu/windows/d3d11_video_decoder_impl.h
+++ b/media/gpu/windows/d3d11_video_decoder_impl.h
@@ -75,7 +75,7 @@
// Has thread affinity -- must be run on the gpu main thread.
THREAD_CHECKER(thread_checker_);
- base::WeakPtrFactory<D3D11VideoDecoderImpl> weak_factory_;
+ base::WeakPtrFactory<D3D11VideoDecoderImpl> weak_factory_{this};
DISALLOW_COPY_AND_ASSIGN(D3D11VideoDecoderImpl);
};
diff --git a/media/gpu/windows/dxva_video_decode_accelerator_win.cc b/media/gpu/windows/dxva_video_decode_accelerator_win.cc
index 2d470bae..fef3a79c 100644
--- a/media/gpu/windows/dxva_video_decode_accelerator_win.cc
+++ b/media/gpu/windows/dxva_video_decode_accelerator_win.cc
@@ -519,8 +519,7 @@
using_angle_device_(false),
enable_accelerated_vpx_decode_(
!workarounds.disable_accelerated_vpx_decode),
- processing_config_changed_(false),
- weak_this_factory_(this) {
+ processing_config_changed_(false) {
weak_ptr_ = weak_this_factory_.GetWeakPtr();
memset(&input_stream_info_, 0, sizeof(input_stream_info_));
memset(&output_stream_info_, 0, sizeof(output_stream_info_));
diff --git a/media/gpu/windows/dxva_video_decode_accelerator_win.h b/media/gpu/windows/dxva_video_decode_accelerator_win.h
index 43b4150d..b6b41eb3 100644
--- a/media/gpu/windows/dxva_video_decode_accelerator_win.h
+++ b/media/gpu/windows/dxva_video_decode_accelerator_win.h
@@ -582,7 +582,7 @@
VideoColorSpace current_color_space_;
// WeakPtrFactory for posting tasks back to |this|.
- base::WeakPtrFactory<DXVAVideoDecodeAccelerator> weak_this_factory_;
+ base::WeakPtrFactory<DXVAVideoDecodeAccelerator> weak_this_factory_{this};
// Function pointer for the MFCreateDXGIDeviceManager API.
static CreateDXGIDeviceManager create_dxgi_device_manager_;
diff --git a/media/gpu/windows/media_foundation_video_encode_accelerator_win.cc b/media/gpu/windows/media_foundation_video_encode_accelerator_win.cc
index 593a8dc..c042d03 100644
--- a/media/gpu/windows/media_foundation_video_encode_accelerator_win.cc
+++ b/media/gpu/windows/media_foundation_video_encode_accelerator_win.cc
@@ -109,8 +109,7 @@
bool compatible_with_win7)
: compatible_with_win7_(compatible_with_win7),
main_client_task_runner_(base::ThreadTaskRunnerHandle::Get()),
- encoder_thread_("MFEncoderThread"),
- encoder_task_weak_factory_(this) {}
+ encoder_thread_("MFEncoderThread") {}
MediaFoundationVideoEncodeAccelerator::
~MediaFoundationVideoEncodeAccelerator() {
diff --git a/media/gpu/windows/media_foundation_video_encode_accelerator_win.h b/media/gpu/windows/media_foundation_video_encode_accelerator_win.h
index df7052d9..c1a2e6d 100644
--- a/media/gpu/windows/media_foundation_video_encode_accelerator_win.h
+++ b/media/gpu/windows/media_foundation_video_encode_accelerator_win.h
@@ -151,7 +151,7 @@
// Declared last to ensure that all weak pointers are invalidated before
// other destructors run.
base::WeakPtrFactory<MediaFoundationVideoEncodeAccelerator>
- encoder_task_weak_factory_;
+ encoder_task_weak_factory_{this};
DISALLOW_COPY_AND_ASSIGN(MediaFoundationVideoEncodeAccelerator);
};
diff --git a/net/base/network_change_notifier_win.cc b/net/base/network_change_notifier_win.cc
index 2f98580c..2fe3733 100644
--- a/net/base/network_change_notifier_win.cc
+++ b/net/base/network_change_notifier_win.cc
@@ -42,8 +42,7 @@
{base::ThreadPool(), base::MayBlock()})),
last_computed_connection_type_(RecomputeCurrentConnectionType()),
last_announced_offline_(last_computed_connection_type_ ==
- CONNECTION_NONE),
- weak_factory_(this) {
+ CONNECTION_NONE) {
memset(&addr_overlapped_, 0, sizeof addr_overlapped_);
addr_overlapped_.hEvent = WSACreateEvent();
}
diff --git a/net/base/network_change_notifier_win.h b/net/base/network_change_notifier_win.h
index ca8a28e..26a305b 100644
--- a/net/base/network_change_notifier_win.h
+++ b/net/base/network_change_notifier_win.h
@@ -119,7 +119,7 @@
SEQUENCE_CHECKER(sequence_checker_);
// Used for calling WatchForAddressChange again on failure.
- base::WeakPtrFactory<NetworkChangeNotifierWin> weak_factory_;
+ base::WeakPtrFactory<NetworkChangeNotifierWin> weak_factory_{this};
DISALLOW_COPY_AND_ASSIGN(NetworkChangeNotifierWin);
};
diff --git a/net/reporting/reporting_service.cc b/net/reporting/reporting_service.cc
index 197642c..a10ca10 100644
--- a/net/reporting/reporting_service.cc
+++ b/net/reporting/reporting_service.cc
@@ -38,8 +38,7 @@
: context_(std::move(context)),
shut_down_(false),
started_loading_from_store_(false),
- initialized_(false),
- weak_factory_(this) {
+ initialized_(false) {
if (!context_->IsClientDataPersisted())
initialized_ = true;
}
@@ -226,7 +225,7 @@
bool started_loading_from_store_;
bool initialized_;
std::vector<base::OnceClosure> task_backlog_;
- base::WeakPtrFactory<ReportingServiceImpl> weak_factory_;
+ base::WeakPtrFactory<ReportingServiceImpl> weak_factory_{this};
DISALLOW_COPY_AND_ASSIGN(ReportingServiceImpl);
};
diff --git a/net/socket/udp_socket_win.cc b/net/socket/udp_socket_win.cc
index cdcec104..d79302c 100644
--- a/net/socket/udp_socket_win.cc
+++ b/net/socket/udp_socket_win.cc
@@ -256,8 +256,7 @@
read_iobuffer_len_(0),
write_iobuffer_len_(0),
recv_from_address_(nullptr),
- net_log_(NetLogWithSource::Make(net_log, NetLogSourceType::UDP_SOCKET)),
- event_pending_(this) {
+ net_log_(NetLogWithSource::Make(net_log, NetLogSourceType::UDP_SOCKET)) {
EnsureWinsockInit();
net_log_.BeginEventReferencingSource(NetLogEventType::SOCKET_ALIVE, source);
}
@@ -1241,7 +1240,7 @@
return result;
}
DscpManager::DscpManager(QwaveApi* api, SOCKET socket)
- : api_(api), socket_(socket), weak_ptr_factory_(this) {
+ : api_(api), socket_(socket) {
RequestHandle();
}
diff --git a/net/socket/udp_socket_win.h b/net/socket/udp_socket_win.h
index 0d6b448..380ff03 100644
--- a/net/socket/udp_socket_win.h
+++ b/net/socket/udp_socket_win.h
@@ -145,7 +145,7 @@
bool handle_is_initializing_ = false;
// 0 means no flow has been constructed.
QOS_FLOWID flow_id_ = 0;
- base::WeakPtrFactory<DscpManager> weak_ptr_factory_;
+ base::WeakPtrFactory<DscpManager> weak_ptr_factory_{this};
DISALLOW_COPY_AND_ASSIGN(DscpManager);
};
@@ -489,7 +489,7 @@
// Used to prevent null dereferences in OnObjectSignaled, when passing an
// error to both read and write callbacks. Cleared in Close()
- base::WeakPtrFactory<UDPSocketWin> event_pending_;
+ base::WeakPtrFactory<UDPSocketWin> event_pending_{this};
DISALLOW_COPY_AND_ASSIGN(UDPSocketWin);
};
diff --git a/remoting/host/desktop_session_win.cc b/remoting/host/desktop_session_win.cc
index 54c3e7b..2473889 100644
--- a/remoting/host/desktop_session_win.cc
+++ b/remoting/host/desktop_session_win.cc
@@ -210,7 +210,7 @@
// Used to match |rdp_desktop_session_| with the session it is attached to.
std::string terminal_id_;
- base::WeakPtrFactory<RdpSession> weak_factory_;
+ base::WeakPtrFactory<RdpSession> weak_factory_{this};
DISALLOW_COPY_AND_ASSIGN(RdpSession);
};
@@ -244,16 +244,16 @@
LOG(ERROR) << "Failed to inject Secure Attention Sequence.";
}
-RdpSession::RdpSession(
- scoped_refptr<AutoThreadTaskRunner> caller_task_runner,
- scoped_refptr<AutoThreadTaskRunner> io_task_runner,
- DaemonProcess* daemon_process,
- int id,
- WtsTerminalMonitor* monitor)
- : DesktopSessionWin(caller_task_runner, io_task_runner, daemon_process, id,
- monitor),
- weak_factory_(this) {
-}
+RdpSession::RdpSession(scoped_refptr<AutoThreadTaskRunner> caller_task_runner,
+ scoped_refptr<AutoThreadTaskRunner> io_task_runner,
+ DaemonProcess* daemon_process,
+ int id,
+ WtsTerminalMonitor* monitor)
+ : DesktopSessionWin(caller_task_runner,
+ io_task_runner,
+ daemon_process,
+ id,
+ monitor) {}
RdpSession::~RdpSession() {
}
diff --git a/remoting/host/disconnect_window_win.cc b/remoting/host/disconnect_window_win.cc
index dcb4781d..f98e017 100644
--- a/remoting/host/disconnect_window_win.cc
+++ b/remoting/host/disconnect_window_win.cc
@@ -129,7 +129,7 @@
webrtc::DesktopVector mouse_position_;
- base::WeakPtrFactory<DisconnectWindowWin> weak_factory_;
+ base::WeakPtrFactory<DisconnectWindowWin> weak_factory_{this};
DISALLOW_COPY_AND_ASSIGN(DisconnectWindowWin);
};
@@ -164,8 +164,7 @@
DisconnectWindowWin::DisconnectWindowWin()
: border_pen_(
- CreatePen(PS_SOLID, 5, RGB(0.13 * 255, 0.69 * 255, 0.11 * 255))),
- weak_factory_(this) {}
+ CreatePen(PS_SOLID, 5, RGB(0.13 * 255, 0.69 * 255, 0.11 * 255))) {}
DisconnectWindowWin::~DisconnectWindowWin() {
EndDialog();
diff --git a/remoting/host/security_key/security_key_auth_handler_win.cc b/remoting/host/security_key/security_key_auth_handler_win.cc
index 4f89fed7..c27f4c6 100644
--- a/remoting/host/security_key/security_key_auth_handler_win.cc
+++ b/remoting/host/security_key/security_key_auth_handler_win.cc
@@ -104,7 +104,7 @@
// Ensures SecurityKeyAuthHandlerWin methods are called on the same thread.
base::ThreadChecker thread_checker_;
- base::WeakPtrFactory<SecurityKeyAuthHandlerWin> weak_factory_;
+ base::WeakPtrFactory<SecurityKeyAuthHandlerWin> weak_factory_{this};
DISALLOW_COPY_AND_ASSIGN(SecurityKeyAuthHandlerWin);
};
@@ -122,8 +122,7 @@
SecurityKeyAuthHandlerWin::SecurityKeyAuthHandlerWin(
ClientSessionDetails* client_session_details)
: client_session_details_(client_session_details),
- disconnect_timeout_(kInitialRequestTimeout),
- weak_factory_(this) {
+ disconnect_timeout_(kInitialRequestTimeout) {
DCHECK(client_session_details_);
}
diff --git a/remoting/host/win/host_service.cc b/remoting/host/win/host_service.cc
index 41bb7ecc..c60a441 100644
--- a/remoting/host/win/host_service.cc
+++ b/remoting/host/win/host_service.cc
@@ -140,8 +140,7 @@
: run_routine_(&HostService::RunAsService),
service_status_handle_(0),
stopped_event_(base::WaitableEvent::ResetPolicy::MANUAL,
- base::WaitableEvent::InitialState::NOT_SIGNALED),
- weak_factory_(this) {}
+ base::WaitableEvent::InitialState::NOT_SIGNALED) {}
HostService::~HostService() {
}
diff --git a/remoting/host/win/host_service.h b/remoting/host/win/host_service.h
index de3f3a0..9fe7eb560 100644
--- a/remoting/host/win/host_service.h
+++ b/remoting/host/win/host_service.h
@@ -122,7 +122,7 @@
base::WeakPtr<HostService> weak_ptr_;
// Used to post session change notifications and control events.
- base::WeakPtrFactory<HostService> weak_factory_;
+ base::WeakPtrFactory<HostService> weak_factory_{this};
// Singleton.
friend struct base::DefaultSingletonTraits<HostService>;
diff --git a/services/device/generic_sensor/platform_sensor_reader_win.cc b/services/device/generic_sensor/platform_sensor_reader_win.cc
index 1fbf3232..f539c39 100644
--- a/services/device/generic_sensor/platform_sensor_reader_win.cc
+++ b/services/device/generic_sensor/platform_sensor_reader_win.cc
@@ -408,8 +408,7 @@
sensor_active_(false),
client_(nullptr),
sensor_(sensor),
- event_listener_(new EventListener(this)),
- weak_factory_(this) {
+ event_listener_(new EventListener(this)) {
DCHECK(init_params_);
DCHECK(init_params_->reader_func);
DCHECK(sensor_);
diff --git a/services/device/generic_sensor/platform_sensor_reader_win.h b/services/device/generic_sensor/platform_sensor_reader_win.h
index 3864c51..4de4e01 100644
--- a/services/device/generic_sensor/platform_sensor_reader_win.h
+++ b/services/device/generic_sensor/platform_sensor_reader_win.h
@@ -68,7 +68,7 @@
Client* client_;
Microsoft::WRL::ComPtr<ISensor> sensor_;
scoped_refptr<EventListener> event_listener_;
- base::WeakPtrFactory<PlatformSensorReaderWin32> weak_factory_;
+ base::WeakPtrFactory<PlatformSensorReaderWin32> weak_factory_{this};
DISALLOW_COPY_AND_ASSIGN(PlatformSensorReaderWin32);
};
diff --git a/services/device/generic_sensor/platform_sensor_win.cc b/services/device/generic_sensor/platform_sensor_win.cc
index 89dfd746..153a7b4 100644
--- a/services/device/generic_sensor/platform_sensor_win.cc
+++ b/services/device/generic_sensor/platform_sensor_win.cc
@@ -21,8 +21,7 @@
std::unique_ptr<PlatformSensorReaderWinBase> sensor_reader)
: PlatformSensor(type, reading_buffer, provider),
sensor_thread_runner_(sensor_thread_runner),
- sensor_reader_(sensor_reader.release()),
- weak_factory_(this) {
+ sensor_reader_(sensor_reader.release()) {
DCHECK(sensor_reader_);
sensor_reader_->SetClient(this);
}
diff --git a/services/device/generic_sensor/platform_sensor_win.h b/services/device/generic_sensor/platform_sensor_win.h
index 1f44265..d8f7def 100644
--- a/services/device/generic_sensor/platform_sensor_win.h
+++ b/services/device/generic_sensor/platform_sensor_win.h
@@ -52,7 +52,7 @@
private:
scoped_refptr<base::SingleThreadTaskRunner> sensor_thread_runner_;
PlatformSensorReaderWinBase* const sensor_reader_;
- base::WeakPtrFactory<PlatformSensorWin> weak_factory_;
+ base::WeakPtrFactory<PlatformSensorWin> weak_factory_{this};
DISALLOW_COPY_AND_ASSIGN(PlatformSensorWin);
};
diff --git a/services/device/hid/hid_service_win.cc b/services/device/hid/hid_service_win.cc
index 86b717a..7caf1b7 100644
--- a/services/device/hid/hid_service_win.cc
+++ b/services/device/hid/hid_service_win.cc
@@ -35,8 +35,7 @@
: task_runner_(base::SequencedTaskRunnerHandle::Get()),
blocking_task_runner_(
base::CreateSequencedTaskRunner(kBlockingTaskTraits)),
- device_observer_(this),
- weak_factory_(this) {
+ device_observer_(this) {
DeviceMonitorWin* device_monitor =
DeviceMonitorWin::GetForDeviceInterface(GUID_DEVINTERFACE_HID);
if (device_monitor)
diff --git a/services/device/hid/hid_service_win.h b/services/device/hid/hid_service_win.h
index 4732c90..a7e67cd 100644
--- a/services/device/hid/hid_service_win.h
+++ b/services/device/hid/hid_service_win.h
@@ -69,7 +69,7 @@
const scoped_refptr<base::SequencedTaskRunner> task_runner_;
const scoped_refptr<base::SequencedTaskRunner> blocking_task_runner_;
ScopedObserver<DeviceMonitorWin, DeviceMonitorWin::Observer> device_observer_;
- base::WeakPtrFactory<HidServiceWin> weak_factory_;
+ base::WeakPtrFactory<HidServiceWin> weak_factory_{this};
DISALLOW_COPY_AND_ASSIGN(HidServiceWin);
};
diff --git a/services/device/serial/serial_io_handler_win.cc b/services/device/serial/serial_io_handler_win.cc
index 1bdfd88..f4ecd22 100644
--- a/services/device/serial/serial_io_handler_win.cc
+++ b/services/device/serial/serial_io_handler_win.cc
@@ -360,8 +360,7 @@
: SerialIoHandler(port, std::move(ui_thread_task_runner)),
event_mask_(0),
is_comm_pending_(false),
- helper_(nullptr),
- weak_factory_(this) {}
+ helper_(nullptr) {}
SerialIoHandlerWin::~SerialIoHandlerWin() {
ui_thread_task_runner()->DeleteSoon(FROM_HERE, helper_);
diff --git a/services/device/serial/serial_io_handler_win.h b/services/device/serial/serial_io_handler_win.h
index ab7a692..95b4bb8 100644
--- a/services/device/serial/serial_io_handler_win.h
+++ b/services/device/serial/serial_io_handler_win.h
@@ -70,7 +70,7 @@
// The helper lives on the UI thread and holds a weak reference back to the
// handler that owns it.
UiThreadHelper* helper_;
- base::WeakPtrFactory<SerialIoHandlerWin> weak_factory_;
+ base::WeakPtrFactory<SerialIoHandlerWin> weak_factory_{this};
DISALLOW_COPY_AND_ASSIGN(SerialIoHandlerWin);
};
diff --git a/services/device/usb/usb_device_handle_win.cc b/services/device/usb/usb_device_handle_win.cc
index 8ffd894..6e876f2 100644
--- a/services/device/usb/usb_device_handle_win.cc
+++ b/services/device/usb/usb_device_handle_win.cc
@@ -488,8 +488,7 @@
bool composite)
: device_(std::move(device)),
task_runner_(base::SequencedTaskRunnerHandle::Get()),
- blocking_task_runner_(UsbService::CreateBlockingTaskRunner()),
- weak_factory_(this) {
+ blocking_task_runner_(UsbService::CreateBlockingTaskRunner()) {
DCHECK(!composite);
// Windows only supports configuration 1, which therefore must be active.
DCHECK(device_->active_configuration());
@@ -513,8 +512,7 @@
: device_(std::move(device)),
hub_handle_(std::move(handle)),
task_runner_(base::SequencedTaskRunnerHandle::Get()),
- blocking_task_runner_(UsbService::CreateBlockingTaskRunner()),
- weak_factory_(this) {}
+ blocking_task_runner_(UsbService::CreateBlockingTaskRunner()) {}
UsbDeviceHandleWin::~UsbDeviceHandleWin() {}
diff --git a/services/device/usb/usb_device_handle_win.h b/services/device/usb/usb_device_handle_win.h
index 37da15fa..9245aa8 100644
--- a/services/device/usb/usb_device_handle_win.h
+++ b/services/device/usb/usb_device_handle_win.h
@@ -161,7 +161,7 @@
scoped_refptr<base::SequencedTaskRunner> task_runner_;
scoped_refptr<base::SequencedTaskRunner> blocking_task_runner_;
- base::WeakPtrFactory<UsbDeviceHandleWin> weak_factory_;
+ base::WeakPtrFactory<UsbDeviceHandleWin> weak_factory_{this};
DISALLOW_COPY_AND_ASSIGN(UsbDeviceHandleWin);
};
diff --git a/services/device/usb/usb_service_impl.cc b/services/device/usb/usb_service_impl.cc
index 08b6516..907286aa 100644
--- a/services/device/usb/usb_service_impl.cc
+++ b/services/device/usb/usb_service_impl.cc
@@ -219,12 +219,7 @@
} // namespace
UsbServiceImpl::UsbServiceImpl()
- : UsbService(),
- task_runner_(base::SequencedTaskRunnerHandle::Get()),
-#if defined(OS_WIN)
- device_observer_(this),
-#endif
- weak_factory_(this) {
+ : task_runner_(base::SequencedTaskRunnerHandle::Get()) {
weak_self_ = weak_factory_.GetWeakPtr();
base::PostTaskAndReplyWithResult(
FROM_HERE, kBlockingTaskTraits,
diff --git a/services/device/usb/usb_service_impl.h b/services/device/usb/usb_service_impl.h
index 1a9b11f..918be7d 100644
--- a/services/device/usb/usb_service_impl.h
+++ b/services/device/usb/usb_service_impl.h
@@ -121,14 +121,15 @@
std::set<libusb_device*> devices_being_enumerated_;
#if defined(OS_WIN)
- ScopedObserver<DeviceMonitorWin, DeviceMonitorWin::Observer> device_observer_;
+ ScopedObserver<DeviceMonitorWin, DeviceMonitorWin::Observer> device_observer_{
+ this};
#endif // OS_WIN
// This WeakPtr is used to safely post hotplug events back to the thread this
// object lives on.
base::WeakPtr<UsbServiceImpl> weak_self_;
- base::WeakPtrFactory<UsbServiceImpl> weak_factory_;
+ base::WeakPtrFactory<UsbServiceImpl> weak_factory_{this};
DISALLOW_COPY_AND_ASSIGN(UsbServiceImpl);
};
diff --git a/services/device/usb/usb_service_win.cc b/services/device/usb/usb_service_win.cc
index 4f47f16..febfba98 100644
--- a/services/device/usb/usb_service_win.cc
+++ b/services/device/usb/usb_service_win.cc
@@ -293,8 +293,7 @@
: UsbService(),
blocking_task_runner_(CreateBlockingTaskRunner()),
helper_(nullptr, base::OnTaskRunnerDeleter(blocking_task_runner_)),
- device_observer_(this),
- weak_factory_(this) {
+ device_observer_(this) {
DeviceMonitorWin* device_monitor =
DeviceMonitorWin::GetForDeviceInterface(GUID_DEVINTERFACE_USB_DEVICE);
if (device_monitor)
diff --git a/services/device/usb/usb_service_win.h b/services/device/usb/usb_service_win.h
index b6a590ed..dab582f 100644
--- a/services/device/usb/usb_service_win.h
+++ b/services/device/usb/usb_service_win.h
@@ -62,7 +62,7 @@
ScopedObserver<DeviceMonitorWin, DeviceMonitorWin::Observer> device_observer_;
- base::WeakPtrFactory<UsbServiceWin> weak_factory_;
+ base::WeakPtrFactory<UsbServiceWin> weak_factory_{this};
DISALLOW_COPY_AND_ASSIGN(UsbServiceWin);
};
diff --git a/services/shape_detection/face_detection_impl_win.cc b/services/shape_detection/face_detection_impl_win.cc
index 37647f55..389a3cb 100644
--- a/services/shape_detection/face_detection_impl_win.cc
+++ b/services/shape_detection/face_detection_impl_win.cc
@@ -30,8 +30,7 @@
BitmapPixelFormat pixel_format)
: face_detector_(std::move(face_detector)),
bitmap_factory_(std::move(bitmap_factory)),
- pixel_format_(pixel_format),
- weak_factory_(this) {
+ pixel_format_(pixel_format) {
DCHECK(face_detector_);
DCHECK(bitmap_factory_);
}
diff --git a/services/shape_detection/face_detection_impl_win.h b/services/shape_detection/face_detection_impl_win.h
index e98a5058..b86f807 100644
--- a/services/shape_detection/face_detection_impl_win.h
+++ b/services/shape_detection/face_detection_impl_win.h
@@ -64,7 +64,7 @@
DetectCallback detected_face_callback_;
mojo::StrongBindingPtr<mojom::FaceDetection> binding_;
- base::WeakPtrFactory<FaceDetectionImplWin> weak_factory_;
+ base::WeakPtrFactory<FaceDetectionImplWin> weak_factory_{this};
DISALLOW_COPY_AND_ASSIGN(FaceDetectionImplWin);
};
diff --git a/services/shape_detection/face_detection_provider_win.cc b/services/shape_detection/face_detection_provider_win.cc
index 8542a50..343f5ac5 100644
--- a/services/shape_detection/face_detection_provider_win.cc
+++ b/services/shape_detection/face_detection_provider_win.cc
@@ -114,7 +114,7 @@
binding_->PauseIncomingMethodCallProcessing();
}
-FaceDetectionProviderWin::FaceDetectionProviderWin() : weak_factory_(this) {}
+FaceDetectionProviderWin::FaceDetectionProviderWin() {}
FaceDetectionProviderWin::~FaceDetectionProviderWin() = default;
diff --git a/services/shape_detection/face_detection_provider_win.h b/services/shape_detection/face_detection_provider_win.h
index ac9410a..7e71990 100644
--- a/services/shape_detection/face_detection_provider_win.h
+++ b/services/shape_detection/face_detection_provider_win.h
@@ -45,7 +45,7 @@
face_detector);
mojo::StrongBindingPtr<mojom::FaceDetectionProvider> binding_;
- base::WeakPtrFactory<FaceDetectionProviderWin> weak_factory_;
+ base::WeakPtrFactory<FaceDetectionProviderWin> weak_factory_{this};
DISALLOW_COPY_AND_ASSIGN(FaceDetectionProviderWin);
};
diff --git a/services/shape_detection/text_detection_impl_win.cc b/services/shape_detection/text_detection_impl_win.cc
index f86f135..aefc6b3 100644
--- a/services/shape_detection/text_detection_impl_win.cc
+++ b/services/shape_detection/text_detection_impl_win.cc
@@ -128,8 +128,7 @@
ComPtr<IOcrEngine> ocr_engine,
ComPtr<ISoftwareBitmapStatics> bitmap_factory)
: ocr_engine_(std::move(ocr_engine)),
- bitmap_factory_(std::move(bitmap_factory)),
- weak_factory_(this) {
+ bitmap_factory_(std::move(bitmap_factory)) {
DCHECK(ocr_engine_);
DCHECK(bitmap_factory_);
}
diff --git a/services/shape_detection/text_detection_impl_win.h b/services/shape_detection/text_detection_impl_win.h
index 1b67e8d..77e63cb0 100644
--- a/services/shape_detection/text_detection_impl_win.h
+++ b/services/shape_detection/text_detection_impl_win.h
@@ -54,7 +54,7 @@
win_bitmap,
Microsoft::WRL::ComPtr<ABI::Windows::Media::Ocr::IOcrResult> ocr_result);
- base::WeakPtrFactory<TextDetectionImplWin> weak_factory_;
+ base::WeakPtrFactory<TextDetectionImplWin> weak_factory_{this};
DISALLOW_COPY_AND_ASSIGN(TextDetectionImplWin);
};
diff --git a/services/video_capture/video_capture_service_impl.cc b/services/video_capture/video_capture_service_impl.cc
index 57e0dd2..c43c03b1f 100644
--- a/services/video_capture/video_capture_service_impl.cc
+++ b/services/video_capture/video_capture_service_impl.cc
@@ -35,7 +35,7 @@
// the same as the one calling the constructor.
class VideoCaptureServiceImpl::GpuDependenciesContext {
public:
- GpuDependenciesContext() : weak_factory_for_gpu_io_thread_(this) {
+ GpuDependenciesContext() {
gpu_io_task_runner_ = base::CreateSequencedTaskRunner(
{base::ThreadPool(), base::TaskPriority::BEST_EFFORT,
base::MayBlock()});
@@ -82,7 +82,8 @@
mojom::AcceleratorFactoryPtr accelerator_factory_;
#endif // defined(OS_CHROMEOS)
- base::WeakPtrFactory<GpuDependenciesContext> weak_factory_for_gpu_io_thread_;
+ base::WeakPtrFactory<GpuDependenciesContext> weak_factory_for_gpu_io_thread_{
+ this};
};
VideoCaptureServiceImpl::VideoCaptureServiceImpl(
diff --git a/third_party/blink/renderer/modules/mediastream/webmediaplayer_ms_test.cc b/third_party/blink/renderer/modules/mediastream/webmediaplayer_ms_test.cc
index 4c81dd59..8ad00796 100644
--- a/third_party/blink/renderer/modules/mediastream/webmediaplayer_ms_test.cc
+++ b/third_party/blink/renderer/modules/mediastream/webmediaplayer_ms_test.cc
@@ -527,8 +527,7 @@
submitter_(std::make_unique<NiceMock<MockWebVideoFrameSubmitter>>()),
layer_set_(false),
rendering_(false),
- background_rendering_(false),
- weak_factory_(this) {
+ background_rendering_(false) {
surface_layer_bridge_ptr_ = surface_layer_bridge_.get();
submitter_ptr_ = submitter_.get();
}
@@ -653,7 +652,7 @@
bool rendering_;
bool background_rendering_;
- base::WeakPtrFactory<WebMediaPlayerMSTest> weak_factory_;
+ base::WeakPtrFactory<WebMediaPlayerMSTest> weak_factory_{this};
};
void WebMediaPlayerMSTest::InitializeWebMediaPlayerMS() {
diff --git a/ui/base/ime/win/input_method_win_base.cc b/ui/base/ime/win/input_method_win_base.cc
index 9d01493..d88e691 100644
--- a/ui/base/ime/win/input_method_win_base.cc
+++ b/ui/base/ime/win/input_method_win_base.cc
@@ -162,8 +162,7 @@
: InputMethodBase(delegate,
CreateKeyboardController(toplevel_window_handle)),
toplevel_window_handle_(toplevel_window_handle),
- pending_requested_direction_(base::i18n::UNKNOWN_DIRECTION),
- weak_ptr_factory_(this) {}
+ pending_requested_direction_(base::i18n::UNKNOWN_DIRECTION) {}
InputMethodWinBase::~InputMethodWinBase() {}
diff --git a/ui/base/ime/win/input_method_win_base.h b/ui/base/ime/win/input_method_win_base.h
index ed4cddc..139d966d 100644
--- a/ui/base/ime/win/input_method_win_base.h
+++ b/ui/base/ime/win/input_method_win_base.h
@@ -90,7 +90,7 @@
base::i18n::TextDirection pending_requested_direction_;
// Used for making callbacks.
- base::WeakPtrFactory<InputMethodWinBase> weak_ptr_factory_;
+ base::WeakPtrFactory<InputMethodWinBase> weak_ptr_factory_{this};
DISALLOW_COPY_AND_ASSIGN(InputMethodWinBase);
};
diff --git a/ui/base/ime/win/on_screen_keyboard_display_manager_input_pane.cc b/ui/base/ime/win/on_screen_keyboard_display_manager_input_pane.cc
index 83210e7..86414f1 100644
--- a/ui/base/ime/win/on_screen_keyboard_display_manager_input_pane.cc
+++ b/ui/base/ime/win/on_screen_keyboard_display_manager_input_pane.cc
@@ -180,8 +180,7 @@
base::MakeRefCounted<OnScreenKeyboardDisplayManagerInputPane::
VirtualKeyboardInputPane>(
main_task_runner_)),
- is_keyboard_visible_(false),
- weak_factory_(this) {
+ is_keyboard_visible_(false) {
DCHECK_GE(base::win::GetVersion(), base::win::Version::WIN10_RS1);
DCHECK(main_task_runner_->BelongsToCurrentThread());
diff --git a/ui/base/ime/win/on_screen_keyboard_display_manager_input_pane.h b/ui/base/ime/win/on_screen_keyboard_display_manager_input_pane.h
index 5edbb96..c5e4388 100644
--- a/ui/base/ime/win/on_screen_keyboard_display_manager_input_pane.h
+++ b/ui/base/ime/win/on_screen_keyboard_display_manager_input_pane.h
@@ -59,7 +59,8 @@
const scoped_refptr<base::SingleThreadTaskRunner> background_task_runner_;
scoped_refptr<VirtualKeyboardInputPane> virtual_keyboard_input_pane_;
bool is_keyboard_visible_;
- base::WeakPtrFactory<OnScreenKeyboardDisplayManagerInputPane> weak_factory_;
+ base::WeakPtrFactory<OnScreenKeyboardDisplayManagerInputPane> weak_factory_{
+ this};
DISALLOW_COPY_AND_ASSIGN(OnScreenKeyboardDisplayManagerInputPane);
};
diff --git a/ui/base/ime/win/on_screen_keyboard_display_manager_tab_tip.cc b/ui/base/ime/win/on_screen_keyboard_display_manager_tab_tip.cc
index 60fca60..8a464d5 100644
--- a/ui/base/ime/win/on_screen_keyboard_display_manager_tab_tip.cc
+++ b/ui/base/ime/win/on_screen_keyboard_display_manager_tab_tip.cc
@@ -102,7 +102,8 @@
// Should be the last member in the class. Helps ensure that tasks spawned
// by this class instance are canceled when it is destroyed.
- base::WeakPtrFactory<OnScreenKeyboardDetector> keyboard_detector_factory_;
+ base::WeakPtrFactory<OnScreenKeyboardDetector> keyboard_detector_factory_{
+ this};
DISALLOW_COPY_AND_ASSIGN(OnScreenKeyboardDetector);
};
@@ -110,7 +111,7 @@
// OnScreenKeyboardDetector member definitions.
OnScreenKeyboardDetector::OnScreenKeyboardDetector(
OnScreenKeyboardDisplayManagerTabTip* display_manager)
- : display_manager_(display_manager), keyboard_detector_factory_(this) {}
+ : display_manager_(display_manager) {}
OnScreenKeyboardDetector::~OnScreenKeyboardDetector() {}
diff --git a/ui/base/test/ui_controls_internal_win.cc b/ui/base/test/ui_controls_internal_win.cc
index a577845..1ae3950 100644
--- a/ui/base/test/ui_controls_internal_win.cc
+++ b/ui/base/test/ui_controls_internal_win.cc
@@ -127,7 +127,7 @@
// The desired mouse position for a mouse move event.
const gfx::Point expected_mouse_location_;
- base::WeakPtrFactory<InputDispatcher> weak_factory_;
+ base::WeakPtrFactory<InputDispatcher> weak_factory_{this};
DISALLOW_COPY_AND_ASSIGN(InputDispatcher);
};
@@ -171,8 +171,7 @@
UINT system_queue_flag)
: callback_(std::move(callback)),
message_waiting_for_(message_waiting_for),
- system_queue_flag_(system_queue_flag),
- weak_factory_(this) {
+ system_queue_flag_(system_queue_flag) {
InstallHook();
}
@@ -183,8 +182,7 @@
: callback_(std::move(callback)),
message_waiting_for_(message_waiting_for),
system_queue_flag_(system_queue_flag),
- num_keyups_awaited_(num_keyups_awaited),
- weak_factory_(this) {
+ num_keyups_awaited_(num_keyups_awaited) {
DCHECK_EQ(message_waiting_for_, static_cast<WPARAM>(WM_KEYUP));
InstallHook();
}
@@ -196,8 +194,7 @@
: callback_(std::move(callback)),
message_waiting_for_(message_waiting_for),
system_queue_flag_(system_queue_flag),
- expected_mouse_location_(screen_point),
- weak_factory_(this) {
+ expected_mouse_location_(screen_point) {
DCHECK_EQ(message_waiting_for_, static_cast<WPARAM>(WM_MOUSEMOVE));
InstallHook();
}
diff --git a/ui/display/win/color_profile_reader.cc b/ui/display/win/color_profile_reader.cc
index b59d683d..71af8e6 100644
--- a/ui/display/win/color_profile_reader.cc
+++ b/ui/display/win/color_profile_reader.cc
@@ -47,8 +47,7 @@
} // namespace
-ColorProfileReader::ColorProfileReader(Client* client)
- : client_(client), weak_factory_(this) {}
+ColorProfileReader::ColorProfileReader(Client* client) : client_(client) {}
ColorProfileReader::~ColorProfileReader() {}
diff --git a/ui/display/win/color_profile_reader.h b/ui/display/win/color_profile_reader.h
index fa5b8ad..7958ad4 100644
--- a/ui/display/win/color_profile_reader.h
+++ b/ui/display/win/color_profile_reader.h
@@ -63,7 +63,7 @@
bool update_in_flight_ = false;
DeviceToPathMap device_to_path_map_;
std::map<int64_t, gfx::ICCProfile> display_id_to_profile_map_;
- base::WeakPtrFactory<ColorProfileReader> weak_factory_;
+ base::WeakPtrFactory<ColorProfileReader> weak_factory_{this};
};
} // namespace win
diff --git a/ui/gl/direct_composition_surface_win.cc b/ui/gl/direct_composition_surface_win.cc
index 3530702a..af881ea 100644
--- a/ui/gl/direct_composition_surface_win.cc
+++ b/ui/gl/direct_composition_surface_win.cc
@@ -203,8 +203,7 @@
std::make_unique<GLSurfacePresentationHelper>(vsync_provider.get())),
vsync_provider_(std::move(vsync_provider)),
vsync_callback_(std::move(vsync_callback)),
- max_pending_frames_(settings.max_pending_frames),
- weak_factory_(this) {
+ max_pending_frames_(settings.max_pending_frames) {
// Call GetWeakPtr() on main thread before calling on vsync thread so that the
// internal weak reference is initialized in a thread-safe way.
weak_ptr_ = weak_factory_.GetWeakPtr();
diff --git a/ui/gl/direct_composition_surface_win.h b/ui/gl/direct_composition_surface_win.h
index 9a49bfe..e973106f 100644
--- a/ui/gl/direct_composition_surface_win.h
+++ b/ui/gl/direct_composition_surface_win.h
@@ -182,7 +182,7 @@
Microsoft::WRL::ComPtr<IDCompositionDevice2> dcomp_device_;
base::WeakPtr<DirectCompositionSurfaceWin> weak_ptr_;
- base::WeakPtrFactory<DirectCompositionSurfaceWin> weak_factory_;
+ base::WeakPtrFactory<DirectCompositionSurfaceWin> weak_factory_{this};
DISALLOW_COPY_AND_ASSIGN(DirectCompositionSurfaceWin);
};
diff --git a/ui/views/widget/desktop_aura/desktop_drag_drop_client_win.cc b/ui/views/widget/desktop_aura/desktop_drag_drop_client_win.cc
index b2c6b75..984d409 100644
--- a/ui/views/widget/desktop_aura/desktop_drag_drop_client_win.cc
+++ b/ui/views/widget/desktop_aura/desktop_drag_drop_client_win.cc
@@ -14,12 +14,9 @@
namespace views {
-DesktopDragDropClientWin::DesktopDragDropClientWin(
- aura::Window* root_window,
- HWND window)
- : drag_drop_in_progress_(false),
- drag_operation_(0),
- weak_factory_(this) {
+DesktopDragDropClientWin::DesktopDragDropClientWin(aura::Window* root_window,
+ HWND window)
+ : drag_drop_in_progress_(false), drag_operation_(0) {
drop_target_ = new DesktopDropTargetWin(root_window);
drop_target_->Init(window);
}
diff --git a/ui/views/widget/desktop_aura/desktop_drag_drop_client_win.h b/ui/views/widget/desktop_aura/desktop_drag_drop_client_win.h
index 70e5950..9e6208c 100644
--- a/ui/views/widget/desktop_aura/desktop_drag_drop_client_win.h
+++ b/ui/views/widget/desktop_aura/desktop_drag_drop_client_win.h
@@ -56,7 +56,7 @@
scoped_refptr<DesktopDropTargetWin> drop_target_;
- base::WeakPtrFactory<DesktopDragDropClientWin> weak_factory_;
+ base::WeakPtrFactory<DesktopDragDropClientWin> weak_factory_{this};
DISALLOW_COPY_AND_ASSIGN(DesktopDragDropClientWin);
};
diff --git a/ui/views/win/hwnd_message_handler.cc b/ui/views/win/hwnd_message_handler.cc
index 4d134e7..8cde33a 100644
--- a/ui/views/win/hwnd_message_handler.cc
+++ b/ui/views/win/hwnd_message_handler.cc
@@ -452,8 +452,7 @@
pointer_events_for_touch_(::features::IsUsingWMPointerForTouch()),
precision_touchpad_scroll_phase_enabled_(base::FeatureList::IsEnabled(
::features::kPrecisionTouchpadScrollPhase)),
- is_remote_session_(base::win::IsCurrentSessionRemote()),
- autohide_factory_(this) {}
+ is_remote_session_(base::win::IsCurrentSessionRemote()) {}
HWNDMessageHandler::~HWNDMessageHandler() {
DCHECK(delegate_->GetHWNDMessageDelegateInputMethod());
diff --git a/ui/views/win/hwnd_message_handler.h b/ui/views/win/hwnd_message_handler.h
index 8ab9504..d85486a 100644
--- a/ui/views/win/hwnd_message_handler.h
+++ b/ui/views/win/hwnd_message_handler.h
@@ -783,7 +783,7 @@
CR_MSG_MAP_CLASS_DECLARATIONS(HWNDMessageHandler)
// The factory used to lookup appbar autohide edges.
- base::WeakPtrFactory<HWNDMessageHandler> autohide_factory_;
+ base::WeakPtrFactory<HWNDMessageHandler> autohide_factory_{this};
DISALLOW_COPY_AND_ASSIGN(HWNDMessageHandler);
};