Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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_CHROMEOS_ARC_FILEAPI_ARC_DOCUMENTS_PROVIDER_ROOT_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_ARC_FILEAPI_ARC_DOCUMENTS_PROVIDER_ROOT_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_ARC_FILEAPI_ARC_DOCUMENTS_PROVIDER_ROOT_H_ | 6 #define CHROME_BROWSER_CHROMEOS_ARC_FILEAPI_ARC_DOCUMENTS_PROVIDER_ROOT_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <map> | 10 #include <map> |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 138 mojom::DocumentPtr document); | 138 mojom::DocumentPtr document); |
| 139 | 139 |
| 140 void ReadDirectoryWithDocumentId(const ReadDirectoryCallback& callback, | 140 void ReadDirectoryWithDocumentId(const ReadDirectoryCallback& callback, |
| 141 const std::string& document_id); | 141 const std::string& document_id); |
| 142 void ReadDirectoryWithNameToThinDocumentMap( | 142 void ReadDirectoryWithNameToThinDocumentMap( |
| 143 const ReadDirectoryCallback& callback, | 143 const ReadDirectoryCallback& callback, |
| 144 base::File::Error error, | 144 base::File::Error error, |
| 145 NameToThinDocumentMap mapping); | 145 NameToThinDocumentMap mapping); |
| 146 | 146 |
| 147 void AddWatcherWithDocumentId(const base::FilePath& path, | 147 void AddWatcherWithDocumentId(const base::FilePath& path, |
| 148 uint64_t watcher_request_id, | |
| 148 const WatcherCallback& watcher_callback, | 149 const WatcherCallback& watcher_callback, |
| 149 const StatusCallback& callback, | |
| 150 const std::string& document_id); | 150 const std::string& document_id); |
| 151 void OnWatcherAdded(const base::FilePath& path, | 151 void OnWatcherAdded(const base::FilePath& path, |
| 152 const StatusCallback& callback, | 152 uint64_t watcher_request_id, |
| 153 int64_t watcher_id); | 153 int64_t watcher_id); |
| 154 void OnWatcherAddedButRemoved(const StatusCallback& callback, bool success); | 154 void OnWatcherAddedButRemoved(bool success); |
| 155 | 155 |
| 156 void OnWatcherRemoved(const StatusCallback& callback, bool success); | 156 void OnWatcherRemoved(const StatusCallback& callback, bool success); |
| 157 | 157 |
| 158 bool IsWatcherRequestCanceled(const base::FilePath& path, | |
|
hidehiko
2017/03/10 15:16:02
"const" is missing. Could you write the document o
Shuhei Takahashi
2017/03/14 05:42:47
Done.
| |
| 159 uint64_t watcher_request_id); | |
| 160 | |
| 158 void ResolveToContentUrlWithDocumentId( | 161 void ResolveToContentUrlWithDocumentId( |
| 159 const ResolveToContentUrlCallback& callback, | 162 const ResolveToContentUrlCallback& callback, |
| 160 const std::string& document_id); | 163 const std::string& document_id); |
| 161 | 164 |
| 162 // Resolves |path| to a document ID. Failures are indicated by an empty | 165 // Resolves |path| to a document ID. Failures are indicated by an empty |
| 163 // document ID. | 166 // document ID. |
| 164 void ResolveToDocumentId(const base::FilePath& path, | 167 void ResolveToDocumentId(const base::FilePath& path, |
| 165 const ResolveToDocumentIdCallback& callback); | 168 const ResolveToDocumentIdCallback& callback); |
| 166 void ResolveToDocumentIdRecursively( | 169 void ResolveToDocumentIdRecursively( |
| 167 const std::string& document_id, | 170 const std::string& document_id, |
| (...skipping 22 matching lines...) Expand all Loading... | |
| 190 // OnWatchersCleared() callback. Such watchers are still tracked here, | 193 // OnWatchersCleared() callback. Such watchers are still tracked here, |
| 191 // but they are not known by the remote service, so they are represented | 194 // but they are not known by the remote service, so they are represented |
| 192 // by the invalid watcher ID (-1). | 195 // by the invalid watcher ID (-1). |
| 193 // | 196 // |
| 194 // Note that we do not use a document ID as a key here to guarantee that | 197 // Note that we do not use a document ID as a key here to guarantee that |
| 195 // a watch installed by AddWatcher() can be always identified in | 198 // a watch installed by AddWatcher() can be always identified in |
| 196 // RemoveWatcher() with the same file path specified. | 199 // RemoveWatcher() with the same file path specified. |
| 197 // See the documentation of AddWatcher() for more details. | 200 // See the documentation of AddWatcher() for more details. |
| 198 std::map<base::FilePath, int64_t> path_to_watcher_id_; | 201 std::map<base::FilePath, int64_t> path_to_watcher_id_; |
| 199 | 202 |
| 203 // Map from a file path to an in-flight watcher request ID. | |
| 204 // | |
| 205 // While AddWatcher() is in-flight, a unique request ID is set here. | |
| 206 // | |
| 207 // Invariant: for any |path|, an entry for |path| may exist in | |
|
hidehiko
2017/03/10 15:16:02
Optional: Instead of having this restriction, how
Shuhei Takahashi
2017/03/14 05:42:47
Sounds good, let's do that!
| |
| 208 // |path_to_watcher_id_| or |path_to_watcher_request_id_|, but not in both. | |
| 209 // | |
| 210 // TODO(crbug.com/698624): Remove this hack. It was introduced because Files | |
| 211 // app freezes until AddWatcher() finishes, but it should be handled in Files | |
| 212 // app rather than here. | |
| 213 std::map<base::FilePath, uint64_t> path_to_watcher_request_id_; | |
| 214 | |
| 215 uint64_t next_watcher_request_id_ = 1; | |
| 216 | |
| 200 // Can be null if this instance is not observing ArcFileSystemOperationRunner. | 217 // Can be null if this instance is not observing ArcFileSystemOperationRunner. |
| 201 // Observation is started on the first call of AddWatcher(). | 218 // Observation is started on the first call of AddWatcher(). |
| 202 scoped_refptr<file_system_operation_runner_util::ObserverIOThreadWrapper> | 219 scoped_refptr<file_system_operation_runner_util::ObserverIOThreadWrapper> |
| 203 observer_wrapper_; | 220 observer_wrapper_; |
| 204 | 221 |
| 205 base::WeakPtrFactory<ArcDocumentsProviderRoot> weak_ptr_factory_; | 222 base::WeakPtrFactory<ArcDocumentsProviderRoot> weak_ptr_factory_; |
| 206 | 223 |
| 207 DISALLOW_COPY_AND_ASSIGN(ArcDocumentsProviderRoot); | 224 DISALLOW_COPY_AND_ASSIGN(ArcDocumentsProviderRoot); |
| 208 }; | 225 }; |
| 209 | 226 |
| 210 } // namespace arc | 227 } // namespace arc |
| 211 | 228 |
| 212 #endif // CHROME_BROWSER_CHROMEOS_ARC_FILEAPI_ARC_DOCUMENTS_PROVIDER_ROOT_H_ | 229 #endif // CHROME_BROWSER_CHROMEOS_ARC_FILEAPI_ARC_DOCUMENTS_PROVIDER_ROOT_H_ |
| OLD | NEW |