| 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 | |
| 237 // Updates database by |changes|. | 234 // Updates database by |changes|. |
| 238 // Marks each tracker for modified file as dirty and adds new trackers if | 235 // Marks each tracker for modified file as dirty and adds new trackers if |
| 239 // needed. | 236 // needed. |
| 240 void UpdateByChangeList(int64 largest_change_id, | 237 void UpdateByChangeList(int64 largest_change_id, |
| 241 ScopedVector<google_apis::ChangeResource> changes, | 238 ScopedVector<google_apis::ChangeResource> changes, |
| 242 const SyncStatusCallback& callback); | 239 const SyncStatusCallback& callback); |
| 243 | 240 |
| 244 // Updates database by |resource|. | 241 // Updates database by |resource|. |
| 245 // Marks each tracker for modified file as dirty and adds new trackers if | 242 // Marks each tracker for modified file as dirty and adds new trackers if |
| 246 // needed. | 243 // needed. |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 378 void RecursiveMarkTrackerAsDirty(int64 root_tracker_id, | 375 void RecursiveMarkTrackerAsDirty(int64 root_tracker_id, |
| 379 leveldb::WriteBatch* batch); | 376 leveldb::WriteBatch* batch); |
| 380 bool CanActivateTracker(const FileTracker& tracker); | 377 bool CanActivateTracker(const FileTracker& tracker); |
| 381 bool ShouldKeepDirty(const FileTracker& tracker) const; | 378 bool ShouldKeepDirty(const FileTracker& tracker) const; |
| 382 | 379 |
| 383 bool HasDisabledAppRoot(const FileTracker& tracker) const; | 380 bool HasDisabledAppRoot(const FileTracker& tracker) const; |
| 384 bool HasActiveTrackerForFileID(const std::string& file_id) const; | 381 bool HasActiveTrackerForFileID(const std::string& file_id) const; |
| 385 bool HasActiveTrackerForPath(int64 parent_tracker, | 382 bool HasActiveTrackerForPath(int64 parent_tracker, |
| 386 const std::string& title) const; | 383 const std::string& title) const; |
| 387 | 384 |
| 385 void UpdateByFileMetadata(const tracked_objects::Location& from_where, |
| 386 scoped_ptr<FileMetadata> file, |
| 387 leveldb::WriteBatch* batch); |
| 388 |
| 388 void WriteToDatabase(scoped_ptr<leveldb::WriteBatch> batch, | 389 void WriteToDatabase(scoped_ptr<leveldb::WriteBatch> batch, |
| 389 const SyncStatusCallback& callback); | 390 const SyncStatusCallback& callback); |
| 390 | 391 |
| 391 bool HasNewerFileMetadata(const std::string& file_id, int64 change_id); | 392 bool HasNewerFileMetadata(const std::string& file_id, int64 change_id); |
| 392 | 393 |
| 393 scoped_refptr<base::SequencedTaskRunner> task_runner_; | 394 scoped_refptr<base::SequencedTaskRunner> task_runner_; |
| 394 scoped_ptr<leveldb::DB> db_; | 395 scoped_ptr<leveldb::DB> db_; |
| 395 | 396 |
| 396 scoped_ptr<ServiceMetadata> service_metadata_; | 397 scoped_ptr<ServiceMetadata> service_metadata_; |
| 397 int64 largest_known_change_id_; | 398 int64 largest_known_change_id_; |
| (...skipping 25 matching lines...) Expand all Loading... |
| 423 | 424 |
| 424 base::WeakPtrFactory<MetadataDatabase> weak_ptr_factory_; | 425 base::WeakPtrFactory<MetadataDatabase> weak_ptr_factory_; |
| 425 | 426 |
| 426 DISALLOW_COPY_AND_ASSIGN(MetadataDatabase); | 427 DISALLOW_COPY_AND_ASSIGN(MetadataDatabase); |
| 427 }; | 428 }; |
| 428 | 429 |
| 429 } // namespace drive_backend | 430 } // namespace drive_backend |
| 430 } // namespace sync_file_system | 431 } // namespace sync_file_system |
| 431 | 432 |
| 432 #endif // CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_BACKEND_METADATA_DATABASE_H_ | 433 #endif // CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_BACKEND_METADATA_DATABASE_H_ |
| OLD | NEW |