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

Unified Diff: components/leveldb/leveldb_service_impl.cc

Issue 2326913003: Privatize StrongBinding lifetime management (Closed)
Patch Set: rebase Created 4 years, 3 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
Index: components/leveldb/leveldb_service_impl.cc
diff --git a/components/leveldb/leveldb_service_impl.cc b/components/leveldb/leveldb_service_impl.cc
index 587a78edcba8b80ae4d239fd69e999ee04f361e9..6df7ad0b9cc738dc6ef6b73eb7ef6999e3e7c874 100644
--- a/components/leveldb/leveldb_service_impl.cc
+++ b/components/leveldb/leveldb_service_impl.cc
@@ -10,6 +10,7 @@
#include "components/leveldb/env_mojo.h"
#include "components/leveldb/leveldb_database_impl.h"
#include "components/leveldb/public/cpp/util.h"
+#include "mojo/public/cpp/bindings/strong_binding.h"
#include "third_party/leveldatabase/env_chromium.h"
#include "third_party/leveldatabase/src/helpers/memenv/memenv.h"
#include "third_party/leveldatabase/src/include/leveldb/db.h"
@@ -60,8 +61,9 @@ void LevelDBServiceImpl::OpenWithOptions(
leveldb::Status s = leveldb::DB::Open(options, dbname, &db);
if (s.ok()) {
- new LevelDBDatabaseImpl(std::move(database), std::move(env_mojo),
- base::WrapUnique(db));
+ mojo::MakeStrongBinding(base::MakeUnique<LevelDBDatabaseImpl>(
+ std::move(env_mojo), base::WrapUnique(db)),
+ std::move(database));
}
callback.Run(LeveldbStatusToError(s));
@@ -82,8 +84,9 @@ void LevelDBServiceImpl::OpenInMemory(
leveldb::Status s = leveldb::DB::Open(options, "", &db);
if (s.ok()) {
- new LevelDBDatabaseImpl(std::move(database), std::move(env),
- base::WrapUnique(db));
+ mojo::MakeStrongBinding(base::MakeUnique<LevelDBDatabaseImpl>(
+ std::move(env), base::WrapUnique(db)),
+ std::move(database));
}
callback.Run(LeveldbStatusToError(s));
« no previous file with comments | « components/leveldb/leveldb_database_impl.cc ('k') | components/safe_json/utility/safe_json_parser_mojo_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698