Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(37)

Unified Diff: ios/chrome/app/spotlight/topsites_spotlight_manager.mm

Issue 2883323002: [ios] Fix clean shutdown of Chrome on iOS. (Closed)
Patch Set: Rebase on origin/master. Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: ios/chrome/app/spotlight/topsites_spotlight_manager.mm
diff --git a/ios/chrome/app/spotlight/topsites_spotlight_manager.mm b/ios/chrome/app/spotlight/topsites_spotlight_manager.mm
index 5d100debec9b7ef6ed517e5713b60aaef2253b33..69d597a471c1e16694c106e1f16d614e70e4a76a 100644
--- a/ios/chrome/app/spotlight/topsites_spotlight_manager.mm
+++ b/ios/chrome/app/spotlight/topsites_spotlight_manager.mm
@@ -93,7 +93,7 @@ class SpotlightTopSitesCallbackBridge
explicit SpotlightTopSitesCallbackBridge(TopSitesSpotlightManager* owner)
: owner_(owner) {}
- SpotlightTopSitesCallbackBridge() {}
+ ~SpotlightTopSitesCallbackBridge() {}
void OnMostVisitedURLsAvailable(const history::MostVisitedURLList& data) {
[owner_ onMostVisitedURLsAvailable:data];
@@ -105,13 +105,15 @@ class SpotlightTopSitesCallbackBridge
class SpotlightTopSitesBridge : public history::TopSitesObserver {
public:
- explicit SpotlightTopSitesBridge(TopSitesSpotlightManager* owner)
- : owner_(owner) {
- owner.topSites->AddObserver(this);
+ SpotlightTopSitesBridge(TopSitesSpotlightManager* owner,
+ history::TopSites* top_sites)
+ : owner_(owner), top_sites_(top_sites) {
+ top_sites->AddObserver(this);
};
~SpotlightTopSitesBridge() override {
- owner_.topSites->RemoveObserver(this);
+ top_sites_->RemoveObserver(this);
+ top_sites_ = nullptr;
};
void TopSitesLoaded(history::TopSites* top_sites) override {}
@@ -123,6 +125,7 @@ class SpotlightTopSitesBridge : public history::TopSitesObserver {
private:
__weak TopSitesSpotlightManager* owner_;
+ history::TopSites* top_sites_;
};
class SpotlightSuggestionsBridge
@@ -131,7 +134,7 @@ class SpotlightSuggestionsBridge
explicit SpotlightSuggestionsBridge(TopSitesSpotlightManager* owner)
: owner_(owner) {}
- SpotlightSuggestionsBridge() {}
+ ~SpotlightSuggestionsBridge() {}
void OnSuggestionsProfileAvailable(
const suggestions::SuggestionsProfile& suggestions_profile) {
@@ -170,7 +173,7 @@ initWithLargeIconService:(favicon::LargeIconService*)largeIconService
domain:spotlight::DOMAIN_TOPSITES];
if (self) {
_topSites = topSites;
- _topSitesBridge.reset(new SpotlightTopSitesBridge(self));
+ _topSitesBridge.reset(new SpotlightTopSitesBridge(self, _topSites.get()));
_topSitesCallbackBridge.reset(new SpotlightTopSitesCallbackBridge(self));
_bookmarkModel = bookmarkModel;
_isReindexPending = false;
« no previous file with comments | « ios/chrome/app/main_controller.mm ('k') | ios/chrome/browser/ui/toolbar/tools_menu_button_observer_bridge.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698