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 WEBKIT_BROWSER_FILEAPI_SYNCABLE_LOCAL_FILE_CHANGE_TRACKER_H_ | 5 #ifndef WEBKIT_BROWSER_FILEAPI_SYNCABLE_LOCAL_FILE_CHANGE_TRACKER_H_ |
6 #define WEBKIT_BROWSER_FILEAPI_SYNCABLE_LOCAL_FILE_CHANGE_TRACKER_H_ | 6 #define WEBKIT_BROWSER_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> |
11 | 11 |
12 #include "base/basictypes.h" | 12 #include "base/basictypes.h" |
13 #include "base/compiler_specific.h" | 13 #include "base/compiler_specific.h" |
14 #include "base/files/file_path.h" | 14 #include "base/files/file_path.h" |
15 #include "base/memory/ref_counted.h" | 15 #include "base/memory/ref_counted.h" |
16 #include "base/memory/scoped_ptr.h" | 16 #include "base/memory/scoped_ptr.h" |
17 #include "base/synchronization/lock.h" | 17 #include "base/synchronization/lock.h" |
18 #include "webkit/browser/fileapi/file_observers.h" | 18 #include "webkit/browser/fileapi/file_observers.h" |
19 #include "webkit/browser/fileapi/file_system_url.h" | 19 #include "webkit/browser/fileapi/file_system_url.h" |
20 #include "webkit/browser/fileapi/syncable/file_change.h" | 20 #include "webkit/browser/fileapi/syncable/file_change.h" |
21 #include "webkit/browser/fileapi/syncable/sync_status_code.h" | 21 #include "webkit/browser/fileapi/syncable/sync_status_code.h" |
22 #include "webkit/storage/webkit_storage_export.h" | 22 #include "webkit/browser/webkit_storage_browser_export.h" |
23 | 23 |
24 namespace base { | 24 namespace base { |
25 class SequencedTaskRunner; | 25 class SequencedTaskRunner; |
26 } | 26 } |
27 | 27 |
28 namespace fileapi { | 28 namespace fileapi { |
29 class FileSystemContext; | 29 class FileSystemContext; |
30 class FileSystemURL; | 30 class FileSystemURL; |
31 } | 31 } |
32 | 32 |
33 namespace sync_file_system { | 33 namespace sync_file_system { |
34 | 34 |
35 // Tracks local file changes for cloud-backed file systems. | 35 // Tracks local file changes for cloud-backed file systems. |
36 // All methods must be called on the file_task_runner given to the constructor. | 36 // All methods must be called on the file_task_runner given to the constructor. |
37 // Owned by FileSystemContext. | 37 // Owned by FileSystemContext. |
38 class WEBKIT_STORAGE_EXPORT LocalFileChangeTracker | 38 class WEBKIT_STORAGE_BROWSER_EXPORT LocalFileChangeTracker |
39 : public fileapi::FileUpdateObserver, | 39 : public fileapi::FileUpdateObserver, |
40 public fileapi::FileChangeObserver { | 40 public fileapi::FileChangeObserver { |
41 public: | 41 public: |
42 // |file_task_runner| must be the one where the observee file operations run. | 42 // |file_task_runner| must be the one where the observee file operations run. |
43 // (So that we can make sure DB operations are done before actual update | 43 // (So that we can make sure DB operations are done before actual update |
44 // happens) | 44 // happens) |
45 LocalFileChangeTracker(const base::FilePath& base_path, | 45 LocalFileChangeTracker(const base::FilePath& base_path, |
46 base::SequencedTaskRunner* file_task_runner); | 46 base::SequencedTaskRunner* file_task_runner); |
47 virtual ~LocalFileChangeTracker(); | 47 virtual ~LocalFileChangeTracker(); |
48 | 48 |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
141 // This can be accessed on any threads (with num_changes_lock_). | 141 // This can be accessed on any threads (with num_changes_lock_). |
142 int64 num_changes_; | 142 int64 num_changes_; |
143 mutable base::Lock num_changes_lock_; | 143 mutable base::Lock num_changes_lock_; |
144 | 144 |
145 DISALLOW_COPY_AND_ASSIGN(LocalFileChangeTracker); | 145 DISALLOW_COPY_AND_ASSIGN(LocalFileChangeTracker); |
146 }; | 146 }; |
147 | 147 |
148 } // namespace sync_file_system | 148 } // namespace sync_file_system |
149 | 149 |
150 #endif // WEBKIT_BROWSER_FILEAPI_SYNCABLE_LOCAL_FILE_CHANGE_TRACKER_H_ | 150 #endif // WEBKIT_BROWSER_FILEAPI_SYNCABLE_LOCAL_FILE_CHANGE_TRACKER_H_ |
OLD | NEW |