OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 WEBKIT_FILEAPI_SYNCABLE_LOCAL_FILE_CHANGE_TRACKER_H_ | 5 #ifndef WEBKIT_FILEAPI_SYNCABLE_LOCAL_FILE_CHANGE_TRACKER_H_ |
6 #define WEBKIT_FILEAPI_SYNCABLE_LOCAL_FILE_CHANGE_TRACKER_H_ | 6 #define WEBKIT_FILEAPI_SYNCABLE_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 21 matching lines...) Expand all Loading... |
32 // Tracks local file changes for cloud-backed file systems. | 32 // Tracks local file changes for cloud-backed file systems. |
33 // All methods must be called on the file_task_runner given to the constructor. | 33 // All methods must be called on the file_task_runner given to the constructor. |
34 // Owned by FileSystemContext. | 34 // Owned by FileSystemContext. |
35 class WEBKIT_STORAGE_EXPORT LocalFileChangeTracker | 35 class WEBKIT_STORAGE_EXPORT LocalFileChangeTracker |
36 : public FileUpdateObserver, | 36 : public FileUpdateObserver, |
37 public FileChangeObserver { | 37 public FileChangeObserver { |
38 public: | 38 public: |
39 // |file_task_runner| must be the one where the observee file operations run. | 39 // |file_task_runner| must be the one where the observee file operations run. |
40 // (So that we can make sure DB operations are done before actual update | 40 // (So that we can make sure DB operations are done before actual update |
41 // happens) | 41 // happens) |
42 LocalFileChangeTracker(const FilePath& base_path, | 42 LocalFileChangeTracker(const base::FilePath& base_path, |
43 base::SequencedTaskRunner* file_task_runner); | 43 base::SequencedTaskRunner* file_task_runner); |
44 virtual ~LocalFileChangeTracker(); | 44 virtual ~LocalFileChangeTracker(); |
45 | 45 |
46 // FileUpdateObserver overrides. | 46 // FileUpdateObserver overrides. |
47 virtual void OnStartUpdate(const FileSystemURL& url) OVERRIDE; | 47 virtual void OnStartUpdate(const FileSystemURL& url) OVERRIDE; |
48 virtual void OnUpdate(const FileSystemURL& url, int64 delta) OVERRIDE {} | 48 virtual void OnUpdate(const FileSystemURL& url, int64 delta) OVERRIDE {} |
49 virtual void OnEndUpdate(const FileSystemURL& url) OVERRIDE; | 49 virtual void OnEndUpdate(const FileSystemURL& url) OVERRIDE; |
50 | 50 |
51 // FileChangeObserver overrides. | 51 // FileChangeObserver overrides. |
52 virtual void OnCreateFile(const FileSystemURL& url) OVERRIDE; | 52 virtual void OnCreateFile(const FileSystemURL& url) OVERRIDE; |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
133 // This can be accessed on any threads (with num_changes_lock_). | 133 // This can be accessed on any threads (with num_changes_lock_). |
134 int64 num_changes_; | 134 int64 num_changes_; |
135 mutable base::Lock num_changes_lock_; | 135 mutable base::Lock num_changes_lock_; |
136 | 136 |
137 DISALLOW_COPY_AND_ASSIGN(LocalFileChangeTracker); | 137 DISALLOW_COPY_AND_ASSIGN(LocalFileChangeTracker); |
138 }; | 138 }; |
139 | 139 |
140 } // namespace fileapi | 140 } // namespace fileapi |
141 | 141 |
142 #endif // WEBKIT_FILEAPI_SYNCABLE_LOCAL_FILE_CHANGE_TRACKER_H_ | 142 #endif // WEBKIT_FILEAPI_SYNCABLE_LOCAL_FILE_CHANGE_TRACKER_H_ |
OLD | NEW |