Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "components/leveldb/leveldb_service_impl.h" | 5 #include "components/leveldb/leveldb_service_impl.h" |
| 6 | 6 |
| 7 #include "components/leveldb/env_mojo.h" | 7 #include "components/leveldb/env_mojo.h" |
| 8 #include "components/leveldb/leveldb_database_impl.h" | 8 #include "components/leveldb/leveldb_database_impl.h" |
| 9 #include "components/leveldb/util.h" | 9 #include "components/leveldb/util.h" |
| 10 #include "third_party/leveldatabase/env_chromium.h" | 10 #include "third_party/leveldatabase/env_chromium.h" |
| 11 #include "third_party/leveldatabase/src/include/leveldb/db.h" | 11 #include "third_party/leveldatabase/src/include/leveldb/db.h" |
| 12 #include "third_party/leveldatabase/src/include/leveldb/env.h" | 12 #include "third_party/leveldatabase/src/include/leveldb/env.h" |
| 13 #include "third_party/leveldatabase/src/include/leveldb/filter_policy.h" | 13 #include "third_party/leveldatabase/src/include/leveldb/filter_policy.h" |
| 14 #include "third_party/leveldatabase/src/include/leveldb/slice.h" | 14 #include "third_party/leveldatabase/src/include/leveldb/slice.h" |
| 15 | 15 |
| 16 namespace leveldb { | 16 namespace leveldb { |
| 17 | 17 |
| 18 LevelDBServiceImpl::LevelDBServiceImpl() | 18 LevelDBServiceImpl::LevelDBServiceImpl() : thread_(new LevelDBFileThread) {} |
|
michaeln
2016/03/17 22:35:41
ok, so we get one new thread per profile
Elliot Glaysher
2016/03/18 19:41:12
For now at least.
It might be possible to depinje
| |
| 19 : thread_(new LevelDBFileThread) { | |
| 20 } | |
| 21 | 19 |
| 22 LevelDBServiceImpl::~LevelDBServiceImpl() {} | 20 LevelDBServiceImpl::~LevelDBServiceImpl() {} |
| 23 | 21 |
| 24 void LevelDBServiceImpl::Open(filesystem::DirectoryPtr directory, | 22 void LevelDBServiceImpl::Open(filesystem::DirectoryPtr directory, |
| 25 const mojo::String& dbname, | 23 const mojo::String& dbname, |
| 26 mojo::InterfaceRequest<LevelDBDatabase> database, | 24 leveldb::LevelDBDatabaseRequest database, |
| 27 const OpenCallback& callback) { | 25 const OpenCallback& callback) { |
| 28 // This is the place where we open a database. | 26 // This is the place where we open a database. |
| 29 leveldb::Options options; | 27 leveldb::Options options; |
| 30 options.create_if_missing = true; | 28 options.create_if_missing = true; |
| 31 options.paranoid_checks = true; | 29 options.paranoid_checks = true; |
| 32 // TODO(erg): Do we need a filter policy? | 30 // TODO(erg): Do we need a filter policy? |
| 33 options.reuse_logs = leveldb_env::kDefaultLogReuseOptionValue; | 31 options.reuse_logs = leveldb_env::kDefaultLogReuseOptionValue; |
| 34 options.compression = leveldb::kSnappyCompression; | 32 options.compression = leveldb::kSnappyCompression; |
| 35 | 33 |
| 36 // For info about the troubles we've run into with this parameter, see: | 34 // For info about the troubles we've run into with this parameter, see: |
| (...skipping 12 matching lines...) Expand all Loading... | |
| 49 | 47 |
| 50 if (s.ok()) { | 48 if (s.ok()) { |
| 51 new LevelDBDatabaseImpl(std::move(database), std::move(env_mojo), | 49 new LevelDBDatabaseImpl(std::move(database), std::move(env_mojo), |
| 52 scoped_ptr<leveldb::DB>(db)); | 50 scoped_ptr<leveldb::DB>(db)); |
| 53 } | 51 } |
| 54 | 52 |
| 55 callback.Run(LeveldbStatusToError(s)); | 53 callback.Run(LeveldbStatusToError(s)); |
| 56 } | 54 } |
| 57 | 55 |
| 58 } // namespace leveldb | 56 } // namespace leveldb |
| OLD | NEW |