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

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

Issue 11293247: Make DriveFeedProcessor asynchronous. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: unittests and satorux feedback Created 8 years, 1 month 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 (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_DRIVE_FEED_PROCESSOR_H_ 5 #ifndef CHROME_BROWSER_CHROMEOS_DRIVE_DRIVE_FEED_PROCESSOR_H_
6 #define CHROME_BROWSER_CHROMEOS_DRIVE_DRIVE_FEED_PROCESSOR_H_ 6 #define CHROME_BROWSER_CHROMEOS_DRIVE_DRIVE_FEED_PROCESSOR_H_
7 7
8 #include <map> 8 #include <map>
9 #include <set> 9 #include <set>
10 #include <string> 10 #include <string>
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 void ApplyEntryProtoMap(bool is_delta_feed, int64 feed_changestamp); 72 void ApplyEntryProtoMap(bool is_delta_feed, int64 feed_changestamp);
73 73
74 // Apply the next item from entry_proto_map_ to the file system. The async 74 // Apply the next item from entry_proto_map_ to the file system. The async
75 // version posts to the message loop to avoid recursive stack-overflow. 75 // version posts to the message loop to avoid recursive stack-overflow.
76 void ApplyNextEntryProto(); 76 void ApplyNextEntryProto();
77 void ApplyNextEntryProtoAsync(); 77 void ApplyNextEntryProtoAsync();
78 78
79 // Apply |entry_proto| to resource_metadata_. 79 // Apply |entry_proto| to resource_metadata_.
80 void ApplyEntryProto(const DriveEntryProto& entry_proto); 80 void ApplyEntryProto(const DriveEntryProto& entry_proto);
81 81
82 // Continue ApplyEntryProto. This is a callback for
83 // DriveResourceMetadata::GetEntryInfoByResourceId.
84 void ContinueApplyEntryProto(
85 const DriveEntryProto& entry_proto,
86 DriveFileError error,
87 const FilePath& drive_file_path,
88 scoped_ptr<DriveEntryProto> old_entry_proto);
89
82 // Apply the DriveEntryProto pointed to by |it| to resource_metadata_. 90 // Apply the DriveEntryProto pointed to by |it| to resource_metadata_.
83 void ApplyNextByIterator(DriveEntryProtoMap::iterator it); 91 void ApplyNextByIterator(DriveEntryProtoMap::iterator it);
84 92
85 // Helper function for adding an |entry| from the feed to its new parent. 93 // TODO(achuith): Delete this.
86 // changed_dirs_ are updated if this operation needs to raise a directory
87 // change notification.
88 void AddEntryToParent(DriveEntry* entry); 94 void AddEntryToParent(DriveEntry* entry);
89 95
90 // Helper function for removing |entry| from its parent. 96 // Helper function to add |entry_proto| to its parent. Updates changed_dirs_
91 // changed_dirs_ are updated if this operation needs to raise a directory 97 // as a side effect.
92 // change notification, including child directories. 98 void AddEntryToParent(const DriveEntryProto& entry_proto);
hashimoto 2012/11/14 10:15:56 Our coding style discourages function overloading.
achuithb 2012/11/14 11:11:29 Renamed to AddEntryToParentDeprecated. This will b
99
100 // Callback for DriveResourceMetadata::AddEntryToParent.
101 void NotifyForAddEntryToParent(bool is_directory,
102 DriveFileError error,
103 const FilePath& file_path);
104
105 // TODO(achuith): Delete this.
93 void RemoveEntryFromParent(DriveEntry* entry); 106 void RemoveEntryFromParent(DriveEntry* entry);
94 107
108 // Removes entry pointed to by |resource_id| from its parent. Updates
109 // changed_dirs_ as a side effect.
110 void RemoveEntryFromParent(const std::string& resource_id);
111
112 // Continues RemoveEntryFromParent after
113 // DriveResourceMetadata::GetChildDirectories.
114 void ContinueRemoveEntryFromParent(
115 const std::string& resource_id,
116 const std::set<FilePath>& changed_directories);
117
118 // Callback for DriveResourceMetadata::RemoveEntryFromParent.
119 void NotifyForRemoveEntryFromParent(
120 const std::set<FilePath>& changed_directories,
121 DriveFileError error,
122 const FilePath& file_path);
123
124 // Refreshes DriveResourceMetadata entry that has the same resource_id as
125 // |entry_proto| with |entry_proto|. Updates changed_dirs_ as a side effect.
126 void RefreshEntryProto(const DriveEntryProto& entry_proto);
127
128 // Continues Refresh after DriveResourceMetadata::GetChangedDirectories.
129 void ContinueRefreshEntryProto(const DriveEntryProto& entry_proto,
130 const std::set<FilePath>& changed_directories);
131
132 // Callback for DriveResourceMetadata::RefreshEntryProto.
133 void NotifyForRefreshEntryProto(
134 const std::set<FilePath>& changed_directories,
135 DriveFileError error,
136 const FilePath& file_path,
137 scoped_ptr<DriveEntryProto> entry_proto);
138
95 // Resolves parent directory for |new_entry| from the feed. 139 // Resolves parent directory for |new_entry| from the feed.
140 // TODO(achuith): Delete this.
96 DriveDirectory* ResolveParent(DriveEntry* new_entry); 141 DriveDirectory* ResolveParent(DriveEntry* new_entry);
97 142
98 // Reset the state of this object. 143 // Reset the state of this object.
99 void Clear(); 144 void Clear();
100 145
101 DriveResourceMetadata* resource_metadata_; // Not owned. 146 DriveResourceMetadata* resource_metadata_; // Not owned.
102 147
103 DriveEntryProtoMap entry_proto_map_; 148 DriveEntryProtoMap entry_proto_map_;
104 std::set<FilePath> changed_dirs_; 149 std::set<FilePath> changed_dirs_;
105 base::Closure on_complete_callback_; 150 base::Closure on_complete_callback_;
106 151
107 // Note: This should remain the last member so it'll be destroyed and 152 // Note: This should remain the last member so it'll be destroyed and
108 // invalidate its weak pointers before any other members are destroyed. 153 // invalidate its weak pointers before any other members are destroyed.
109 base::WeakPtrFactory<DriveFeedProcessor> weak_ptr_factory_; 154 base::WeakPtrFactory<DriveFeedProcessor> weak_ptr_factory_;
110 DISALLOW_COPY_AND_ASSIGN(DriveFeedProcessor); 155 DISALLOW_COPY_AND_ASSIGN(DriveFeedProcessor);
111 }; 156 };
112 157
113 } // namespace drive 158 } // namespace drive
114 159
115 #endif // CHROME_BROWSER_CHROMEOS_DRIVE_DRIVE_FEED_PROCESSOR_H_ 160 #endif // CHROME_BROWSER_CHROMEOS_DRIVE_DRIVE_FEED_PROCESSOR_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698