Use in-class initializers for base::WeakPtrFactory in components/.

Generated by: https://chromium-review.googlesource.com/c/chromium/src/+/1689216

Bug: 981415
Change-Id: I706ec55f1f533ef616f400791d69a51e9a151da1
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1699508
Commit-Queue: Jeremy Roman <[email protected]>
Reviewed-by: Colin Blundell <[email protected]>
Cr-Commit-Position: refs/heads/master@{#677340}
diff --git a/components/ntp_tiles/custom_links_manager_impl.cc b/components/ntp_tiles/custom_links_manager_impl.cc
index 32b562a3..1783dc3 100644
--- a/components/ntp_tiles/custom_links_manager_impl.cc
+++ b/components/ntp_tiles/custom_links_manager_impl.cc
@@ -20,10 +20,7 @@
 CustomLinksManagerImpl::CustomLinksManagerImpl(
     PrefService* prefs,
     history::HistoryService* history_service)
-    : prefs_(prefs),
-      store_(prefs),
-      history_service_observer_(this),
-      weak_ptr_factory_(this) {
+    : prefs_(prefs), store_(prefs), history_service_observer_(this) {
   DCHECK(prefs);
   if (history_service)
     history_service_observer_.Add(history_service);
diff --git a/components/ntp_tiles/custom_links_manager_impl.h b/components/ntp_tiles/custom_links_manager_impl.h
index c9733036..cdc3d1c3 100644
--- a/components/ntp_tiles/custom_links_manager_impl.h
+++ b/components/ntp_tiles/custom_links_manager_impl.h
@@ -105,7 +105,7 @@
   // ourselves when updating the preferences.
   bool updating_preferences_ = false;
 
-  base::WeakPtrFactory<CustomLinksManagerImpl> weak_ptr_factory_;
+  base::WeakPtrFactory<CustomLinksManagerImpl> weak_ptr_factory_{this};
 
   DISALLOW_COPY_AND_ASSIGN(CustomLinksManagerImpl);
 };
diff --git a/components/ntp_tiles/icon_cacher_impl.cc b/components/ntp_tiles/icon_cacher_impl.cc
index aadc7ddc..48fa6b9 100644
--- a/components/ntp_tiles/icon_cacher_impl.cc
+++ b/components/ntp_tiles/icon_cacher_impl.cc
@@ -80,9 +80,7 @@
     std::unique_ptr<image_fetcher::ImageFetcher> image_fetcher)
     : favicon_service_(favicon_service),
       large_icon_service_(large_icon_service),
-      image_fetcher_(std::move(image_fetcher)),
-      weak_ptr_factory_(this) {
-}
+      image_fetcher_(std::move(image_fetcher)) {}
 
 IconCacherImpl::~IconCacherImpl() = default;
 
diff --git a/components/ntp_tiles/icon_cacher_impl.h b/components/ntp_tiles/icon_cacher_impl.h
index 25d2deb6..930716a 100644
--- a/components/ntp_tiles/icon_cacher_impl.h
+++ b/components/ntp_tiles/icon_cacher_impl.h
@@ -100,7 +100,7 @@
   std::unique_ptr<image_fetcher::ImageFetcher> const image_fetcher_;
   std::map<GURL, std::vector<base::Closure>> in_flight_requests_;
 
-  base::WeakPtrFactory<IconCacherImpl> weak_ptr_factory_;
+  base::WeakPtrFactory<IconCacherImpl> weak_ptr_factory_{this};
 
   DISALLOW_COPY_AND_ASSIGN(IconCacherImpl);
 };
diff --git a/components/ntp_tiles/most_visited_sites.cc b/components/ntp_tiles/most_visited_sites.cc
index e4744670..4a0d141c 100644
--- a/components/ntp_tiles/most_visited_sites.cc
+++ b/components/ntp_tiles/most_visited_sites.cc
@@ -140,8 +140,7 @@
       observer_(nullptr),
       max_num_sites_(0u),
       top_sites_observer_(this),
