| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_H_ | 5 #ifndef CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_BACKEND_METADATA_DATABASE_H_ |
| 6 #define CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_BACKEND_METADATA_DATABASE_H_ | 6 #define CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_BACKEND_METADATA_DATABASE_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <set> | 9 #include <set> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 224 | 224 |
| 225 // Returns false if no registered app exists associated to |app_id|. | 225 // Returns false if no registered app exists associated to |app_id|. |
| 226 // If |full_path| is active, assigns the tracker of |full_path| to |tracker|. | 226 // If |full_path| is active, assigns the tracker of |full_path| to |tracker|. |
| 227 // Otherwise, assigns the nearest active ancestor to |full_path| to |tracker|. | 227 // Otherwise, assigns the nearest active ancestor to |full_path| to |tracker|. |
| 228 // Also, assigns the full path of |tracker| to |path|. | 228 // Also, assigns the full path of |tracker| to |path|. |
| 229 bool FindNearestActiveAncestor(const std::string& app_id, | 229 bool FindNearestActiveAncestor(const std::string& app_id, |
| 230 const base::FilePath& full_path, | 230 const base::FilePath& full_path, |
| 231 FileTracker* tracker, | 231 FileTracker* tracker, |
| 232 base::FilePath* path) const; | 232 base::FilePath* path) const; |
| 233 | 233 |
| 234 void UpdateByFileMetadata(scoped_ptr<FileMetadata> file, |
| 235 leveldb::WriteBatch* batch); |
| 236 |
| 234 // Updates database by |changes|. | 237 // Updates database by |changes|. |
| 235 // Marks each tracker for modified file as dirty and adds new trackers if | 238 // Marks each tracker for modified file as dirty and adds new trackers if |
| 236 // needed. | 239 // needed. |
| 237 void UpdateByChangeList(int64 largest_change_id, | 240 void UpdateByChangeList(int64 largest_change_id, |
| 238 ScopedVector<google_apis::ChangeResource> changes, | 241 ScopedVector<google_apis::ChangeResource> changes, |
| 239 const SyncStatusCallback& callback); | 242 const SyncStatusCallback& callback); |
| 240 | 243 |
| 241 // Updates database by |resource|. | 244 // Updates database by |resource|. |
| 242 // Marks each tracker for modified file as dirty and adds new trackers if | 245 // Marks each tracker for modified file as dirty and adds new trackers if |
| 243 // needed. | 246 // needed. |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 375 void RecursiveMarkTrackerAsDirty(int64 root_tracker_id, | 378 void RecursiveMarkTrackerAsDirty(int64 root_tracker_id, |
| 376 leveldb::WriteBatch* batch); | 379 leveldb::WriteBatch* batch); |
| 377 bool CanActivateTracker(const FileTracker& tracker); | 380 bool CanActivateTracker(const FileTracker& tracker); |
| 378 bool ShouldKeepDirty(const FileTracker& tracker) const; | 381 bool ShouldKeepDirty(const FileTracker& tracker) const; |
| 379 | 382 |
| 380 bool HasDisabledAppRoot(const FileTracker& tracker) const; | 383 bool HasDisabledAppRoot(const FileTracker& tracker) const; |
| 381 bool HasActiveTrackerForFileID(const std::string& file_id) const; | 384 bool HasActiveTrackerForFileID(const std::string& file_id) const; |
| 382 bool HasActiveTrackerForPath(int64 parent_tracker, | 385 bool HasActiveTrackerForPath(int64 parent_tracker, |
| 383 const std::string& title) const; | 386 const std::string& title) const; |
| 384 | 387 |
| 385 void UpdateByFileMetadata(const tracked_objects::Location& from_where, | |
| 386 scoped_ptr<FileMetadata> file, | |
| 387 leveldb::WriteBatch* batch); | |
| 388 | |
| 389 void WriteToDatabase(scoped_ptr<leveldb::WriteBatch> batch, | 388 void WriteToDatabase(scoped_ptr<leveldb::WriteBatch> batch, |
| 390 const SyncStatusCallback& callback); | 389 const SyncStatusCallback& callback); |
| 391 | 390 |
| 392 bool HasNewerFileMetadata(const std::string& file_id, int64 change_id); | 391 bool HasNewerFileMetadata(const std::string& file_id, int64 change_id); |
| 393 | 392 |
| 394 scoped_refptr<base::SequencedTaskRunner> task_runner_; | 393 scoped_refptr<base::SequencedTaskRunner> task_runner_; |
| 395 scoped_ptr<leveldb::DB> db_; | 394 scoped_ptr<leveldb::DB> db_; |
| 396 | 395 |
| 397 scoped_ptr<ServiceMetadata> service_metadata_; | 396 scoped_ptr<ServiceMetadata> service_metadata_; |
| 398 int64 largest_known_change_id_; | 397 int64 largest_known_change_id_; |
| (...skipping 25 matching lines...) Expand all Loading... |
| 424 | 423 |
| 425 base::WeakPtrFactory<MetadataDatabase> weak_ptr_factory_; | 424 base::WeakPtrFactory<MetadataDatabase> weak_ptr_factory_; |
| 426 | 425 |
| 427 DISALLOW_COPY_AND_ASSIGN(MetadataDatabase); | 426 DISALLOW_COPY_AND_ASSIGN(MetadataDatabase); |
| 428 }; | 427 }; |
| 429 | 428 |
| 430 } // namespace drive_backend | 429 } // namespace drive_backend |
| 431 } // namespace sync_file_system | 430 } // namespace sync_file_system |
| 432 | 431 |
| 433 #endif // CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_BACKEND_METADATA_DATABASE_H_ | 432 #endif // CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_BACKEND_METADATA_DATABASE_H_ |
| OLD | NEW |