| 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_LOCAL_LOCAL_FILE_CHANGE_TRACKER_H_ | 5 #ifndef CHROME_BROWSER_SYNC_FILE_SYSTEM_LOCAL_LOCAL_FILE_CHANGE_TRACKER_H_ |
| 6 #define CHROME_BROWSER_SYNC_FILE_SYSTEM_LOCAL_LOCAL_FILE_CHANGE_TRACKER_H_ | 6 #define CHROME_BROWSER_SYNC_FILE_SYSTEM_LOCAL_LOCAL_FILE_CHANGE_TRACKER_H_ |
| 7 | 7 |
| 8 #include <deque> | 8 #include <deque> |
| 9 #include <map> | 9 #include <map> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 | 22 |
| 23 namespace base { | 23 namespace base { |
| 24 class SequencedTaskRunner; | 24 class SequencedTaskRunner; |
| 25 } | 25 } |
| 26 | 26 |
| 27 namespace fileapi { | 27 namespace fileapi { |
| 28 class FileSystemContext; | 28 class FileSystemContext; |
| 29 class FileSystemURL; | 29 class FileSystemURL; |
| 30 } | 30 } |
| 31 | 31 |
| 32 namespace leveldb { |
| 33 class Env; |
| 34 } |
| 35 |
| 32 namespace sync_file_system { | 36 namespace sync_file_system { |
| 33 | 37 |
| 34 // Tracks local file changes for cloud-backed file systems. | 38 // Tracks local file changes for cloud-backed file systems. |
| 35 // All methods must be called on the file_task_runner given to the constructor. | 39 // All methods must be called on the file_task_runner given to the constructor. |
| 36 // Owned by FileSystemContext. | 40 // Owned by FileSystemContext. |
| 37 class LocalFileChangeTracker | 41 class LocalFileChangeTracker |
| 38 : public fileapi::FileUpdateObserver, | 42 : public fileapi::FileUpdateObserver, |
| 39 public fileapi::FileChangeObserver { | 43 public fileapi::FileChangeObserver { |
| 40 public: | 44 public: |
| 41 // |file_task_runner| must be the one where the observee file operations run. | 45 // |file_task_runner| must be the one where the observee file operations run. |
| 42 // (So that we can make sure DB operations are done before actual update | 46 // (So that we can make sure DB operations are done before actual update |
| 43 // happens) | 47 // happens) |
| 44 LocalFileChangeTracker(const base::FilePath& base_path, | 48 LocalFileChangeTracker(const base::FilePath& base_path, |
| 49 leveldb::Env* env_override, |
| 45 base::SequencedTaskRunner* file_task_runner); | 50 base::SequencedTaskRunner* file_task_runner); |
| 46 virtual ~LocalFileChangeTracker(); | 51 virtual ~LocalFileChangeTracker(); |
| 47 | 52 |
| 48 // FileUpdateObserver overrides. | 53 // FileUpdateObserver overrides. |
| 49 virtual void OnStartUpdate(const fileapi::FileSystemURL& url) OVERRIDE; | 54 virtual void OnStartUpdate(const fileapi::FileSystemURL& url) OVERRIDE; |
| 50 virtual void OnUpdate( | 55 virtual void OnUpdate( |
| 51 const fileapi::FileSystemURL& url, int64 delta) OVERRIDE {} | 56 const fileapi::FileSystemURL& url, int64 delta) OVERRIDE {} |
| 52 virtual void OnEndUpdate(const fileapi::FileSystemURL& url) OVERRIDE; | 57 virtual void OnEndUpdate(const fileapi::FileSystemURL& url) OVERRIDE; |
| 53 | 58 |
| 54 // FileChangeObserver overrides. | 59 // FileChangeObserver overrides. |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 176 // This can be accessed on any threads (with num_changes_lock_). | 181 // This can be accessed on any threads (with num_changes_lock_). |
| 177 int64 num_changes_; | 182 int64 num_changes_; |
| 178 mutable base::Lock num_changes_lock_; | 183 mutable base::Lock num_changes_lock_; |
| 179 | 184 |
| 180 DISALLOW_COPY_AND_ASSIGN(LocalFileChangeTracker); | 185 DISALLOW_COPY_AND_ASSIGN(LocalFileChangeTracker); |
| 181 }; | 186 }; |
| 182 | 187 |
| 183 } // namespace sync_file_system | 188 } // namespace sync_file_system |
| 184 | 189 |
| 185 #endif // CHROME_BROWSER_SYNC_FILE_SYSTEM_LOCAL_LOCAL_FILE_CHANGE_TRACKER_H_ | 190 #endif // CHROME_BROWSER_SYNC_FILE_SYSTEM_LOCAL_LOCAL_FILE_CHANGE_TRACKER_H_ |
| OLD | NEW |