| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 "content/browser/indexed_db/leveldb/leveldb_database.h" | 5 #include "content/browser/indexed_db/leveldb/leveldb_database.h" |
| 6 | 6 |
| 7 #include <inttypes.h> | 7 #include <inttypes.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <cerrno> | 10 #include <cerrno> |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 134 options.write_buffer_size = | 134 options.write_buffer_size = |
| 135 leveldb_env::WriteBufferSize(base::SysInfo::AmountOfTotalDiskSpace(path)); | 135 leveldb_env::WriteBufferSize(base::SysInfo::AmountOfTotalDiskSpace(path)); |
| 136 | 136 |
| 137 // For info about the troubles we've run into with this parameter, see: | 137 // For info about the troubles we've run into with this parameter, see: |
| 138 // https://code.google.com/p/chromium/issues/detail?id=227313#c11 | 138 // https://code.google.com/p/chromium/issues/detail?id=227313#c11 |
| 139 options.max_open_files = 80; | 139 options.max_open_files = 80; |
| 140 options.env = env; | 140 options.env = env; |
| 141 | 141 |
| 142 // ChromiumEnv assumes UTF8, converts back to FilePath before using. | 142 // ChromiumEnv assumes UTF8, converts back to FilePath before using. |
| 143 leveldb::DB* db_ptr = nullptr; | 143 leveldb::DB* db_ptr = nullptr; |
| 144 leveldb::Status s = leveldb::DB::Open(options, path.AsUTF8Unsafe(), &db_ptr); | 144 leveldb::Status s = leveldb_env::DBRegistry::Open(options, path.AsUTF8Unsafe()
, &db_ptr); |
| 145 db->reset(db_ptr); | 145 db->reset(db_ptr); |
| 146 | 146 |
| 147 return s; | 147 return s; |
| 148 } | 148 } |
| 149 | 149 |
| 150 leveldb::Status LevelDBDatabase::Destroy(const base::FilePath& file_name) { | 150 leveldb::Status LevelDBDatabase::Destroy(const base::FilePath& file_name) { |
| 151 leveldb::Options options; | 151 leveldb::Options options; |
| 152 options.env = LevelDBEnv::Get(); | 152 options.env = LevelDBEnv::Get(); |
| 153 // ChromiumEnv assumes UTF8, converts back to FilePath before using. | 153 // ChromiumEnv assumes UTF8, converts back to FilePath before using. |
| 154 return leveldb::DestroyDB(file_name.AsUTF8Unsafe(), options); | 154 return leveldb::DestroyDB(file_name.AsUTF8Unsafe(), options); |
| (...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 514 void LevelDBDatabase::OnIteratorDestroyed(LevelDBIterator* iter) { | 514 void LevelDBDatabase::OnIteratorDestroyed(LevelDBIterator* iter) { |
| 515 DCHECK_GT(num_iterators_, 0u); | 515 DCHECK_GT(num_iterators_, 0u); |
| 516 --num_iterators_; | 516 --num_iterators_; |
| 517 auto it = iterator_lru_.Peek(iter); | 517 auto it = iterator_lru_.Peek(iter); |
| 518 if (it == iterator_lru_.end()) | 518 if (it == iterator_lru_.end()) |
| 519 return; | 519 return; |
| 520 iterator_lru_.Erase(it); | 520 iterator_lru_.Erase(it); |
| 521 } | 521 } |
| 522 | 522 |
| 523 } // namespace content | 523 } // namespace content |
| OLD | NEW |