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

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

Issue 1873683002: Convert //chrome/browser/sync_file_system from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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
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_CONFLICT_RESOLVER_H_ 5 #ifndef CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_BACKEND_CONFLICT_RESOLVER_H_
6 #define CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_BACKEND_CONFLICT_RESOLVER_H_ 6 #define CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_BACKEND_CONFLICT_RESOLVER_H_
7 7
8 #include <memory>
8 #include <string> 9 #include <string>
9 #include <utility> 10 #include <utility>
10 #include <vector> 11 #include <vector>
11 12
12 #include "base/macros.h" 13 #include "base/macros.h"
13 #include "base/memory/scoped_ptr.h"
14 #include "base/memory/weak_ptr.h" 14 #include "base/memory/weak_ptr.h"
15 #include "chrome/browser/sync_file_system/drive_backend/sync_task.h" 15 #include "chrome/browser/sync_file_system/drive_backend/sync_task.h"
16 #include "chrome/browser/sync_file_system/sync_callbacks.h" 16 #include "chrome/browser/sync_file_system/sync_callbacks.h"
17 #include "google_apis/drive/drive_api_error_codes.h" 17 #include "google_apis/drive/drive_api_error_codes.h"
18 18
19 namespace drive { 19 namespace drive {
20 class DriveServiceInterface; 20 class DriveServiceInterface;
21 } 21 }
22 22
23 namespace google_apis { 23 namespace google_apis {
(...skipping 12 matching lines...) Expand all
36 // ConflictResolver detaches the file from all parents other than the parent 36 // ConflictResolver detaches the file from all parents other than the parent
37 // of the active tracker. 37 // of the active tracker.
38 // If multiple trackers have the same local path or the same remote file, 38 // If multiple trackers have the same local path or the same remote file,
39 // ConflictResolver picks up one of them and delete others. 39 // ConflictResolver picks up one of them and delete others.
40 class ConflictResolver : public SyncTask { 40 class ConflictResolver : public SyncTask {
41 public: 41 public:
42 typedef std::vector<std::string> FileIDList; 42 typedef std::vector<std::string> FileIDList;
43 43
44 explicit ConflictResolver(SyncEngineContext* sync_context); 44 explicit ConflictResolver(SyncEngineContext* sync_context);
45 ~ConflictResolver() override; 45 ~ConflictResolver() override;
46 void RunPreflight(scoped_ptr<SyncTaskToken> token) override; 46 void RunPreflight(std::unique_ptr<SyncTaskToken> token) override;
47 void RunExclusive(scoped_ptr<SyncTaskToken> token); 47 void RunExclusive(std::unique_ptr<SyncTaskToken> token);
48 48
49 private: 49 private:
50 typedef std::pair<std::string, std::string> FileIDAndETag; 50 typedef std::pair<std::string, std::string> FileIDAndETag;
51 51
52 void DetachFromNonPrimaryParents(scoped_ptr<SyncTaskToken> token); 52 void DetachFromNonPrimaryParents(std::unique_ptr<SyncTaskToken> token);
53 void DidDetachFromParent(scoped_ptr<SyncTaskToken> token, 53 void DidDetachFromParent(std::unique_ptr<SyncTaskToken> token,
54 google_apis::DriveApiErrorCode error); 54 google_apis::DriveApiErrorCode error);
55 55
56 std::string PickPrimaryFile(const TrackerIDSet& trackers); 56 std::string PickPrimaryFile(const TrackerIDSet& trackers);
57 void RemoveNonPrimaryFiles(scoped_ptr<SyncTaskToken> token); 57 void RemoveNonPrimaryFiles(std::unique_ptr<SyncTaskToken> token);
58 void DidRemoveFile(scoped_ptr<SyncTaskToken> token, 58 void DidRemoveFile(std::unique_ptr<SyncTaskToken> token,
59 const std::string& file_id, 59 const std::string& file_id,
60 google_apis::DriveApiErrorCode error); 60 google_apis::DriveApiErrorCode error);
61 61
62 void UpdateFileMetadata(const std::string& file_id, 62 void UpdateFileMetadata(const std::string& file_id,
63 scoped_ptr<SyncTaskToken> token); 63 std::unique_ptr<SyncTaskToken> token);
64 void DidGetRemoteMetadata(const std::string& file_id, 64 void DidGetRemoteMetadata(const std::string& file_id,
65 scoped_ptr<SyncTaskToken> token, 65 std::unique_ptr<SyncTaskToken> token,
66 google_apis::DriveApiErrorCode error, 66 google_apis::DriveApiErrorCode error,
67 scoped_ptr<google_apis::FileResource> entry); 67 std::unique_ptr<google_apis::FileResource> entry);
68 68
69 std::string target_file_id_; 69 std::string target_file_id_;
70 std::vector<std::string> parents_to_remove_; 70 std::vector<std::string> parents_to_remove_;
71 71
72 std::vector<FileIDAndETag> non_primary_file_ids_; 72 std::vector<FileIDAndETag> non_primary_file_ids_;
73 FileIDList deleted_file_ids_; 73 FileIDList deleted_file_ids_;
74 74
75 bool IsContextReady(); 75 bool IsContextReady();
76 drive::DriveServiceInterface* drive_service(); 76 drive::DriveServiceInterface* drive_service();
77 MetadataDatabase* metadata_database(); 77 MetadataDatabase* metadata_database();
78 78
79 SyncEngineContext* sync_context_; // Not owned. 79 SyncEngineContext* sync_context_; // Not owned.
80 80
81 base::WeakPtrFactory<ConflictResolver> weak_ptr_factory_; 81 base::WeakPtrFactory<ConflictResolver> weak_ptr_factory_;
82 82
83 DISALLOW_COPY_AND_ASSIGN(ConflictResolver); 83 DISALLOW_COPY_AND_ASSIGN(ConflictResolver);
84 }; 84 };
85 85
86 } // namespace drive_backend 86 } // namespace drive_backend
87 } // namespace sync_file_system 87 } // namespace sync_file_system
88 88
89 #endif // CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_BACKEND_CONFLICT_RESOLVER_H_ 89 #endif // CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_BACKEND_CONFLICT_RESOLVER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698