| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef COMPONENTS_LEVELDB_LEVELDB_SERVICE_IMPL_H_ | |
| 6 #define COMPONENTS_LEVELDB_LEVELDB_SERVICE_IMPL_H_ | |
| 7 | |
| 8 #include "base/memory/ref_counted.h" | |
| 9 #include "components/leveldb/leveldb_file_thread.h" | |
| 10 #include "components/leveldb/public/interfaces/leveldb.mojom.h" | |
| 11 | |
| 12 namespace leveldb { | |
| 13 | |
| 14 // Creates LevelDBDatabases based scoped to a |directory|/|dbname|. | |
| 15 class LevelDBServiceImpl : public LevelDBService { | |
| 16 public: | |
| 17 LevelDBServiceImpl(); | |
| 18 ~LevelDBServiceImpl() override; | |
| 19 | |
| 20 // Overridden from LevelDBService: | |
| 21 void Open(filesystem::DirectoryPtr directory, | |
| 22 const mojo::String& dbname, | |
| 23 mojo::InterfaceRequest<LevelDBDatabase> database, | |
| 24 const OpenCallback& callback) override; | |
| 25 | |
| 26 private: | |
| 27 // Thread to own the mojo message pipe. Because leveldb spawns multiple | |
| 28 // threads that want to call file stuff, we create a dedicated thread to send | |
| 29 // and receive mojo message calls. | |
| 30 scoped_refptr<LevelDBFileThread> thread_; | |
| 31 | |
| 32 DISALLOW_COPY_AND_ASSIGN(LevelDBServiceImpl); | |
| 33 }; | |
| 34 | |
| 35 } // namespace leveldb | |
| 36 | |
| 37 #endif // COMPONENTS_LEVELDB_LEVELDB_SERVICE_IMPL_H_ | |
| OLD | NEW |