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

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

Issue 15974004: drive: Rewrite UpdateOpreation to access cache/metadata on the blocking pool (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove ClearDirtyOnUIThread 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 244 matching lines...) Expand 10 before | Expand all | Expand 10 after
255 const FileOperationCallback& callback); 255 const FileOperationCallback& callback);
256 256
257 // Modifies cache state, i.e. creates symlink in outgoing 257 // Modifies cache state, i.e. creates symlink in outgoing
258 // dir to reference dirty file in persistent dir. 258 // dir to reference dirty file in persistent dir.
259 // |callback| must not be null. 259 // |callback| must not be null.
260 // Must be called on the UI thread. 260 // Must be called on the UI thread.
261 void CommitDirtyOnUIThread(const std::string& resource_id, 261 void CommitDirtyOnUIThread(const std::string& resource_id,
262 const std::string& md5, 262 const std::string& md5,
263 const FileOperationCallback& callback); 263 const FileOperationCallback& callback);
264 264
265 // Modifies cache state, which involves the following: 265 // Clears dirty state of the specified entry.
266 // - moves |source_path| to |dest_path| in persistent dir if 266 FileError ClearDirty(const std::string& resource_id,
267 // file is pinned or tmp dir otherwise, where |source_path| has .local 267 const std::string& md5);
268 // extension and |dest_path| has .<md5> extension
269 // - deletes symlink in outgoing dir
270 // - if file is pinned, updates symlink in pinned dir to reference
271 // |dest_path|
272 // |callback| must not be null.
273 // Must be called on the UI thread.
274 void ClearDirtyOnUIThread(const std::string& resource_id,
275 const std::string& md5,
276 const FileOperationCallback& callback);
277 268
278 // Runs Remove() on |blocking_task_runner_| and runs |callback| with the 269 // Runs Remove() on |blocking_task_runner_| and runs |callback| with the
279 // result. 270 // result.
280 // Must be called on the UI thread. 271 // Must be called on the UI thread.
281 void RemoveOnUIThread(const std::string& resource_id, 272 void RemoveOnUIThread(const std::string& resource_id,
282 const FileOperationCallback& callback); 273 const FileOperationCallback& callback);
283 274
284 // Removes the specified cache entry and delete cache files if available. 275 // Removes the specified cache entry and delete cache files if available.
285 // Synchronous version of RemoveOnUIThread(). 276 // Synchronous version of RemoveOnUIThread().
286 FileError Remove(const std::string& resource_id); 277 FileError Remove(const std::string& resource_id);
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
374 const std::string& md5, 365 const std::string& md5,
375 base::FilePath* cache_file_path); 366 base::FilePath* cache_file_path);
376 367
377 // Used to implement MarkAsUnmountedOnUIThread. 368 // Used to implement MarkAsUnmountedOnUIThread.
378 FileError MarkAsUnmounted(const base::FilePath& file_path); 369 FileError MarkAsUnmounted(const base::FilePath& file_path);
379 370
380 // Used to implement MarkDirtyOnUIThread. 371 // Used to implement MarkDirtyOnUIThread.
381 FileError MarkDirty(const std::string& resource_id, 372 FileError MarkDirty(const std::string& resource_id,
382 const std::string& md5); 373 const std::string& md5);
383 374
384 // Used to implement ClearDirtyOnUIThread.
385 FileError ClearDirty(const std::string& resource_id,
386 const std::string& md5);
387
388 // Used to implement ClearAllOnUIThread. 375 // Used to implement ClearAllOnUIThread.
389 bool ClearAll(); 376 bool ClearAll();
390 377
391 // Runs callback and notifies the observers when file is pinned. 378 // Runs callback and notifies the observers when file is pinned.
392 void OnPinned(const std::string& resource_id, 379 void OnPinned(const std::string& resource_id,
393 const std::string& md5, 380 const std::string& md5,
394 const FileOperationCallback& callback, 381 const FileOperationCallback& callback,
395 FileError error); 382 FileError error);
396 383
397 // Runs callback and notifies the observers when file is unpinned. 384 // Runs callback and notifies the observers when file is unpinned.
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
435 // this value. 422 // this value.
436 // 423 //
437 // Copied from cryptohome/homedirs.h. 424 // Copied from cryptohome/homedirs.h.
438 // TODO(satorux): Share the constant. 425 // TODO(satorux): Share the constant.
439 const int64 kMinFreeSpace = 512 * 1LL << 20; 426 const int64 kMinFreeSpace = 512 * 1LL << 20;
440 427
441 } // namespace internal 428 } // namespace internal
442 } // namespace drive 429 } // namespace drive
443 430
444 #endif // CHROME_BROWSER_CHROMEOS_DRIVE_FILE_CACHE_H_ 431 #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