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

Side by Side Diff: chrome/browser/sync_file_system/drive_backend/metadata_database_index.h

Issue 187203004: [SyncFS] Improve debug logs of MetadataDatabaseIndex (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_BACKEND_METADATA_DATABASE_INDEX_H_ 5 #ifndef CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_BACKEND_METADATA_DATABASE_INDEX_H_
6 #define CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_BACKEND_METADATA_DATABASE_INDEX_H_ 6 #define CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_BACKEND_METADATA_DATABASE_INDEX_H_
7 7
8 #include "base/containers/hash_tables.h" 8 #include "base/containers/hash_tables.h"
9 #include "base/containers/scoped_ptr_hash_map.h" 9 #include "base/containers/scoped_ptr_hash_map.h"
10 #include "chrome/browser/sync_file_system/drive_backend/metadata_database.h" 10 #include "chrome/browser/sync_file_system/drive_backend/metadata_database.h"
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 85
86 // Returns an app-root tracker identified by |app_id|. Returns 0 if not 86 // Returns an app-root tracker identified by |app_id|. Returns 0 if not
87 // found. 87 // found.
88 int64 GetAppRootTracker(const std::string& app_id) const; 88 int64 GetAppRootTracker(const std::string& app_id) const;
89 89
90 // Returns a set of FileTracker that have |parent_tracker_id| and |title|. 90 // Returns a set of FileTracker that have |parent_tracker_id| and |title|.
91 TrackerIDSet GetFileTrackerIDsByParentAndTitle( 91 TrackerIDSet GetFileTrackerIDsByParentAndTitle(
92 int64 parent_tracker_id, 92 int64 parent_tracker_id,
93 const std::string& title) const; 93 const std::string& title) const;
94 94
95 std::vector<int64> GetFileTrackerIDsByParent(int64 parent_tracker_id) const;
96
95 // Returns the |file_id| of a file that has multiple trackers. 97 // Returns the |file_id| of a file that has multiple trackers.
96 std::string PickMultiTrackerFileID() const; 98 std::string PickMultiTrackerFileID() const;
97 99
98 // Returns a pair of |parent_tracker_id| and |title| that has multiple file 100 // Returns a pair of |parent_tracker_id| and |title| that has multiple file
99 // at the path. 101 // at the path.
100 ParentIDAndTitle PickMultiBackingFilePath() const; 102 ParentIDAndTitle PickMultiBackingFilePath() const;
101 103
102 // Returns a FileTracker whose |dirty| is set and which isn't demoted. 104 // Returns a FileTracker whose |dirty| is set and which isn't demoted.
103 // Returns 0 if not found. 105 // Returns 0 if not found.
104 int64 PickDirtyTracker() const; 106 int64 PickDirtyTracker() const;
105 107
106 // Demotes a dirty tracker. 108 // Demotes a dirty tracker.
107 void DemoteDirtyTracker(int64 tracker_id); 109 void DemoteDirtyTracker(int64 tracker_id);
108 110
111 bool HasDemotedDirtyTracker() const;
112
109 // Promotes all demoted dirty trackers to normal dirty trackers. 113 // Promotes all demoted dirty trackers to normal dirty trackers.
110 void PromoteDemotedDirtyTrackers(); 114 void PromoteDemotedDirtyTrackers();
111 115
116 std::vector<std::string> GetRegisteredAppIDs() const;
117
112 private: 118 private:
113 typedef base::ScopedPtrHashMap<std::string, FileMetadata> MetadataByID; 119 typedef base::ScopedPtrHashMap<std::string, FileMetadata> MetadataByID;
114 typedef base::ScopedPtrHashMap<int64, FileTracker> TrackerByID; 120 typedef base::ScopedPtrHashMap<int64, FileTracker> TrackerByID;
115 typedef base::hash_map<std::string, TrackerIDSet> TrackerIDsByFileID; 121 typedef base::hash_map<std::string, TrackerIDSet> TrackerIDsByFileID;
116 typedef base::hash_map<std::string, TrackerIDSet> TrackerIDsByTitle; 122 typedef base::hash_map<std::string, TrackerIDSet> TrackerIDsByTitle;
117 typedef std::map<int64, TrackerIDsByTitle> TrackerIDsByParentAndTitle; 123 typedef std::map<int64, TrackerIDsByTitle> TrackerIDsByParentAndTitle;
118 typedef base::hash_map<std::string, int64> TrackerIDByAppID; 124 typedef base::hash_map<std::string, int64> TrackerIDByAppID;
119 typedef base::hash_set<std::string> FileIDSet; 125 typedef base::hash_set<std::string> FileIDSet;
120 typedef base::hash_set<ParentIDAndTitle> PathSet; 126 typedef base::hash_set<ParentIDAndTitle> PathSet;
121 typedef std::set<int64> DirtyTrackers; 127 typedef std::set<int64> DirtyTrackers;
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 DirtyTrackers dirty_trackers_; 166 DirtyTrackers dirty_trackers_;
161 DirtyTrackers demoted_dirty_trackers_; 167 DirtyTrackers demoted_dirty_trackers_;
162 168
163 DISALLOW_COPY_AND_ASSIGN(MetadataDatabaseIndex); 169 DISALLOW_COPY_AND_ASSIGN(MetadataDatabaseIndex);
164 }; 170 };
165 171
166 } // namespace drive_backend 172 } // namespace drive_backend
167 } // namespace sync_file_system 173 } // namespace sync_file_system
168 174
169 #endif // CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_BACKEND_METADATA_DATABASE_INDEX _H_ 175 #endif // CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_BACKEND_METADATA_DATABASE_INDEX _H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698