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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 public: | 44 public: |
45 // |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. |
46 // (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 |
47 // happens) | 47 // happens) |
48 LocalFileChangeTracker(const base::FilePath& base_path, | 48 LocalFileChangeTracker(const base::FilePath& base_path, |
49 leveldb::Env* env_override, | 49 leveldb::Env* env_override, |
50 base::SequencedTaskRunner* file_task_runner); | 50 base::SequencedTaskRunner* file_task_runner); |
51 virtual ~LocalFileChangeTracker(); | 51 virtual ~LocalFileChangeTracker(); |
52 | 52 |
53 // FileUpdateObserver overrides. | 53 // FileUpdateObserver overrides. |
54 virtual void OnStartUpdate(const storage::FileSystemURL& url) OVERRIDE; | 54 virtual void OnStartUpdate(const storage::FileSystemURL& url) override; |
55 virtual void OnUpdate(const storage::FileSystemURL& url, | 55 virtual void OnUpdate(const storage::FileSystemURL& url, |
56 int64 delta) OVERRIDE {} | 56 int64 delta) override {} |
57 virtual void OnEndUpdate(const storage::FileSystemURL& url) OVERRIDE; | 57 virtual void OnEndUpdate(const storage::FileSystemURL& url) override; |
58 | 58 |
59 // FileChangeObserver overrides. | 59 // FileChangeObserver overrides. |
60 virtual void OnCreateFile(const storage::FileSystemURL& url) OVERRIDE; | 60 virtual void OnCreateFile(const storage::FileSystemURL& url) override; |
61 virtual void OnCreateFileFrom(const storage::FileSystemURL& url, | 61 virtual void OnCreateFileFrom(const storage::FileSystemURL& url, |
62 const storage::FileSystemURL& src) OVERRIDE; | 62 const storage::FileSystemURL& src) override; |
63 virtual void OnRemoveFile(const storage::FileSystemURL& url) OVERRIDE; | 63 virtual void OnRemoveFile(const storage::FileSystemURL& url) override; |
64 virtual void OnModifyFile(const storage::FileSystemURL& url) OVERRIDE; | 64 virtual void OnModifyFile(const storage::FileSystemURL& url) override; |
65 virtual void OnCreateDirectory(const storage::FileSystemURL& url) OVERRIDE; | 65 virtual void OnCreateDirectory(const storage::FileSystemURL& url) override; |
66 virtual void OnRemoveDirectory(const storage::FileSystemURL& url) OVERRIDE; | 66 virtual void OnRemoveDirectory(const storage::FileSystemURL& url) override; |
67 | 67 |
68 // Retrieves an array of |url| which have more than one pending changes. | 68 // Retrieves an array of |url| which have more than one pending changes. |
69 // If |max_urls| is non-zero (recommended in production code) this | 69 // If |max_urls| is non-zero (recommended in production code) this |
70 // returns URLs up to the number from the ones that have smallest | 70 // returns URLs up to the number from the ones that have smallest |
71 // change_seq numbers (i.e. older changes). | 71 // change_seq numbers (i.e. older changes). |
72 void GetNextChangedURLs(std::deque<storage::FileSystemURL>* urls, | 72 void GetNextChangedURLs(std::deque<storage::FileSystemURL>* urls, |
73 int max_urls); | 73 int max_urls); |
74 | 74 |
75 // Returns all changes recorded for the given |url|. | 75 // Returns all changes recorded for the given |url|. |
76 // Note that this also returns demoted changes. | 76 // Note that this also returns demoted changes. |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
188 // This can be accessed on any threads (with num_changes_lock_). | 188 // This can be accessed on any threads (with num_changes_lock_). |
189 int64 num_changes_; | 189 int64 num_changes_; |
190 mutable base::Lock num_changes_lock_; | 190 mutable base::Lock num_changes_lock_; |
191 | 191 |
192 DISALLOW_COPY_AND_ASSIGN(LocalFileChangeTracker); | 192 DISALLOW_COPY_AND_ASSIGN(LocalFileChangeTracker); |
193 }; | 193 }; |
194 | 194 |
195 } // namespace sync_file_system | 195 } // namespace sync_file_system |
196 | 196 |
197 #endif // CHROME_BROWSER_SYNC_FILE_SYSTEM_LOCAL_LOCAL_FILE_CHANGE_TRACKER_H_ | 197 #endif // CHROME_BROWSER_SYNC_FILE_SYSTEM_LOCAL_LOCAL_FILE_CHANGE_TRACKER_H_ |
OLD | NEW |