| 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 CHROME_BROWSER_CHROMEOS_DRIVE_SYNC_ENTRY_UPDATE_PERFORMER_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_DRIVE_SYNC_ENTRY_UPDATE_PERFORMER_H_ | 
| 6 #define CHROME_BROWSER_CHROMEOS_DRIVE_SYNC_ENTRY_UPDATE_PERFORMER_H_ | 6 #define CHROME_BROWSER_CHROMEOS_DRIVE_SYNC_ENTRY_UPDATE_PERFORMER_H_ | 
| 7 | 7 | 
| 8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" | 
| 9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" | 
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" | 
| (...skipping 15 matching lines...) Expand all  Loading... | 
| 26 class JobScheduler; | 26 class JobScheduler; | 
| 27 class ResourceEntry; | 27 class ResourceEntry; | 
| 28 struct ClientContext; | 28 struct ClientContext; | 
| 29 | 29 | 
| 30 namespace file_system { | 30 namespace file_system { | 
| 31 class OperationObserver; | 31 class OperationObserver; | 
| 32 }  // namespace file_system | 32 }  // namespace file_system | 
| 33 | 33 | 
| 34 namespace internal { | 34 namespace internal { | 
| 35 | 35 | 
| 36 class ChangeListLoader; |  | 
| 37 class EntryRevertPerformer; | 36 class EntryRevertPerformer; | 
| 38 class FileCache; | 37 class FileCache; | 
|  | 38 class LoaderController; | 
| 39 class RemovePerformer; | 39 class RemovePerformer; | 
| 40 class ResourceMetadata; | 40 class ResourceMetadata; | 
| 41 | 41 | 
| 42 // This class is responsible to perform server side update of an entry. | 42 // This class is responsible to perform server side update of an entry. | 
| 43 class EntryUpdatePerformer { | 43 class EntryUpdatePerformer { | 
| 44  public: | 44  public: | 
| 45   EntryUpdatePerformer(base::SequencedTaskRunner* blocking_task_runner, | 45   EntryUpdatePerformer(base::SequencedTaskRunner* blocking_task_runner, | 
| 46                        file_system::OperationObserver* observer, | 46                        file_system::OperationObserver* observer, | 
| 47                        JobScheduler* scheduler, | 47                        JobScheduler* scheduler, | 
| 48                        ResourceMetadata* metadata, | 48                        ResourceMetadata* metadata, | 
| 49                        FileCache* cache, | 49                        FileCache* cache, | 
| 50                        ChangeListLoader* change_list_loader); | 50                        LoaderController* loader_controller); | 
| 51   ~EntryUpdatePerformer(); | 51   ~EntryUpdatePerformer(); | 
| 52 | 52 | 
| 53   // Requests the server to update the metadata of the entry specified by | 53   // Requests the server to update the metadata of the entry specified by | 
| 54   // |local_id| with the locally stored one. | 54   // |local_id| with the locally stored one. | 
| 55   // Invokes |callback| when finished with the result of the operation. | 55   // Invokes |callback| when finished with the result of the operation. | 
| 56   // |callback| must not be null. | 56   // |callback| must not be null. | 
| 57   void UpdateEntry(const std::string& local_id, | 57   void UpdateEntry(const std::string& local_id, | 
| 58                    const ClientContext& context, | 58                    const ClientContext& context, | 
| 59                    const FileOperationCallback& callback); | 59                    const FileOperationCallback& callback); | 
| 60 | 60 | 
| 61   struct LocalState; | 61   struct LocalState; | 
| 62 | 62 | 
| 63  private: | 63  private: | 
| 64   // Part of UpdateEntry(). Called after local metadata look up. | 64   // Part of UpdateEntry(). Called after local metadata look up. | 
| 65   void UpdateEntryAfterPrepare(const ClientContext& context, | 65   void UpdateEntryAfterPrepare(const ClientContext& context, | 
| 66                                const FileOperationCallback& callback, | 66                                const FileOperationCallback& callback, | 
| 67                                scoped_ptr<LocalState> local_state, | 67                                scoped_ptr<LocalState> local_state, | 
| 68                                FileError error); | 68                                FileError error); | 
| 69 | 69 | 
| 70   // Part of UpdateEntry(). Called after UpdateResource is completed. | 70   // Part of UpdateEntry(). Called after UpdateResource is completed. | 
| 71   void UpdateEntryAfterUpdateResource( | 71   void UpdateEntryAfterUpdateResource( | 
| 72       const ClientContext& context, | 72       const ClientContext& context, | 
| 73       const FileOperationCallback& callback, | 73       const FileOperationCallback& callback, | 
| 74       const std::string& local_id, | 74       const std::string& local_id, | 
| 75       scoped_ptr<base::ScopedClosureRunner> change_list_loader_lock, | 75       scoped_ptr<base::ScopedClosureRunner> loader_lock, | 
| 76       google_apis::GDataErrorCode status, | 76       google_apis::GDataErrorCode status, | 
| 77       scoped_ptr<google_apis::ResourceEntry> resource_entry); | 77       scoped_ptr<google_apis::ResourceEntry> resource_entry); | 
| 78 | 78 | 
| 79   scoped_refptr<base::SequencedTaskRunner> blocking_task_runner_; | 79   scoped_refptr<base::SequencedTaskRunner> blocking_task_runner_; | 
| 80   JobScheduler* scheduler_; | 80   JobScheduler* scheduler_; | 
| 81   ResourceMetadata* metadata_; | 81   ResourceMetadata* metadata_; | 
| 82   FileCache* cache_; | 82   FileCache* cache_; | 
| 83   ChangeListLoader* change_list_loader_; | 83   LoaderController* loader_controller_; | 
| 84   scoped_ptr<RemovePerformer> remove_performer_; | 84   scoped_ptr<RemovePerformer> remove_performer_; | 
| 85   scoped_ptr<EntryRevertPerformer> entry_revert_performer_; | 85   scoped_ptr<EntryRevertPerformer> entry_revert_performer_; | 
| 86 | 86 | 
| 87   // Note: This should remain the last member so it'll be destroyed and | 87   // Note: This should remain the last member so it'll be destroyed and | 
| 88   // invalidate the weak pointers before any other members are destroyed. | 88   // invalidate the weak pointers before any other members are destroyed. | 
| 89   base::WeakPtrFactory<EntryUpdatePerformer> weak_ptr_factory_; | 89   base::WeakPtrFactory<EntryUpdatePerformer> weak_ptr_factory_; | 
| 90   DISALLOW_COPY_AND_ASSIGN(EntryUpdatePerformer); | 90   DISALLOW_COPY_AND_ASSIGN(EntryUpdatePerformer); | 
| 91 }; | 91 }; | 
| 92 | 92 | 
| 93 }  // namespace internal | 93 }  // namespace internal | 
| 94 }  // namespace drive | 94 }  // namespace drive | 
| 95 | 95 | 
| 96 #endif  // CHROME_BROWSER_CHROMEOS_DRIVE_SYNC_ENTRY_UPDATE_PERFORMER_H_ | 96 #endif  // CHROME_BROWSER_CHROMEOS_DRIVE_SYNC_ENTRY_UPDATE_PERFORMER_H_ | 
| OLD | NEW | 
|---|