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

Unified Diff: components/leveldb/leveldb_app.cc

Issue 1708253004: mojo: Get mojo:leveldb and mojo:filesystem compiled into content. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Probable fix to the build flake. Created 4 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « components/leveldb/leveldb_app.h ('k') | components/leveldb/leveldb_service_impl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/leveldb/leveldb_app.cc
diff --git a/components/leveldb/leveldb_app.cc b/components/leveldb/leveldb_app.cc
index bd8ac71905cca813b8641930506223676f39b7d4..1e9d1682da4bb2e021eade0bee4958b0bfa2d851 100644
--- a/components/leveldb/leveldb_app.cc
+++ b/components/leveldb/leveldb_app.cc
@@ -4,15 +4,8 @@
#include "components/leveldb/leveldb_app.h"
-#include "components/leveldb/env_mojo.h"
-#include "components/leveldb/leveldb_database_impl.h"
-#include "components/leveldb/util.h"
+#include "components/leveldb/leveldb_service_impl.h"
#include "mojo/shell/public/cpp/connection.h"
-#include "third_party/leveldatabase/env_chromium.h"
-#include "third_party/leveldatabase/src/include/leveldb/db.h"
-#include "third_party/leveldatabase/src/include/leveldb/env.h"
-#include "third_party/leveldatabase/src/include/leveldb/filter_policy.h"
-#include "third_party/leveldatabase/src/include/leveldb/slice.h"
namespace leveldb {
@@ -24,7 +17,7 @@ void LevelDBApp::Initialize(mojo::Shell* shell,
const std::string& url,
uint32_t id) {
tracing_.Initialize(shell, url);
- thread_ = new LevelDBFileThread;
+ service_.reset(new LevelDBServiceImpl);
}
bool LevelDBApp::AcceptConnection(mojo::Connection* connection) {
@@ -34,41 +27,7 @@ bool LevelDBApp::AcceptConnection(mojo::Connection* connection) {
void LevelDBApp::Create(mojo::Connection* connection,
mojo::InterfaceRequest<LevelDBService> request) {
- bindings_.AddBinding(this, std::move(request));
-}
-
-void LevelDBApp::Open(filesystem::DirectoryPtr directory,
- const mojo::String& dbname,
- mojo::InterfaceRequest<LevelDBDatabase> database,
- const OpenCallback& callback) {
- // This is the place where we open a database.
- leveldb::Options options;
- options.create_if_missing = true;
- options.paranoid_checks = true;
- // TODO(erg): Do we need a filter policy?
- options.reuse_logs = leveldb_env::kDefaultLogReuseOptionValue;
- options.compression = leveldb::kSnappyCompression;
-
- // For info about the troubles we've run into with this parameter, see:
- // https://code.google.com/p/chromium/issues/detail?id=227313#c11
- options.max_open_files = 80;
-
- // Register our directory with the file thread.
- LevelDBFileThread::OpaqueDir* dir =
- thread_->RegisterDirectory(std::move(directory));
-
- scoped_ptr<MojoEnv> env_mojo(new MojoEnv(thread_, dir));
- options.env = env_mojo.get();
-
- leveldb::DB* db = nullptr;
- leveldb::Status s = leveldb::DB::Open(options, dbname.To<std::string>(), &db);
-
- if (s.ok()) {
- new LevelDBDatabaseImpl(std::move(database), std::move(env_mojo),
- scoped_ptr<leveldb::DB>(db));
- }
-
- callback.Run(LeveldbStatusToError(s));
+ bindings_.AddBinding(service_.get(), std::move(request));
}
} // namespace leveldb
« no previous file with comments | « components/leveldb/leveldb_app.h ('k') | components/leveldb/leveldb_service_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698