diff --git a/browser/profiles/brave_bookmark_model_loaded_observer.cc b/browser/profiles/brave_bookmark_model_loaded_observer.cc index aa665d5db77e..4605fb17f6c2 100644 --- a/browser/profiles/brave_bookmark_model_loaded_observer.cc +++ b/browser/profiles/brave_bookmark_model_loaded_observer.cc @@ -18,13 +18,11 @@ using bookmarks::BookmarkModel; BraveBookmarkModelLoadedObserver::BraveBookmarkModelLoadedObserver( Profile* profile) - : BookmarkModelLoadedObserver(profile), profile_(profile) {} + : BookmarkModelLoadedObserver(profile) {} void BraveBookmarkModelLoadedObserver::BookmarkModelLoaded( BookmarkModel* model, bool ids_reassigned) { - // Causes lazy-load if sync is enabled. - ProfileSyncServiceFactory::GetInstance()->GetForProfile(profile_); #if BUILDFLAG(ENABLE_BRAVE_SYNC) BraveProfileSyncServiceImpl* brave_profile_service = static_cast( @@ -36,6 +34,5 @@ void BraveBookmarkModelLoadedObserver::BookmarkModelLoaded( #else BraveMigrateOtherNode(model); #endif - model->RemoveObserver(this); - delete this; + BookmarkModelLoadedObserver::BookmarkModelLoaded(model, ids_reassigned); } diff --git a/browser/profiles/brave_bookmark_model_loaded_observer.h b/browser/profiles/brave_bookmark_model_loaded_observer.h index 271c63da8af0..5ca07110a96d 100644 --- a/browser/profiles/brave_bookmark_model_loaded_observer.h +++ b/browser/profiles/brave_bookmark_model_loaded_observer.h @@ -17,8 +17,6 @@ class BraveBookmarkModelLoadedObserver void BookmarkModelLoaded(bookmarks::BookmarkModel* model, bool ids_reassigned) override; - Profile* profile_; - DISALLOW_COPY_AND_ASSIGN(BraveBookmarkModelLoadedObserver); }; diff --git a/chromium_src/chrome/browser/profiles/bookmark_model_loaded_observer.h b/chromium_src/chrome/browser/profiles/bookmark_model_loaded_observer.h new file mode 100644 index 000000000000..1d5c04388698 --- /dev/null +++ b/chromium_src/chrome/browser/profiles/bookmark_model_loaded_observer.h @@ -0,0 +1,16 @@ +/* Copyright 2019 The Brave Authors. All rights reserved. + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#ifndef BRAVE_CHROMIUM_SRC_CHROME_BROWSER_PROFILES_BOOKMARK_MODEL_LOADED_OBSERVER_H_ +#define BRAVE_CHROMIUM_SRC_CHROME_BROWSER_PROFILES_BOOKMARK_MODEL_LOADED_OBSERVER_H_ + +#define BRAVE_BOOKMARK_MODEL_LOADED_OBSERVER_H_ \ + private: \ + friend class BraveBookmarkModelLoadedObserver; \ + \ + public: +#include "../../../../../chrome/browser/profiles/bookmark_model_loaded_observer.h" + +#endif // BRAVE_CHROMIUM_SRC_CHROME_BROWSER_PROFILES_BOOKMARK_MODEL_LOADED_OBSERVER_H_ diff --git a/patches/chrome-browser-profiles-bookmark_model_loaded_observer.h.patch b/patches/chrome-browser-profiles-bookmark_model_loaded_observer.h.patch new file mode 100644 index 000000000000..b445993d79b2 --- /dev/null +++ b/patches/chrome-browser-profiles-bookmark_model_loaded_observer.h.patch @@ -0,0 +1,12 @@ +diff --git a/chrome/browser/profiles/bookmark_model_loaded_observer.h b/chrome/browser/profiles/bookmark_model_loaded_observer.h +index b4ef0d2aa9e393ace55f65f7aa92153e8dd6069d..7034645e46bf9a0f62173fd7db1b60198ad0f8fb 100644 +--- a/chrome/browser/profiles/bookmark_model_loaded_observer.h ++++ b/chrome/browser/profiles/bookmark_model_loaded_observer.h +@@ -16,6 +16,7 @@ class BookmarkModelLoadedObserver + public: + explicit BookmarkModelLoadedObserver(Profile* profile); + ++ BRAVE_BOOKMARK_MODEL_LOADED_OBSERVER_H_ + private: + void BookmarkModelChanged() override; + void BookmarkModelLoaded(bookmarks::BookmarkModel* model,