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

Unified Diff: components/leveldb/leveldb_service_impl.h

Issue 2722293002: Fix lifetime of leveldb::MojoEnv instances. (Closed)
Patch Set: annotate leaks Created 3 years, 8 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.h
diff --git a/components/leveldb/leveldb_service_impl.h b/components/leveldb/leveldb_service_impl.h
index aca402228a57c1f5a54f548f6b8011e49761d141..f3ca018547ac737040008e117d484d231c48e26f 100644
--- a/components/leveldb/leveldb_service_impl.h
+++ b/components/leveldb/leveldb_service_impl.h
@@ -12,18 +12,18 @@
namespace leveldb {
+class MojoEnv;
+
// Creates LevelDBDatabases based scoped to a |directory|/|dbname|.
class LevelDBServiceImpl : public mojom::LevelDBService {
public:
// The |file_task_runner| is used to run tasks to interact with the
// file_service. Specifically this task runner must NOT be the same as the
// task runner this implementation runs on, or deadlock might occur.
- LevelDBServiceImpl(
- scoped_refptr<base::SingleThreadTaskRunner> file_task_runner);
+ explicit LevelDBServiceImpl(MojoEnv* env);
~LevelDBServiceImpl() override;
// Overridden from LevelDBService:
- void SetEnvironmentName(const std::string& name) override;
void Open(filesystem::mojom::DirectoryPtr directory,
const std::string& dbname,
leveldb::mojom::LevelDBDatabaseAssociatedRequest database,
@@ -41,12 +41,7 @@ class LevelDBServiceImpl : public mojom::LevelDBService {
const DestroyCallback& callback) override;
private:
- // Thread to own the mojo message pipe. Because leveldb spawns multiple
- // threads that want to call file stuff, we create a dedicated thread to send
- // and receive mojo message calls.
- scoped_refptr<LevelDBMojoProxy> thread_;
-
- std::string environment_name_;
+ MojoEnv* env_;
DISALLOW_COPY_AND_ASSIGN(LevelDBServiceImpl);
};

Powered by Google App Engine
This is Rietveld 408576698