Chromium Code Reviews| Index: chrome/browser/sync_file_system/drive_backend/metadata_database_index.h |
| diff --git a/chrome/browser/sync_file_system/drive_backend/metadata_database_index.h b/chrome/browser/sync_file_system/drive_backend/metadata_database_index.h |
| index c14cc3cab945e6e8ded8dce1c1ad86a937bc99d1..7571e028562f55dcdc16f7527bf7faa7631f148d 100644 |
| --- a/chrome/browser/sync_file_system/drive_backend/metadata_database_index.h |
| +++ b/chrome/browser/sync_file_system/drive_backend/metadata_database_index.h |
| @@ -13,41 +13,7 @@ |
| #include "base/containers/hash_tables.h" |
| #include "base/containers/scoped_ptr_hash_map.h" |
| #include "chrome/browser/sync_file_system/drive_backend/metadata_database.h" |
|
tzik
2014/06/20 03:57:47
Not sure but can we remove metadata_database.h #in
peria
2014/06/20 04:44:22
Done.
|
| - |
| -namespace sync_file_system { |
| -namespace drive_backend { |
| - |
| -struct ParentIDAndTitle { |
| - int64 parent_id; |
| - std::string title; |
| - |
| - ParentIDAndTitle(); |
| - ParentIDAndTitle(int64 parent_id, const std::string& title); |
| -}; |
| - |
| -bool operator==(const ParentIDAndTitle& left, const ParentIDAndTitle& right); |
| -bool operator<(const ParentIDAndTitle& left, const ParentIDAndTitle& right); |
| - |
| -} // namespace drive_backend |
| -} // namespace sync_file_system |
| - |
| -namespace BASE_HASH_NAMESPACE { |
| - |
| -#if defined(COMPILER_GCC) |
| -template<> struct hash<sync_file_system::drive_backend::ParentIDAndTitle> { |
| - std::size_t operator()( |
| - const sync_file_system::drive_backend::ParentIDAndTitle& v) const { |
| - return base::HashInts64(v.parent_id, hash<std::string>()(v.title)); |
| - } |
| -}; |
| -#elif defined(COMPILER_MSVC) |
| -inline size_t hash_value( |
| - const sync_file_system::drive_backend::ParentIDAndTitle& v) { |
| - return base::HashInts64(v.parent_id, hash_value(v.title)); |
| -} |
| -#endif // COMPILER |
| - |
| -} // namespace BASE_HASH_NAMESPACE |
| +#include "chrome/browser/sync_file_system/drive_backend/metadata_database_index_interface.h" |
| namespace sync_file_system { |
| namespace drive_backend { |
| @@ -56,74 +22,77 @@ class FileMetadata; |
| class FileTracker; |
| struct DatabaseContents; |
| -// Maintains indexes of MetadataDatabase. This class doesn't modify database |
| -// entries on memory nor on disk. |
| -class MetadataDatabaseIndex { |
| +// Maintains indexes of MetadataDatabase on memory |
|
tzik
2014/06/20 03:57:47
please add '.' to the EOL here.
peria
2014/06/20 04:44:22
Done.
|
| +class MetadataDatabaseIndex : public MetadataDatabaseIndexInterface { |
| public: |
| explicit MetadataDatabaseIndex(DatabaseContents* content); |
| - ~MetadataDatabaseIndex(); |
| + virtual ~MetadataDatabaseIndex(); |
| // Returns FileMetadata identified by |file_id| if exists, otherwise returns |
| // NULL. |
|
tzik
2014/06/20 03:57:47
Could you remove these comments for overridden fun
peria
2014/06/20 04:44:22
Done.
|
| - const FileMetadata* GetFileMetadata(const std::string& file_id) const; |
| + virtual const FileMetadata* GetFileMetadata( |
| + const std::string& file_id) const OVERRIDE; |
| // Returns FileTracker identified by |tracker_id| if exists, otherwise returns |
| // NULL. |
| - const FileTracker* GetFileTracker(int64 tracker_id) const; |
| + virtual const FileTracker* GetFileTracker(int64 tracker_id) const OVERRIDE; |
| // Stores |metadata| and updates indexes. |
| // This overwrites existing FileMetadata for the same |file_id|. |
| - void StoreFileMetadata(scoped_ptr<FileMetadata> metadata); |
| + virtual void StoreFileMetadata(scoped_ptr<FileMetadata> metadata) OVERRIDE; |
| // Stores |tracker| and updates indexes. |
| // This overwrites existing FileTracker for the same |tracker_id|. |
| - void StoreFileTracker(scoped_ptr<FileTracker> tracker); |
| + virtual void StoreFileTracker(scoped_ptr<FileTracker> tracker) OVERRIDE; |
| // Removes FileMetadata identified by |file_id| from indexes. |
| - void RemoveFileMetadata(const std::string& file_id); |
| + virtual void RemoveFileMetadata(const std::string& file_id) OVERRIDE; |
| // Removes FileTracker identified by |tracker_id| from indexes. |
| - void RemoveFileTracker(int64 tracker_id); |
| + virtual void RemoveFileTracker(int64 tracker_id) OVERRIDE; |
| // Returns a set of FileTracker that have |file_id| as its own. |
| - TrackerIDSet GetFileTrackerIDsByFileID(const std::string& file_id) const; |
| + virtual TrackerIDSet GetFileTrackerIDsByFileID( |
| + const std::string& file_id) const OVERRIDE; |
| // Returns an app-root tracker identified by |app_id|. Returns 0 if not |
| // found. |
| - int64 GetAppRootTracker(const std::string& app_id) const; |
| + virtual int64 GetAppRootTracker(const std::string& app_id) const OVERRIDE; |
| // Returns a set of FileTracker that have |parent_tracker_id| and |title|. |
| - TrackerIDSet GetFileTrackerIDsByParentAndTitle( |
| + virtual TrackerIDSet GetFileTrackerIDsByParentAndTitle( |
| int64 parent_tracker_id, |
| - const std::string& title) const; |
| + const std::string& title) const OVERRIDE; |
| - std::vector<int64> GetFileTrackerIDsByParent(int64 parent_tracker_id) const; |
| + virtual std::vector<int64> GetFileTrackerIDsByParent( |
| + int64 parent_tracker_id) const OVERRIDE; |
| // Returns the |file_id| of a file that has multiple trackers. |
| - std::string PickMultiTrackerFileID() const; |
| + virtual std::string PickMultiTrackerFileID() const OVERRIDE; |
| // Returns a pair of |parent_tracker_id| and |title| that has multiple file |
| // at the path. |
| - ParentIDAndTitle PickMultiBackingFilePath() const; |
| + virtual ParentIDAndTitle PickMultiBackingFilePath() const OVERRIDE; |
| // Returns a FileTracker whose |dirty| is set and which isn't demoted. |
| // Returns 0 if not found. |
| - int64 PickDirtyTracker() const; |
| + virtual int64 PickDirtyTracker() const OVERRIDE; |
| // Demotes a dirty tracker. |
| - void DemoteDirtyTracker(int64 tracker_id); |
| + virtual void DemoteDirtyTracker(int64 tracker_id) OVERRIDE; |
| - bool HasDemotedDirtyTracker() const; |
| + virtual bool HasDemotedDirtyTracker() const OVERRIDE; |
| // Promotes all demoted dirty trackers to normal dirty trackers. |
| - void PromoteDemotedDirtyTrackers(); |
| - |
| - size_t CountDirtyTracker() const; |
| - size_t CountFileMetadata() const; |
| - size_t CountFileTracker() const; |
| - std::vector<std::string> GetRegisteredAppIDs() const; |
| - std::vector<int64> GetAllTrackerIDs() const; |
| - std::vector<std::string> GetAllMetadataIDs() const; |
| + virtual void PromoteDemotedDirtyTrackers() OVERRIDE; |
| + |
| + virtual size_t CountDirtyTracker() const OVERRIDE; |
| + virtual size_t CountFileMetadata() const OVERRIDE; |
| + virtual size_t CountFileTracker() const OVERRIDE; |
| + |
| + virtual std::vector<std::string> GetRegisteredAppIDs() const OVERRIDE; |
| + virtual std::vector<int64> GetAllTrackerIDs() const OVERRIDE; |
| + virtual std::vector<std::string> GetAllMetadataIDs() const OVERRIDE; |
| private: |
| typedef base::ScopedPtrHashMap<std::string, FileMetadata> MetadataByID; |