| 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> |
| 11 #include <vector> | 11 #include <vector> |
| 12 | 12 |
| 13 #include "base/callback_forward.h" | 13 #include "base/callback_forward.h" |
| 14 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
| 15 #include "base/memory/scoped_vector.h" | 15 #include "base/memory/scoped_vector.h" |
| 16 #include "base/memory/weak_ptr.h" | 16 #include "base/memory/weak_ptr.h" |
| 17 #include "base/values.h" |
| 17 #include "chrome/browser/sync_file_system/drive_backend/tracker_set.h" | 18 #include "chrome/browser/sync_file_system/drive_backend/tracker_set.h" |
| 18 #include "chrome/browser/sync_file_system/sync_callbacks.h" | 19 #include "chrome/browser/sync_file_system/sync_callbacks.h" |
| 19 #include "chrome/browser/sync_file_system/sync_status_code.h" | 20 #include "chrome/browser/sync_file_system/sync_status_code.h" |
| 20 | 21 |
| 21 namespace base { | 22 namespace base { |
| 22 class FilePath; | 23 class FilePath; |
| 23 class SequencedTaskRunner; | 24 class SequencedTaskRunner; |
| 24 class SingleThreadTaskRunner; | 25 class SingleThreadTaskRunner; |
| 25 } | 26 } |
| 26 | 27 |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 // The entry point of the MetadataDatabase for production code. | 120 // The entry point of the MetadataDatabase for production code. |
| 120 static void Create(base::SequencedTaskRunner* task_runner, | 121 static void Create(base::SequencedTaskRunner* task_runner, |
| 121 const base::FilePath& database_path, | 122 const base::FilePath& database_path, |
| 122 const CreateCallback& callback); | 123 const CreateCallback& callback); |
| 123 ~MetadataDatabase(); | 124 ~MetadataDatabase(); |
| 124 | 125 |
| 125 int64 GetLargestFetchedChangeID() const; | 126 int64 GetLargestFetchedChangeID() const; |
| 126 int64 GetSyncRootTrackerID() const; | 127 int64 GetSyncRootTrackerID() const; |
| 127 bool HasSyncRoot() const; | 128 bool HasSyncRoot() const; |
| 128 | 129 |
| 130 // Returns all file metadata for the given |app_id|. |
| 131 scoped_ptr<base::ListValue> DumpFiles(const std::string& app_id); |
| 132 |
| 129 // Gets / updates the largest known change ID. | 133 // Gets / updates the largest known change ID. |
| 130 // The largest known change ID is on-memory and not persist over restart. | 134 // The largest known change ID is on-memory and not persist over restart. |
| 131 // This is supposed to use when a task fetches ChangeList in parallel to other | 135 // This is supposed to use when a task fetches ChangeList in parallel to other |
| 132 // operation. When a task starts fetching paged ChangeList one by one, it | 136 // operation. When a task starts fetching paged ChangeList one by one, it |
| 133 // should update the largest known change ID on the first round and background | 137 // should update the largest known change ID on the first round and background |
| 134 // remaining fetch job. | 138 // remaining fetch job. |
| 135 // Then, when other tasks that update FileMetadata by UpdateByFileResource, | 139 // Then, when other tasks that update FileMetadata by UpdateByFileResource, |
| 136 // it should use largest known change ID as the |change_id| that prevents | 140 // it should use largest known change ID as the |change_id| that prevents |
| 137 // FileMetadata from overwritten by ChangeList. | 141 // FileMetadata from overwritten by ChangeList. |
| 138 // Also if other tasks try to update a remote resource whose change is not yet | 142 // Also if other tasks try to update a remote resource whose change is not yet |
| (...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 363 | 367 |
| 364 base::WeakPtrFactory<MetadataDatabase> weak_ptr_factory_; | 368 base::WeakPtrFactory<MetadataDatabase> weak_ptr_factory_; |
| 365 | 369 |
| 366 DISALLOW_COPY_AND_ASSIGN(MetadataDatabase); | 370 DISALLOW_COPY_AND_ASSIGN(MetadataDatabase); |
| 367 }; | 371 }; |
| 368 | 372 |
| 369 } // namespace drive_backend | 373 } // namespace drive_backend |
| 370 } // namespace sync_file_system | 374 } // namespace sync_file_system |
| 371 | 375 |
| 372 #endif // CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_BACKEND_METADATA_DATABASE_H_ | 376 #endif // CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_BACKEND_METADATA_DATABASE_H_ |
| OLD | NEW |