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

Unified Diff: components/reading_list/ios/reading_list_model_impl.h

Issue 2764533002: Reading List iOS: Use external clock in ReadingListEntry. (Closed)
Patch Set: jitter Created 3 years, 9 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: components/reading_list/ios/reading_list_model_impl.h
diff --git a/components/reading_list/ios/reading_list_model_impl.h b/components/reading_list/ios/reading_list_model_impl.h
index 59367998b2489ba8d88a375a23e14a0d7c984274..3c1044470c5fe5a3bd97c9aa713a123295bf4f1c 100644
--- a/components/reading_list/ios/reading_list_model_impl.h
+++ b/components/reading_list/ios/reading_list_model_impl.h
@@ -14,6 +14,10 @@
#include "components/reading_list/ios/reading_list_model_storage.h"
#include "components/reading_list/ios/reading_list_store_delegate.h"
+namespace base {
+class Clock;
+}
+
class PrefService;
// Concrete implementation of a reading list model using in memory lists.
@@ -24,12 +28,14 @@ class ReadingListModelImpl : public ReadingListModel,
using ReadingListEntries = std::map<GURL, ReadingListEntry>;
// Initialize a ReadingListModelImpl to load and save data in
- // |persistence_layer|.
+ // |storage_layer|. Passing null to |storage_layer| will create a
+ // ReadingListModelImpl without persistence. Data will not be persistent
+ // across sessions.
+ // |clock| will be used to timestamp all the operations.
ReadingListModelImpl(std::unique_ptr<ReadingListModelStorage> storage_layer,
- PrefService* pref_service);
+ PrefService* pref_service,
+ std::unique_ptr<base::Clock> clock_);
- // Initialize a ReadingListModelImpl without persistence. Data will not be
- // persistent across sessions.
ReadingListModelImpl();
syncer::ModelTypeSyncBridge* GetModelTypeSyncBridge() override;
@@ -73,7 +79,7 @@ class ReadingListModelImpl : public ReadingListModel,
const base::FilePath& distilled_path,
const GURL& distilled_url,
int64_t distillation_size,
- int64_t distillation_date) override;
+ const base::Time& distillation_date) override;
void SyncAddEntry(std::unique_ptr<ReadingListEntry> entry) override;
ReadingListEntry* SyncMergeEntry(
@@ -131,11 +137,15 @@ class ReadingListModelImpl : public ReadingListModel,
// Set the unseen flag to true.
void SetUnseenFlag();
+ // |storage_layer_| depends on |clock_| so keep the order.
+ std::unique_ptr<base::Clock> clock_;
std::unique_ptr<ReadingListModelStorage> storage_layer_;
PrefService* pref_service_;
bool has_unseen_;
bool loaded_;
+
base::WeakPtrFactory<ReadingListModelImpl> weak_ptr_factory_;
+
DISALLOW_COPY_AND_ASSIGN(ReadingListModelImpl);
};
« no previous file with comments | « components/reading_list/ios/reading_list_model.h ('k') | components/reading_list/ios/reading_list_model_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698