-      mv_source_(TileSource::TOP_SITES),
-      top_sites_weak_ptr_factory_(this) {
+      mv_source_(TileSource::TOP_SITES) {
   DCHECK(prefs_);
   // top_sites_ can be null in tests.
   // TODO(sfiera): have iOS use a dummy TopSites in its tests.
diff --git a/components/ntp_tiles/most_visited_sites.h b/components/ntp_tiles/most_visited_sites.h
index e2e349e..ade20009 100644
--- a/components/ntp_tiles/most_visited_sites.h
+++ b/components/ntp_tiles/most_visited_sites.h
@@ -384,7 +384,7 @@
 
   // For callbacks may be run after destruction, used exclusively for TopSites
   // (since it's used to detect whether there's a query in flight).
-  base::WeakPtrFactory<MostVisitedSites> top_sites_weak_ptr_factory_;
+  base::WeakPtrFactory<MostVisitedSites> top_sites_weak_ptr_factory_{this};
 
   DISALLOW_COPY_AND_ASSIGN(MostVisitedSites);
 };
diff --git a/components/ntp_tiles/popular_sites_impl.cc b/components/ntp_tiles/popular_sites_impl.cc
index 34eef87..8d17dff3 100644
--- a/components/ntp_tiles/popular_sites_impl.cc
+++ b/components/ntp_tiles/popular_sites_impl.cc
@@ -271,8 +271,7 @@
       is_fallback_(false),
       sections_(
           ParseSites(*prefs->GetList(prefs::kPopularSitesJsonPref),
-                     prefs_->GetInteger(prefs::kPopularSitesVersionPref))),
-      weak_ptr_factory_(this) {}
+                     prefs_->GetInteger(prefs::kPopularSitesVersionPref))) {}
 
 PopularSitesImpl::~PopularSitesImpl() {}
 
diff --git a/components/ntp_tiles/popular_sites_impl.h b/components/ntp_tiles/popular_sites_impl.h
index 5b51e289..9f27c17 100644
--- a/components/ntp_tiles/popular_sites_impl.h
+++ b/components/ntp_tiles/popular_sites_impl.h
@@ -100,7 +100,7 @@
   GURL pending_url_;
   int version_in_pending_url_;
 
-  base::WeakPtrFactory<PopularSitesImpl> weak_ptr_factory_;
+  base::WeakPtrFactory<PopularSitesImpl> weak_ptr_factory_{this};
 
   DISALLOW_COPY_AND_ASSIGN(PopularSitesImpl);
 };
diff --git a/components/ntp_tiles/webui/ntp_tiles_internals_message_handler.cc b/components/ntp_tiles/webui/ntp_tiles_internals_message_handler.cc
index 0ba8feb..e880b200 100644
--- a/components/ntp_tiles/webui/ntp_tiles_internals_message_handler.cc
+++ b/components/ntp_tiles/webui/ntp_tiles_internals_message_handler.cc
@@ -59,8 +59,7 @@
     favicon::FaviconService* favicon_service)
     : favicon_service_(favicon_service),
       client_(nullptr),
-      site_count_(ntp_tiles::kMaxNumMostVisited),
-      weak_ptr_factory_(this) {}
+      site_count_(ntp_tiles::kMaxNumMostVisited) {}
 
 NTPTilesInternalsMessageHandler::~NTPTilesInternalsMessageHandler() = default;
 
diff --git a/components/ntp_tiles/webui/ntp_tiles_internals_message_handler.h b/components/ntp_tiles/webui/ntp_tiles_internals_message_handler.h
index 7f42af2..5a03220 100644
--- a/components/ntp_tiles/webui/ntp_tiles_internals_message_handler.h
+++ b/components/ntp_tiles/webui/ntp_tiles_internals_message_handler.h
@@ -82,7 +82,7 @@
   std::string popular_sites_json_;
 
   base::CancelableTaskTracker cancelable_task_tracker_;
-  base::WeakPtrFactory<NTPTilesInternalsMessageHandler> weak_ptr_factory_;
+  base::WeakPtrFactory<NTPTilesInternalsMessageHandler> weak_ptr_factory_{this};
 
   DISALLOW_COPY_AND_ASSIGN(NTPTilesInternalsMessageHandler);
 };