Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(27)

Side by Side Diff: chrome/browser/chromeos/drive/file_cache.h

Issue 15878006: drive: Stop mentioning about symlinks (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/browser/chromeos/drive/file_cache.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 CHROME_BROWSER_CHROMEOS_DRIVE_FILE_CACHE_H_ 5 #ifndef CHROME_BROWSER_CHROMEOS_DRIVE_FILE_CACHE_H_
6 #define CHROME_BROWSER_CHROMEOS_DRIVE_FILE_CACHE_H_ 6 #define CHROME_BROWSER_CHROMEOS_DRIVE_FILE_CACHE_H_
7 7
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 // Must be called on the UI thread. 115 // Must be called on the UI thread.
116 void AddObserver(FileCacheObserver* observer); 116 void AddObserver(FileCacheObserver* observer);
117 117
118 // Removes observer. 118 // Removes observer.
119 // Must be called on the UI thread. 119 // Must be called on the UI thread.
120 void RemoveObserver(FileCacheObserver* observer); 120 void RemoveObserver(FileCacheObserver* observer);
121 121
122 // Gets the cache entry for file corresponding to |resource_id| and |md5| 122 // Gets the cache entry for file corresponding to |resource_id| and |md5|
123 // and runs |callback| with true and the entry found if entry exists in cache 123 // and runs |callback| with true and the entry found if entry exists in cache
124 // map. Otherwise, runs |callback| with false. 124 // map. Otherwise, runs |callback| with false.
125 // |md5| can be empty if only matching |resource_id| is desired, which may 125 // |md5| can be empty if only matching |resource_id| is desired.
126 // happen when looking for pinned entries where symlinks' filenames have no
127 // extension and hence no md5.
128 // |callback| must not be null. 126 // |callback| must not be null.
129 // Must be called on the UI thread. 127 // Must be called on the UI thread.
130 void GetCacheEntryOnUIThread(const std::string& resource_id, 128 void GetCacheEntryOnUIThread(const std::string& resource_id,
131 const std::string& md5, 129 const std::string& md5,
132 const GetCacheEntryCallback& callback); 130 const GetCacheEntryCallback& callback);
133 131
134 // Gets the cache entry by the given resource ID and MD5. 132 // Gets the cache entry by the given resource ID and MD5.
135 // See also GetCacheEntryOnUIThread(). 133 // See also GetCacheEntryOnUIThread().
136 bool GetCacheEntry(const std::string& resource_id, 134 bool GetCacheEntry(const std::string& resource_id,
137 const std::string& md5, 135 const std::string& md5,
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
199 // Stores |source_path| to the cache and mark it as dirty, i.e., needs to be 197 // Stores |source_path| to the cache and mark it as dirty, i.e., needs to be
200 // uploaded to the remove server for syncing. 198 // uploaded to the remove server for syncing.
201 // |callback| must not be null. 199 // |callback| must not be null.
202 // Must be called on the UI thread. 200 // Must be called on the UI thread.
203 void StoreLocallyModifiedOnUIThread(const std::string& resource_id, 201 void StoreLocallyModifiedOnUIThread(const std::string& resource_id,
204 const std::string& md5, 202 const std::string& md5,
205 const base::FilePath& source_path, 203 const base::FilePath& source_path,
206 FileOperationType file_operation_type, 204 FileOperationType file_operation_type,
207 const FileOperationCallback& callback); 205 const FileOperationCallback& callback);
208 206
209 // Modifies cache state, which involves the following: 207 // Pins the specified entry.
210 // - moves |source_path| to |dest_path| in persistent dir if
211 // file is not dirty
212 // - creates symlink in pinned dir that references downloaded or locally
213 // modified file
214 // |callback| must not be null. 208 // |callback| must not be null.
215 // Must be called on the UI thread. 209 // Must be called on the UI thread.
216 void PinOnUIThread(const std::string& resource_id, 210 void PinOnUIThread(const std::string& resource_id,
217 const std::string& md5, 211 const std::string& md5,
218 const FileOperationCallback& callback); 212 const FileOperationCallback& callback);
219 213
220 // Runs Unpin() on |blocking_task_runner_|, and calls |callback| with the 214 // Runs Unpin() on |blocking_task_runner_|, and calls |callback| with the
221 // result asynchronously. 215 // result asynchronously.
222 // |callback| must not be null. 216 // |callback| must not be null.
223 // Must be called on the UI thread. 217 // Must be called on the UI thread.
224 void UnpinOnUIThread(const std::string& resource_id, 218 void UnpinOnUIThread(const std::string& resource_id,
225 const std::string& md5, 219 const std::string& md5,
226 const FileOperationCallback& callback); 220 const FileOperationCallback& callback);
227 221
228 // Modifies cache state, which involves the following: 222 // Unpins the specified entry.
229 // - moves the local file from pinned directory to unpinned directory.
230 // - update cache metadata.
231 FileError Unpin(const std::string& resource_id, const std::string& md5); 223 FileError Unpin(const std::string& resource_id, const std::string& md5);
232 224
233 // Sets the state of the cache entry corresponding to |resource_id| and |md5| 225 // Sets the state of the cache entry corresponding to |resource_id| and |md5|
234 // as mounted. 226 // as mounted.
235 // |callback| must not be null. 227 // |callback| must not be null.
236 // Must be called on the UI thread. 228 // Must be called on the UI thread.
237 void MarkAsMountedOnUIThread(const std::string& resource_id, 229 void MarkAsMountedOnUIThread(const std::string& resource_id,
238 const std::string& md5, 230 const std::string& md5,
239 const GetFileFromCacheCallback& callback); 231 const GetFileFromCacheCallback& callback);
240 232
241 // Set the state of the cache entry corresponding to file_path as unmounted. 233 // Set the state of the cache entry corresponding to file_path as unmounted.
242 // |callback| must not be null. 234 // |callback| must not be null.
243 // Must be called on the UI thread. 235 // Must be called on the UI thread.
244 void MarkAsUnmountedOnUIThread(const base::FilePath& file_path, 236 void MarkAsUnmountedOnUIThread(const base::FilePath& file_path,
245 const FileOperationCallback& callback); 237 const FileOperationCallback& callback);
246 238
247 // Modifies cache state, which involves the following: 239 // Marks the specified entry dirty.
248 // - moves |source_path| to |dest_path| in persistent dir, where
249 // |source_path| has .<md5> extension and |dest_path| has .local extension
250 // - if file is pinned, updates symlink in pinned dir to reference dirty file
251 // |callback| must not be null. 240 // |callback| must not be null.
252 // Must be called on the UI thread. 241 // Must be called on the UI thread.
253 void MarkDirtyOnUIThread(const std::string& resource_id, 242 void MarkDirtyOnUIThread(const std::string& resource_id,
254 const std::string& md5, 243 const std::string& md5,
255 const FileOperationCallback& callback); 244 const FileOperationCallback& callback);
256 245
257 // Modifies cache state, i.e. creates symlink in outgoing 246 // Commits changes for the specified dirty entry.
258 // dir to reference dirty file in persistent dir.
259 // |callback| must not be null. 247 // |callback| must not be null.
260 // Must be called on the UI thread. 248 // Must be called on the UI thread.
261 void CommitDirtyOnUIThread(const std::string& resource_id, 249 void CommitDirtyOnUIThread(const std::string& resource_id,
262 const std::string& md5, 250 const std::string& md5,
263 const FileOperationCallback& callback); 251 const FileOperationCallback& callback);
264 252
265 // Clears dirty state of the specified entry. 253 // Clears dirty state of the specified entry.
266 FileError ClearDirty(const std::string& resource_id, 254 FileError ClearDirty(const std::string& resource_id,
267 const std::string& md5); 255 const std::string& md5);
268 256
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
422 // this value. 410 // this value.
423 // 411 //
424 // Copied from cryptohome/homedirs.h. 412 // Copied from cryptohome/homedirs.h.
425 // TODO(satorux): Share the constant. 413 // TODO(satorux): Share the constant.
426 const int64 kMinFreeSpace = 512 * 1LL << 20; 414 const int64 kMinFreeSpace = 512 * 1LL << 20;
427 415
428 } // namespace internal 416 } // namespace internal
429 } // namespace drive 417 } // namespace drive
430 418
431 #endif // CHROME_BROWSER_CHROMEOS_DRIVE_FILE_CACHE_H_ 419 #endif // CHROME_BROWSER_CHROMEOS_DRIVE_FILE_CACHE_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/chromeos/drive/file_cache.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698