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

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

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_model.cc ('k') | components/bookmarks/browser/bookmark_storage.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/bookmarks/browser/bookmark_storage.h
diff --git a/components/bookmarks/browser/bookmark_storage.h b/components/bookmarks/browser/bookmark_storage.h
index 20728a58ff4439fabb2d6331189782ad87f0a7ec..f7eee8cb5a93a54abec7041b164703e6c71957b8 100644
--- a/components/bookmarks/browser/bookmark_storage.h
+++ b/components/bookmarks/browser/bookmark_storage.h
@@ -11,6 +11,7 @@
#include "base/memory/ref_counted.h"
#include "base/memory/scoped_ptr.h"
#include "base/memory/scoped_vector.h"
+#include "base/memory/weak_ptr.h"
#include "components/bookmarks/browser/bookmark_node.h"
class BookmarkModel;
@@ -133,8 +134,7 @@ class BookmarkLoadDetails {
// as notifying the BookmarkStorage every time the model changes.
//
// Internally BookmarkStorage uses BookmarkCodec to do the actual read/write.
-class BookmarkStorage : public base::ImportantFileWriter::DataSerializer,
- public base::RefCountedThreadSafe<BookmarkStorage> {
+class BookmarkStorage : public base::ImportantFileWriter::DataSerializer {
public:
// Creates a BookmarkStorage for the specified model. The data will be loaded
// from and saved to a location derived from |profile_path|. The IO code will
@@ -142,6 +142,7 @@ class BookmarkStorage : public base::ImportantFileWriter::DataSerializer,
BookmarkStorage(BookmarkModel* model,
const base::FilePath& profile_path,
base::SequencedTaskRunner* sequenced_task_runner);
+ virtual ~BookmarkStorage();
// Loads the bookmarks into the model, notifying the model when done. This
// takes ownership of |details| and send the |OnLoadFinished| callback from
@@ -164,10 +165,6 @@ class BookmarkStorage : public base::ImportantFileWriter::DataSerializer,
virtual bool SerializeData(std::string* output) OVERRIDE;
private:
- friend class base::RefCountedThreadSafe<BookmarkStorage>;
-
- virtual ~BookmarkStorage();
-
// Serializes the data and schedules save using ImportantFileWriter.
// Returns true on successful serialization.
bool SaveNow();
@@ -184,6 +181,8 @@ class BookmarkStorage : public base::ImportantFileWriter::DataSerializer,
// Sequenced task runner where file I/O operations will be performed at.
scoped_refptr<base::SequencedTaskRunner> sequenced_task_runner_;
+ base::WeakPtrFactory<BookmarkStorage> weak_factory_;
+
DISALLOW_COPY_AND_ASSIGN(BookmarkStorage);
};
« no previous file with comments | « components/bookmarks/browser/bookmark_model.cc ('k') | components/bookmarks/browser/bookmark_storage.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698