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

Unified Diff: components/bookmarks/browser/bookmark_storage.cc

Issue 370323002: Replace refcounting with weak pointers for BookmarkStore. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 5 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
« no previous file with comments | « components/bookmarks/browser/bookmark_storage.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/bookmarks/browser/bookmark_storage.cc
diff --git a/components/bookmarks/browser/bookmark_storage.cc b/components/bookmarks/browser/bookmark_storage.cc
index 0591fb5cef08117aa3879cf45a3f64f03aa37e5f..f2f1f1bc588801387823b30692d5582b82e21c7f 100644
--- a/components/bookmarks/browser/bookmark_storage.cc
+++ b/components/bookmarks/browser/bookmark_storage.cc
@@ -48,7 +48,7 @@ void AddBookmarksToIndex(BookmarkLoadDetails* details,
}
void LoadCallback(const base::FilePath& path,
- BookmarkStorage* storage,
+ const base::WeakPtr<BookmarkStorage>& storage,
BookmarkLoadDetails* details,
base::SequencedTaskRunner* task_runner) {
startup_metric_utils::ScopedSlowStartupUMA
@@ -146,7 +146,8 @@ BookmarkStorage::BookmarkStorage(
base::SequencedTaskRunner* sequenced_task_runner)
: model_(model),
writer_(profile_path.Append(bookmarks::kBookmarksFileName),
- sequenced_task_runner) {
+ sequenced_task_runner),
+ weak_factory_(this) {
sequenced_task_runner_ = sequenced_task_runner;
writer_.set_commit_interval(base::TimeDelta::FromMilliseconds(kSaveDelayMS));
sequenced_task_runner_->PostTask(FROM_HERE,
@@ -167,7 +168,7 @@ void BookmarkStorage::LoadBookmarks(
sequenced_task_runner_->PostTask(FROM_HERE,
base::Bind(&LoadCallback,
writer_.path(),
- make_scoped_refptr(this),
+ weak_factory_.GetWeakPtr(),
details_.get(),
task_runner));
}
« no previous file with comments | « components/bookmarks/browser/bookmark_storage.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698