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

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: remove drive_files.h from unittest 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 these.
86 // changed_dirs_ are updated if this operation needs to raise a directory 94 void AddEntryToParentDeprecated(DriveEntry* entry);
87 // change notification. 95 void RemoveEntryFromParent(DriveEntry* entry);
88 void AddEntryToParent(DriveEntry* entry); 96 DriveDirectory* ResolveParent(DriveEntry* new_entry);
89 97
90 // Helper function for removing |entry| from its parent. 98 // 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 99 // as a side effect.
92 // change notification, including child directories. 100 void AddEntryToParent(const DriveEntryProto& entry_proto);
93 void RemoveEntryFromParent(DriveEntry* entry);
94 101
95 // Resolves parent directory for |new_entry| from the feed. 102 // Callback for DriveResourceMetadata::AddEntryToParent.
96 DriveDirectory* ResolveParent(DriveEntry* new_entry); 103 void NotifyForAddEntryToParent(bool is_directory,
104 DriveFileError error,
105 const FilePath& file_path);
106
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);
97 138
98 // Reset the state of this object. 139 // Reset the state of this object.
99 void Clear(); 140 void Clear();
100 141
101 DriveResourceMetadata* resource_metadata_; // Not owned. 142 DriveResourceMetadata* resource_metadata_; // Not owned.
102 143
103 DriveEntryProtoMap entry_proto_map_; 144 DriveEntryProtoMap entry_proto_map_;
104 std::set<FilePath> changed_dirs_; 145 std::set<FilePath> changed_dirs_;
105 base::Closure on_complete_callback_; 146 base::Closure on_complete_callback_;
106 147
107 // Note: This should remain the last member so it'll be destroyed and 148 // Note: This should remain the last member so it'll be destroyed and
108 // invalidate its weak pointers before any other members are destroyed. 149 // invalidate its weak pointers before any other members are destroyed.
109 base::WeakPtrFactory<DriveFeedProcessor> weak_ptr_factory_; 150 base::WeakPtrFactory<DriveFeedProcessor> weak_ptr_factory_;
110 DISALLOW_COPY_AND_ASSIGN(DriveFeedProcessor); 151 DISALLOW_COPY_AND_ASSIGN(DriveFeedProcessor);
111 }; 152 };
112 153
113 } // namespace drive 154 } // namespace drive
114 155
115 #endif // CHROME_BROWSER_CHROMEOS_DRIVE_DRIVE_FEED_PROCESSOR_H_ 156 #endif // CHROME_BROWSER_CHROMEOS_DRIVE_DRIVE_FEED_PROCESSOR_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698