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

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

Issue 2855953002: leveldb: Add DBTracker for exposing databases to Chrome's memory-infra. (Closed)
Patch Set: Created 3 years, 7 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_database.h" 5 #include "chrome/browser/sync_file_system/drive_backend/metadata_database.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <stack> 8 #include <stack>
9 #include <utility> 9 #include <utility>
10 10
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after
217 217
218 leveldb::Options options; 218 leveldb::Options options;
219 options.max_open_files = 0; // Use minimum. 219 options.max_open_files = 0; // Use minimum.
220 options.create_if_missing = true; 220 options.create_if_missing = true;
221 options.paranoid_checks = true; 221 options.paranoid_checks = true;
222 options.reuse_logs = leveldb_env::kDefaultLogReuseOptionValue; 222 options.reuse_logs = leveldb_env::kDefaultLogReuseOptionValue;
223 if (env_override) 223 if (env_override)
224 options.env = env_override; 224 options.env = env_override;
225 leveldb::DB* db = nullptr; 225 leveldb::DB* db = nullptr;
226 leveldb::Status db_status = 226 leveldb::Status db_status =
227 leveldb::DB::Open(options, path.AsUTF8Unsafe(), &db); 227 leveldb_env::DBRegistry::Open(options, path.AsUTF8Unsafe(), &db);
228 UMA_HISTOGRAM_ENUMERATION("SyncFileSystem.Database.Open", 228 UMA_HISTOGRAM_ENUMERATION("SyncFileSystem.Database.Open",
229 leveldb_env::GetLevelDBStatusUMAValue(db_status), 229 leveldb_env::GetLevelDBStatusUMAValue(db_status),
230 leveldb_env::LEVELDB_STATUS_MAX); 230 leveldb_env::LEVELDB_STATUS_MAX);
231 SyncStatusCode status = LevelDBStatusToSyncStatusCode(db_status); 231 SyncStatusCode status = LevelDBStatusToSyncStatusCode(db_status);
232 if (status != SYNC_STATUS_OK) { 232 if (status != SYNC_STATUS_OK) {
233 delete db; 233 delete db;
234 return status; 234 return status;
235 } 235 }
236 236
237 db_out->reset(new LevelDBWrapper(base::WrapUnique(db))); 237 db_out->reset(new LevelDBWrapper(base::WrapUnique(db)));
(...skipping 1567 matching lines...) Expand 10 before | Expand all | Expand 10 after
1805 return false; 1805 return false;
1806 1806
1807 if (!parents.empty()) 1807 if (!parents.empty())
1808 return false; 1808 return false;
1809 1809
1810 return true; 1810 return true;
1811 } 1811 }
1812 1812
1813 } // namespace drive_backend 1813 } // namespace drive_backend
1814 } // namespace sync_file_system 1814 } // namespace sync_file_system
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698