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

Side by Side Diff: chrome/browser/chromeos/drive/sync/entry_update_performer.h

Issue 145173010: drive: Merge ContentUpdatePerformer to EntryUpdatePerformer (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: please review this Created 6 years, 11 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
OLDNEW
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
26 class ResourceEntry; 26 class ResourceEntry;
27 struct ClientContext; 27 struct ClientContext;
28 28
29 namespace file_system { 29 namespace file_system {
30 class OperationObserver; 30 class OperationObserver;
31 } // namespace file_system 31 } // namespace file_system
32 32
33 namespace internal { 33 namespace internal {
34 34
35 class EntryRevertPerformer; 35 class EntryRevertPerformer;
36 class FileCache;
36 class RemovePerformer; 37 class RemovePerformer;
37 class ResourceMetadata; 38 class ResourceMetadata;
38 39
39 // This class is responsible to perform server side update of an entry. 40 // This class is responsible to perform server side update of an entry.
40 class EntryUpdatePerformer { 41 class EntryUpdatePerformer {
41 public: 42 public:
42 EntryUpdatePerformer(base::SequencedTaskRunner* blocking_task_runner, 43 EntryUpdatePerformer(base::SequencedTaskRunner* blocking_task_runner,
43 file_system::OperationObserver* observer, 44 file_system::OperationObserver* observer,
44 JobScheduler* scheduler, 45 JobScheduler* scheduler,
45 ResourceMetadata* metadata); 46 ResourceMetadata* metadata,
47 FileCache* cache);
46 ~EntryUpdatePerformer(); 48 ~EntryUpdatePerformer();
47 49
48 // Requests the server to update the metadata of the entry specified by 50 // Requests the server to update the metadata of the entry specified by
49 // |local_id| with the locally stored one. 51 // |local_id| with the locally stored one.
50 // Invokes |callback| when finished with the result of the operation. 52 // Invokes |callback| when finished with the result of the operation.
51 // |callback| must not be null. 53 // |callback| must not be null.
52 void UpdateEntry(const std::string& local_id, 54 void UpdateEntry(const std::string& local_id,
53 const ClientContext& context, 55 const ClientContext& context,
54 const FileOperationCallback& callback); 56 const FileOperationCallback& callback);
55 57
58 struct LocalState;
59
56 private: 60 private:
57 // Part of UpdateEntry(). Called after local metadata look up. 61 // Part of UpdateEntry(). Called after local metadata look up.
58 void UpdateEntryAfterPrepare(const ClientContext& context, 62 void UpdateEntryAfterPrepare(const ClientContext& context,
59 const FileOperationCallback& callback, 63 const FileOperationCallback& callback,
60 scoped_ptr<ResourceEntry> entry, 64 scoped_ptr<LocalState> local_state,
61 scoped_ptr<ResourceEntry> parent_entry,
62 FileError error); 65 FileError error);
63 66
64 // Part of UpdateEntry(). Called after UpdateResource is completed. 67 // Part of UpdateEntry(). Called after UpdateResource is completed.
65 void UpdateEntryAfterUpdateResource( 68 void UpdateEntryAfterUpdateResource(
66 const ClientContext& context, 69 const ClientContext& context,
67 const FileOperationCallback& callback, 70 const FileOperationCallback& callback,
68 const std::string& local_id, 71 const std::string& local_id,
69 google_apis::GDataErrorCode status, 72 google_apis::GDataErrorCode status,
70 scoped_ptr<google_apis::ResourceEntry> resource_entry); 73 scoped_ptr<google_apis::ResourceEntry> resource_entry);
71 74
72 scoped_refptr<base::SequencedTaskRunner> blocking_task_runner_; 75 scoped_refptr<base::SequencedTaskRunner> blocking_task_runner_;
73 JobScheduler* scheduler_; 76 JobScheduler* scheduler_;
74 ResourceMetadata* metadata_; 77 ResourceMetadata* metadata_;
78 FileCache* cache_;
75 scoped_ptr<RemovePerformer> remove_performer_; 79 scoped_ptr<RemovePerformer> remove_performer_;
76 scoped_ptr<EntryRevertPerformer> entry_revert_performer_; 80 scoped_ptr<EntryRevertPerformer> entry_revert_performer_;
77 81
78 // Note: This should remain the last member so it'll be destroyed and 82 // Note: This should remain the last member so it'll be destroyed and
79 // invalidate the weak pointers before any other members are destroyed. 83 // invalidate the weak pointers before any other members are destroyed.
80 base::WeakPtrFactory<EntryUpdatePerformer> weak_ptr_factory_; 84 base::WeakPtrFactory<EntryUpdatePerformer> weak_ptr_factory_;
81 DISALLOW_COPY_AND_ASSIGN(EntryUpdatePerformer); 85 DISALLOW_COPY_AND_ASSIGN(EntryUpdatePerformer);
82 }; 86 };
83 87
84 } // namespace internal 88 } // namespace internal
85 } // namespace drive 89 } // namespace drive
86 90
87 #endif // CHROME_BROWSER_CHROMEOS_DRIVE_SYNC_ENTRY_UPDATE_PERFORMER_H_ 91 #endif // CHROME_BROWSER_CHROMEOS_DRIVE_SYNC_ENTRY_UPDATE_PERFORMER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698