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

Side by Side Diff: chrome/browser/sync_file_system/drive_backend/metadata_db_migration_util.cc

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 #include "chrome/browser/sync_file_system/drive_backend/metadata_db_migration_ut il.h" 5 #include "chrome/browser/sync_file_system/drive_backend/metadata_db_migration_ut il.h"
6 6
7 #include <memory>
8
7 #include "base/files/file_path.h" 9 #include "base/files/file_path.h"
8 #include "base/memory/scoped_ptr.h"
9 #include "base/strings/string_util.h" 10 #include "base/strings/string_util.h"
10 #include "chrome/browser/sync_file_system/drive_backend/drive_backend_util.h" 11 #include "chrome/browser/sync_file_system/drive_backend/drive_backend_util.h"
11 #include "storage/common/fileapi/file_system_types.h" 12 #include "storage/common/fileapi/file_system_types.h"
12 #include "storage/common/fileapi/file_system_util.h" 13 #include "storage/common/fileapi/file_system_util.h"
13 #include "third_party/leveldatabase/src/include/leveldb/db.h" 14 #include "third_party/leveldatabase/src/include/leveldb/db.h"
14 #include "third_party/leveldatabase/src/include/leveldb/write_batch.h" 15 #include "third_party/leveldatabase/src/include/leveldb/write_batch.h"
15 #include "url/gurl.h" 16 #include "url/gurl.h"
16 17
17 namespace sync_file_system { 18 namespace sync_file_system {
18 namespace drive_backend { 19 namespace drive_backend {
(...skipping 15 matching lines...) Expand all
34 const char kMultiTrackerByFileIDKeyPrefix[] = "MULTI_FILE: "; 35 const char kMultiTrackerByFileIDKeyPrefix[] = "MULTI_FILE: ";
35 const char kActiveTrackerIDByParentAndTitleKeyPrefix[] = "ACTIVE_PATH: "; 36 const char kActiveTrackerIDByParentAndTitleKeyPrefix[] = "ACTIVE_PATH: ";
36 const char kTrackerIDByParentAndTitleKeyPrefix[] = "TRACKER_PATH: "; 37 const char kTrackerIDByParentAndTitleKeyPrefix[] = "TRACKER_PATH: ";
37 const char kMultiBackingParentAndTitleKeyPrefix[] = "MULTI_PATH: "; 38 const char kMultiBackingParentAndTitleKeyPrefix[] = "MULTI_PATH: ";
38 const char kDirtyIDKeyPrefix[] = "DIRTY: "; 39 const char kDirtyIDKeyPrefix[] = "DIRTY: ";
39 const char kDemotedDirtyIDKeyPrefix[] = "DEMOTED_DIRTY: "; 40 const char kDemotedDirtyIDKeyPrefix[] = "DEMOTED_DIRTY: ";
40 41
41 leveldb::WriteBatch write_batch; 42 leveldb::WriteBatch write_batch;
42 write_batch.Put(kDatabaseVersionKey, "3"); 43 write_batch.Put(kDatabaseVersionKey, "3");
43 44
44 scoped_ptr<leveldb::Iterator> itr(db->NewIterator(leveldb::ReadOptions())); 45 std::unique_ptr<leveldb::Iterator> itr(
46 db->NewIterator(leveldb::ReadOptions()));
45 for (itr->SeekToFirst(); itr->Valid(); itr->Next()) { 47 for (itr->SeekToFirst(); itr->Valid(); itr->Next()) {
46 std::string key = itr->key().ToString(); 48 std::string key = itr->key().ToString();
47 49
48 // Do nothing for valid entries in both versions. 50 // Do nothing for valid entries in both versions.
49 if (base::StartsWith(key, kServiceMetadataKey, 51 if (base::StartsWith(key, kServiceMetadataKey,
50 base::CompareCase::SENSITIVE) || 52 base::CompareCase::SENSITIVE) ||
51 base::StartsWith(key, kFileMetadataKeyPrefix, 53 base::StartsWith(key, kFileMetadataKeyPrefix,
52 base::CompareCase::SENSITIVE) || 54 base::CompareCase::SENSITIVE) ||
53 base::StartsWith(key, kFileTrackerKeyPrefix, 55 base::StartsWith(key, kFileTrackerKeyPrefix,
54 base::CompareCase::SENSITIVE)) { 56 base::CompareCase::SENSITIVE)) {
(...skipping 25 matching lines...) Expand all
80 82
81 DVLOG(3) << "Unknown key: " << key << " was found."; 83 DVLOG(3) << "Unknown key: " << key << " was found.";
82 } 84 }
83 85
84 return LevelDBStatusToSyncStatusCode( 86 return LevelDBStatusToSyncStatusCode(
85 db->Write(leveldb::WriteOptions(), &write_batch)); 87 db->Write(leveldb::WriteOptions(), &write_batch));
86 } 88 }
87 89
88 } // namespace drive_backend 90 } // namespace drive_backend
89 } // namespace sync_file_system 91 } // namespace sync_file_system
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698