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

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

Issue 2613223002: Remove ScopedVector from base::JSONValueConverter (Closed)
Patch Set: Rebase and address comments from mmenke@ Created 3 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
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 <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 10
11 #include <map> 11 #include <map>
12 #include <memory> 12 #include <memory>
13 #include <set> 13 #include <set>
14 #include <string> 14 #include <string>
15 #include <vector> 15 #include <vector>
16 16
17 #include "base/containers/hash_tables.h" 17 #include "base/containers/hash_tables.h"
18 #include "base/files/file_path.h" 18 #include "base/files/file_path.h"
19 #include "base/macros.h" 19 #include "base/macros.h"
20 #include "base/memory/scoped_vector.h"
21 #include "base/memory/weak_ptr.h" 20 #include "base/memory/weak_ptr.h"
22 #include "base/sequence_checker.h" 21 #include "base/sequence_checker.h"
23 #include "base/values.h" 22 #include "base/values.h"
24 #include "chrome/browser/sync_file_system/drive_backend/tracker_id_set.h" 23 #include "chrome/browser/sync_file_system/drive_backend/tracker_id_set.h"
25 #include "chrome/browser/sync_file_system/sync_status_code.h" 24 #include "chrome/browser/sync_file_system/sync_status_code.h"
26 25
27 namespace leveldb { 26 namespace leveldb {
28 class Env; 27 class Env;
29 } 28 }
30 29
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 // Populates empty database with initial data. 175 // Populates empty database with initial data.
177 // Adds a file metadata and a file tracker for |sync_root_folder|, and adds 176 // Adds a file metadata and a file tracker for |sync_root_folder|, and adds
178 // file metadata and file trackers for each |app_root_folders|. 177 // file metadata and file trackers for each |app_root_folders|.
179 // Newly added tracker for |sync_root_folder| is active and non-dirty. 178 // Newly added tracker for |sync_root_folder| is active and non-dirty.
180 // Newly added trackers for |app_root_folders| are inactive and non-dirty. 179 // Newly added trackers for |app_root_folders| are inactive and non-dirty.
181 // Trackers for |app_root_folders| are not yet registered as app-roots, but 180 // Trackers for |app_root_folders| are not yet registered as app-roots, but
182 // are ready to register. 181 // are ready to register.
183 SyncStatusCode PopulateInitialData( 182 SyncStatusCode PopulateInitialData(
184 int64_t largest_change_id, 183 int64_t largest_change_id,
185 const google_apis::FileResource& sync_root_folder, 184 const google_apis::FileResource& sync_root_folder,
186 const ScopedVector<google_apis::FileResource>& app_root_folders); 185 const std::vector<std::unique_ptr<google_apis::FileResource>>&
186 app_root_folders);
187 187
188 // Returns true if the folder associated to |app_id| is enabled. 188 // Returns true if the folder associated to |app_id| is enabled.
189 bool IsAppEnabled(const std::string& app_id) const; 189 bool IsAppEnabled(const std::string& app_id) const;
190 190
191 // Registers existing folder as the app-root for |app_id|. The folder 191 // Registers existing folder as the app-root for |app_id|. The folder
192 // must be an inactive folder that does not yet associated to any App. 192 // must be an inactive folder that does not yet associated to any App.
193 // This method associates the folder with |app_id| and activates it. 193 // This method associates the folder with |app_id| and activates it.
194 SyncStatusCode RegisterApp(const std::string& app_id, 194 SyncStatusCode RegisterApp(const std::string& app_id,
195 const std::string& folder_id); 195 const std::string& folder_id);
196 196
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
254 bool FindNearestActiveAncestor(const std::string& app_id, 254 bool FindNearestActiveAncestor(const std::string& app_id,
255 const base::FilePath& full_path, 255 const base::FilePath& full_path,
256 FileTracker* tracker, 256 FileTracker* tracker,
257 base::FilePath* path) const; 257 base::FilePath* path) const;
258 258
259 // Updates database by |changes|. 259 // Updates database by |changes|.
260 // Marks each tracker for modified file as dirty and adds new trackers if 260 // Marks each tracker for modified file as dirty and adds new trackers if
261 // needed. 261 // needed.
262 SyncStatusCode UpdateByChangeList( 262 SyncStatusCode UpdateByChangeList(
263 int64_t largest_change_id, 263 int64_t largest_change_id,
264 ScopedVector<google_apis::ChangeResource> changes); 264 std::vector<std::unique_ptr<google_apis::ChangeResource>> changes);
265 265
266 // Updates database by |resource|. 266 // Updates database by |resource|.
267 // Marks each tracker for modified file as dirty and adds new trackers if 267 // Marks each tracker for modified file as dirty and adds new trackers if
268 // needed. 268 // needed.
269 SyncStatusCode UpdateByFileResource( 269 SyncStatusCode UpdateByFileResource(
270 const google_apis::FileResource& resource); 270 const google_apis::FileResource& resource);
271 SyncStatusCode UpdateByFileResourceList( 271 SyncStatusCode UpdateByFileResourceList(
272 ScopedVector<google_apis::FileResource> resources); 272 std::vector<std::unique_ptr<google_apis::FileResource>> resources);
273 273
274 SyncStatusCode UpdateByDeletedRemoteFile(const std::string& file_id); 274 SyncStatusCode UpdateByDeletedRemoteFile(const std::string& file_id);
275 SyncStatusCode UpdateByDeletedRemoteFileList(const FileIDList& file_ids); 275 SyncStatusCode UpdateByDeletedRemoteFileList(const FileIDList& file_ids);
276 276
277 // Adds new FileTracker and FileMetadata. The database must not have 277 // Adds new FileTracker and FileMetadata. The database must not have
278 // |resource| beforehand. 278 // |resource| beforehand.
279 // The newly added tracker under |parent_tracker_id| is active and non-dirty. 279 // The newly added tracker under |parent_tracker_id| is active and non-dirty.
280 // Deactivates existing active tracker if exists that has the same title and 280 // Deactivates existing active tracker if exists that has the same title and
281 // parent_tracker to the newly added tracker. 281 // parent_tracker to the newly added tracker.
282 SyncStatusCode ReplaceActiveTrackerWithNewResource( 282 SyncStatusCode ReplaceActiveTrackerWithNewResource(
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
405 405
406 base::WeakPtrFactory<MetadataDatabase> weak_ptr_factory_; 406 base::WeakPtrFactory<MetadataDatabase> weak_ptr_factory_;
407 407
408 DISALLOW_COPY_AND_ASSIGN(MetadataDatabase); 408 DISALLOW_COPY_AND_ASSIGN(MetadataDatabase);
409 }; 409 };
410 410
411 } // namespace drive_backend 411 } // namespace drive_backend
412 } // namespace sync_file_system 412 } // namespace sync_file_system
413 413
414 #endif // CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_BACKEND_METADATA_DATABASE_H_ 414 #endif // CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_BACKEND_METADATA_DATABASE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698