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

Side by Side Diff: chrome/browser/sync_file_system/drive_backend/metadata_database.h

Issue 148483009: [SyncFS] Force activate folder tracker on folder creation conflict case (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 10 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_SYNC_FILE_SYSTEM_DRIVE_BACKEND_METADATA_DATABASE_H_ 5 #ifndef CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_BACKEND_METADATA_DATABASE_H_
6 #define CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_BACKEND_METADATA_DATABASE_H_ 6 #define CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_BACKEND_METADATA_DATABASE_H_
7 7
8 #include <map> 8 #include <map>
9 #include <set> 9 #include <set>
10 #include <string> 10 #include <string>
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 typedef std::map<std::string, FileTracker*> TrackerByAppID; 118 typedef std::map<std::string, FileTracker*> TrackerByAppID;
119 typedef std::vector<std::string> FileIDList; 119 typedef std::vector<std::string> FileIDList;
120 120
121 typedef base::Callback< 121 typedef base::Callback<
122 void(SyncStatusCode status, scoped_ptr<MetadataDatabase> instance)> 122 void(SyncStatusCode status, scoped_ptr<MetadataDatabase> instance)>
123 CreateCallback; 123 CreateCallback;
124 124
125 enum ActivationStatus { 125 enum ActivationStatus {
126 ACTIVATION_PENDING, 126 ACTIVATION_PENDING,
127 ACTIVATION_FAILED_ANOTHER_ACTIVE_TRACKER, 127 ACTIVATION_FAILED_ANOTHER_ACTIVE_TRACKER,
128 ACTIVATION_FAILED_SAME_PATH_TRACKER,
129 }; 128 };
130 129
131 enum UpdateOption { 130 enum UpdateOption {
132 UPDATE_TRACKER_FOR_UNSYNCED_FILE, 131 UPDATE_TRACKER_FOR_UNSYNCED_FILE,
133 UPDATE_TRACKER_FOR_SYNCED_FILE, 132 UPDATE_TRACKER_FOR_SYNCED_FILE,
134 }; 133 };
135 134
136 // The entry point of the MetadataDatabase for production code. 135 // The entry point of the MetadataDatabase for production code.
137 // If |env_override| is non-NULL, internal LevelDB uses |env_override| instead 136 // If |env_override| is non-NULL, internal LevelDB uses |env_override| instead
138 // of leveldb::Env::Default(). Use leveldb::MemEnv in test code for faster 137 // of leveldb::Env::Default(). Use leveldb::MemEnv in test code for faster
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
297 // If the tracker has no further change to sync, unmarks its dirty flag. 296 // If the tracker has no further change to sync, unmarks its dirty flag.
298 void PopulateFolderByChildList(const std::string& folder_id, 297 void PopulateFolderByChildList(const std::string& folder_id,
299 const FileIDList& child_file_ids, 298 const FileIDList& child_file_ids,
300 const SyncStatusCallback& callback); 299 const SyncStatusCallback& callback);
301 300
302 // Updates |synced_details| of the tracker with |updated_details|. 301 // Updates |synced_details| of the tracker with |updated_details|.
303 void UpdateTracker(int64 tracker_id, 302 void UpdateTracker(int64 tracker_id,
304 const FileDetails& updated_details, 303 const FileDetails& updated_details,
305 const SyncStatusCallback& callback); 304 const SyncStatusCallback& callback);
306 305
307 // Returns ACTIVATION_PENDING if a tracker of the file can be safely activated 306 // Activates a tracker identified by |parent_tracker_id| and |file_id| if the
308 // without deactivating any other trackers. In this case, tries to activate 307 // tracker can be activated without inactivating other trackers that has the
kinuko 2014/02/07 08:00:21 nit: has -> have
tzik 2014/02/10 02:38:58 Done.
309 // the tracker, and invokes |callback| upon completion. 308 // same |file_id| but a different path.
kinuko 2014/02/07 08:00:21 a different path -> different paths
tzik 2014/02/10 02:38:58 Done.
310 // Returns ACTIVATION_FAILED_ANOTHER_ACTIVE_TRACKER if there's another active 309 // If |file_id| has another active tracker, the function returns
311 // tracker that tracks |file_id|. 310 // ACTIVATION_FAILED_ANOTHER_ACTIVE_TRACKER and does not invoke |callback|.
312 // Returns ACTIVATION_FAILED_SAME_PATH_TRACKER if there's another active 311 // If there is another active tracker that has the same path but different
313 // tracker that has the same parent tracker and title to |file_id|. 312 // |file_id|, inactivates the tracker.
314 // In these FAILED cases, |callback| is not invoked. 313 // In success case, returns ACTIVATION_PENDING and invokes |callback| upon
315 ActivationStatus TryNoSideEffectActivation( 314 // completion.
316 int64 parent_tracker_id, 315 //
317 const std::string& file_id, 316 // The tracker to be activated must:
318 const SyncStatusCallback& callback); 317 // - have a tracked metadata in the database,
318 // - have |synced_details| with valid |title|.
319 ActivationStatus TryActivateTracker(int64 parent_tracker_id,
320 const std::string& file_id,
321 const SyncStatusCallback& callback);
319 322
320 // Changes the priority of the tracker to low. 323 // Changes the priority of the tracker to low.
321 void LowerTrackerPriority(int64 tracker_id); 324 void LowerTrackerPriority(int64 tracker_id);
322 void PromoteLowerPriorityTrackersToNormal(); 325 void PromoteLowerPriorityTrackersToNormal();
323 326
324 // Returns true if there is a normal priority dirty tracker. 327 // Returns true if there is a normal priority dirty tracker.
325 // Assigns the dirty tracker if exists and |tracker| is non-NULL. 328 // Assigns the dirty tracker if exists and |tracker| is non-NULL.
326 bool GetNormalPriorityDirtyTracker(FileTracker* tracker) const; 329 bool GetNormalPriorityDirtyTracker(FileTracker* tracker) const;
327 330
328 // Returns true if there is a low priority dirty tracker. 331 // Returns true if there is a low priority dirty tracker.
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
502 505
503 base::WeakPtrFactory<MetadataDatabase> weak_ptr_factory_; 506 base::WeakPtrFactory<MetadataDatabase> weak_ptr_factory_;
504 507
505 DISALLOW_COPY_AND_ASSIGN(MetadataDatabase); 508 DISALLOW_COPY_AND_ASSIGN(MetadataDatabase);
506 }; 509 };
507 510
508 } // namespace drive_backend 511 } // namespace drive_backend
509 } // namespace sync_file_system 512 } // namespace sync_file_system
510 513
511 #endif // CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_BACKEND_METADATA_DATABASE_H_ 514 #endif // CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_BACKEND_METADATA_DATABASE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698