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

Side by Side Diff: storage/browser/fileapi/sandbox_origin_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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "storage/browser/fileapi/sandbox_origin_database.h" 5 #include "storage/browser/fileapi/sandbox_origin_database.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include <memory> 9 #include <memory>
10 #include <set> 10 #include <set>
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 return false; 81 return false;
82 82
83 std::string path = FilePathToString(db_path); 83 std::string path = FilePathToString(db_path);
84 leveldb::Options options; 84 leveldb::Options options;
85 options.max_open_files = 0; // Use minimum. 85 options.max_open_files = 0; // Use minimum.
86 options.create_if_missing = true; 86 options.create_if_missing = true;
87 options.reuse_logs = leveldb_env::kDefaultLogReuseOptionValue; 87 options.reuse_logs = leveldb_env::kDefaultLogReuseOptionValue;
88 if (env_override_) 88 if (env_override_)
89 options.env = env_override_; 89 options.env = env_override_;
90 leveldb::DB* db; 90 leveldb::DB* db;
91 leveldb::Status status = leveldb::DB::Open(options, path, &db); 91 leveldb::Status status = leveldb_env::DBRegistry::Open(options, path, &db);
92 ReportInitStatus(status); 92 ReportInitStatus(status);
93 if (status.ok()) { 93 if (status.ok()) {
94 db_.reset(db); 94 db_.reset(db);
95 return true; 95 return true;
96 } 96 }
97 HandleError(FROM_HERE, status); 97 HandleError(FROM_HERE, status);
98 98
99 // Corruption due to missing necessary MANIFEST-* file causes IOError instead 99 // Corruption due to missing necessary MANIFEST-* file causes IOError instead
100 // of Corruption error. 100 // of Corruption error.
101 // Try to repair database even when IOError case. 101 // Try to repair database even when IOError case.
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after
348 status = db_->Put(leveldb::WriteOptions(), LastPathKey(), std::string("-1")); 348 status = db_->Put(leveldb::WriteOptions(), LastPathKey(), std::string("-1"));
349 if (!status.ok()) { 349 if (!status.ok()) {
350 HandleError(FROM_HERE, status); 350 HandleError(FROM_HERE, status);
351 return false; 351 return false;
352 } 352 }
353 *number = -1; 353 *number = -1;
354 return true; 354 return true;
355 } 355 }
356 356
357 } // namespace storage 357 } // namespace storage
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698