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

Unified Diff: components/dom_distiller/core/dom_distiller_store.h

Issue 330833002: Extract protobuf database into a new 'leveldb_proto' component (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix test Created 6 years, 6 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/dom_distiller/core/dom_distiller_store.h
diff --git a/components/dom_distiller/core/dom_distiller_store.h b/components/dom_distiller/core/dom_distiller_store.h
index 407e9686fe103b582eaaaeb54d526560acf6760f..7e24f3881afa70e252ff21f095fe3547ca4654cc 100644
--- a/components/dom_distiller/core/dom_distiller_store.h
+++ b/components/dom_distiller/core/dom_distiller_store.h
@@ -12,9 +12,9 @@
#include "base/memory/weak_ptr.h"
#include "base/observer_list.h"
#include "components/dom_distiller/core/article_entry.h"
-#include "components/dom_distiller/core/dom_distiller_database.h"
#include "components/dom_distiller/core/dom_distiller_model.h"
#include "components/dom_distiller/core/dom_distiller_observer.h"
+#include "components/leveldb_proto/proto_database.h"
#include "sync/api/sync_change.h"
#include "sync/api/sync_data.h"
#include "sync/api/sync_error.h"
@@ -76,17 +76,21 @@ class DomDistillerStoreInterface {
class DomDistillerStore : public syncer::SyncableService,
public DomDistillerStoreInterface {
public:
+ typedef std::vector<ArticleEntry> EntryVector;
+
// Creates storage using the given database for local storage. Initializes the
// database with |database_dir|.
- DomDistillerStore(scoped_ptr<DomDistillerDatabaseInterface> database,
- const base::FilePath& database_dir);
+ DomDistillerStore(
+ scoped_ptr<leveldb_proto::ProtoDatabase<ArticleEntry> > database,
+ const base::FilePath& database_dir);
// Creates storage using the given database for local storage. Initializes the
// database with |database_dir|. Also initializes the internal model to
// |initial_model|.
- DomDistillerStore(scoped_ptr<DomDistillerDatabaseInterface> database,
- const std::vector<ArticleEntry>& initial_data,
- const base::FilePath& database_dir);
+ DomDistillerStore(
+ scoped_ptr<leveldb_proto::ProtoDatabase<ArticleEntry> > database,
+ const std::vector<ArticleEntry>& initial_data,
+ const base::FilePath& database_dir);
virtual ~DomDistillerStore();
@@ -104,24 +108,23 @@ class DomDistillerStore : public syncer::SyncableService,
// syncer::SyncableService implementation.
virtual syncer::SyncMergeResult MergeDataAndStartSyncing(
- syncer::ModelType type,
- const syncer::SyncDataList& initial_sync_data,
+ syncer::ModelType type, const syncer::SyncDataList& initial_sync_data,
scoped_ptr<syncer::SyncChangeProcessor> sync_processor,
scoped_ptr<syncer::SyncErrorFactory> error_handler) OVERRIDE;
virtual void StopSyncing(syncer::ModelType type) OVERRIDE;
- virtual syncer::SyncDataList GetAllSyncData(syncer::ModelType type) const
- OVERRIDE;
+ virtual syncer::SyncDataList GetAllSyncData(
+ syncer::ModelType type) const OVERRIDE;
virtual syncer::SyncError ProcessSyncChanges(
const tracked_objects::Location& from_here,
const syncer::SyncChangeList& change_list) OVERRIDE;
+
private:
void OnDatabaseInit(bool success);
void OnDatabaseLoad(bool success, scoped_ptr<EntryVector> entries);
void OnDatabaseSave(bool success);
syncer::SyncMergeResult MergeDataWithModel(
- const syncer::SyncDataList& data,
- syncer::SyncChangeList* changes_applied,
+ const syncer::SyncDataList& data, syncer::SyncChangeList* changes_applied,
syncer::SyncChangeList* changes_missing);
// Convert a SyncDataList to a SyncChangeList of add or update changes based
@@ -145,7 +148,7 @@ class DomDistillerStore : public syncer::SyncableService,
scoped_ptr<syncer::SyncChangeProcessor> sync_processor_;
scoped_ptr<syncer::SyncErrorFactory> error_factory_;
- scoped_ptr<DomDistillerDatabaseInterface> database_;
+ scoped_ptr<leveldb_proto::ProtoDatabase<ArticleEntry> > database_;
bool database_loaded_;
ObserverList<DomDistillerObserver> observers_;
« no previous file with comments | « components/dom_distiller/core/dom_distiller_service_unittest.cc ('k') | components/dom_distiller/core/dom_distiller_store.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698