| Index: chrome/browser/chromeos/drive/change_list_loader.h
|
| diff --git a/chrome/browser/chromeos/drive/change_list_loader.h b/chrome/browser/chromeos/drive/change_list_loader.h
|
| index 620caca9504b0480ce6b7cb272be40887ee003b7..df8ac2561e1e9ca8ff711bda9e21e45a9f94b29a 100644
|
| --- a/chrome/browser/chromeos/drive/change_list_loader.h
|
| +++ b/chrome/browser/chromeos/drive/change_list_loader.h
|
| @@ -22,6 +22,7 @@
|
| class GURL;
|
|
|
| namespace base {
|
| +class ScopedClosureRunner;
|
| class SequencedTaskRunner;
|
| class Time;
|
| } // namespace base
|
| @@ -103,6 +104,12 @@ class ChangeListLoader {
|
| // calls |UpdateAboutResource| passing |callback|.
|
| void GetAboutResource(const google_apis::AboutResourceCallback& callback);
|
|
|
| + // Increments the lock count and returns an object which decrements the count
|
| + // on its destruction.
|
| + // While the lock count is positive, ChangeListLoader does not add any entries
|
| + // to the local metadata.
|
| + scoped_ptr<base::ScopedClosureRunner> GetLock();
|
| +
|
| private:
|
| // Part of LoadDirectoryIfNeeded().
|
| void LoadDirectoryIfNeededAfterGetEntry(const base::FilePath& directory_path,
|
| @@ -191,6 +198,14 @@ class ChangeListLoader {
|
| const base::FilePath* directory_path,
|
| FileError error);
|
|
|
| + // ================= Implementation for lock mechanism ====================
|
| + // Runs the closure if the lock count is 0, otherwise it will be pending.
|
| + // All tasks which may add entries should be run via this method.
|
| + void ApplyChange(const base::Closure& closure);
|
| +
|
| + // Decrements the lock count.
|
| + void Unlock();
|
| +
|
| // ================= Implementation for other stuff =================
|
|
|
| // Gets the about resource from the server, and caches it if successful. This
|
| @@ -217,6 +232,9 @@ class ChangeListLoader {
|
| LoadCallbackMap pending_load_callback_;
|
| FileOperationCallback pending_update_check_callback_;
|
|
|
| + int lock_count_;
|
| + std::vector<base::Closure> pending_apply_closures_;
|
| +
|
| // Running feed fetcher.
|
| scoped_ptr<FeedFetcher> change_feed_fetcher_;
|
|
|
|
|