| 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 <memory> | 7 #include <memory> |
| 8 | 8 |
| 9 #include "base/memory/ptr_util.h" | 9 #include "base/memory/ptr_util.h" |
| 10 #include "components/leveldb/env_mojo.h" | 10 #include "components/leveldb/env_mojo.h" |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 | 85 |
| 86 if (s.ok()) { | 86 if (s.ok()) { |
| 87 mojo::MakeStrongBinding(base::MakeUnique<LevelDBDatabaseImpl>( | 87 mojo::MakeStrongBinding(base::MakeUnique<LevelDBDatabaseImpl>( |
| 88 std::move(env), base::WrapUnique(db)), | 88 std::move(env), base::WrapUnique(db)), |
| 89 std::move(database)); | 89 std::move(database)); |
| 90 } | 90 } |
| 91 | 91 |
| 92 callback.Run(LeveldbStatusToError(s)); | 92 callback.Run(LeveldbStatusToError(s)); |
| 93 } | 93 } |
| 94 | 94 |
| 95 void LevelDBServiceImpl::Destroy(filesystem::mojom::DirectoryPtr directory, |
| 96 const std::string& dbname, |
| 97 const DestroyCallback& callback) { |
| 98 leveldb::Options options; |
| 99 // Register our directory with the file thread. |
| 100 LevelDBMojoProxy::OpaqueDir* dir = |
| 101 thread_->RegisterDirectory(std::move(directory)); |
| 102 std::unique_ptr<MojoEnv> env_mojo(new MojoEnv(thread_, dir)); |
| 103 options.env = env_mojo.get(); |
| 104 callback.Run(LeveldbStatusToError(leveldb::DestroyDB(dbname, options))); |
| 105 } |
| 106 |
| 95 } // namespace leveldb | 107 } // namespace leveldb |
| OLD | NEW |