| 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 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 382 void RecursiveMarkTrackerAsDirty(int64 root_tracker_id, | 385 void RecursiveMarkTrackerAsDirty(int64 root_tracker_id, |
| 383 leveldb::WriteBatch* batch); | 386 leveldb::WriteBatch* batch); |
| 384 bool CanActivateTracker(const FileTracker& tracker); | 387 bool CanActivateTracker(const FileTracker& tracker); |
| 385 bool ShouldKeepDirty(const FileTracker& tracker) const; | 388 bool ShouldKeepDirty(const FileTracker& tracker) const; |
| 386 | 389 |
| 387 bool HasDisabledAppRoot(const FileTracker& tracker) const; | 390 bool HasDisabledAppRoot(const FileTracker& tracker) const; |
| 388 bool HasActiveTrackerForFileID(const std::string& file_id) const; | 391 bool HasActiveTrackerForFileID(const std::string& file_id) const; |
| 389 bool HasActiveTrackerForPath(int64 parent_tracker, | 392 bool HasActiveTrackerForPath(int64 parent_tracker, |
| 390 const std::string& title) const; | 393 const std::string& title) const; |
| 391 | 394 |
| 392 void UpdateByFileMetadata(const tracked_objects::Location& from_where, | |
| 393 scoped_ptr<FileMetadata> file, | |
| 394 leveldb::WriteBatch* batch); | |
| 395 | |
| 396 void WriteToDatabase(scoped_ptr<leveldb::WriteBatch> batch, | 395 void WriteToDatabase(scoped_ptr<leveldb::WriteBatch> batch, |
| 397 const SyncStatusCallback& callback); | 396 const SyncStatusCallback& callback); |
| 398 | 397 |
| 399 bool HasNewerFileMetadata(const std::string& file_id, int64 change_id); | 398 bool HasNewerFileMetadata(const std::string& file_id, int64 change_id); |
| 400 | 399 |
| 401 scoped_refptr<base::SequencedTaskRunner> task_runner_; | 400 scoped_refptr<base::SequencedTaskRunner> task_runner_; |
| 402 scoped_ptr<leveldb::DB> db_; | 401 scoped_ptr<leveldb::DB> db_; |
| 403 | 402 |
| 404 scoped_ptr<ServiceMetadata> service_metadata_; | 403 scoped_ptr<ServiceMetadata> service_metadata_; |
| 405 int64 largest_known_change_id_; | 404 int64 largest_known_change_id_; |
| (...skipping 25 matching lines...) Expand all Loading... |
| 431 | 430 |
| 432 base::WeakPtrFactory<MetadataDatabase> weak_ptr_factory_; | 431 base::WeakPtrFactory<MetadataDatabase> weak_ptr_factory_; |
| 433 | 432 |
| 434 DISALLOW_COPY_AND_ASSIGN(MetadataDatabase); | 433 DISALLOW_COPY_AND_ASSIGN(MetadataDatabase); |
| 435 }; | 434 }; |
| 436 | 435 |
| 437 } // namespace drive_backend | 436 } // namespace drive_backend |
| 438 } // namespace sync_file_system | 437 } // namespace sync_file_system |
| 439 | 438 |
| 440 #endif // CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_BACKEND_METADATA_DATABASE_H_ | 439 #endif // CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_BACKEND_METADATA_DATABASE_H_ |
| OLD | NEW |