Merged InitWithOptions() & Init() for LevelDB and ProtoDatabase.

LevelDB and ProtoDatabase had each had Init() and InitWithOptions()
members. LevelDB::Init() had it's own default option values whereas
ProtoDatabase::Init() used the stock leveldb_env::Options() instance.

This change simplifies the API by combining Init() and InitWithOptions()
into a single Init() that is passed an options instance where all
options values are honored *except* |env| and only if database_name
is empty (ie in-memory db).

Bug: 762587
Change-Id: I70b547b4c1bbc5542c58fb31faf12d0ba2de3f0b
Reviewed-on: https://chromium-review.googlesource.com/655145
Reviewed-by: Xing Liu <[email protected]>
Reviewed-by: Lei Zhang <[email protected]>
Reviewed-by: Marc Treib <[email protected]>
Reviewed-by: Nicolas Zea <[email protected]>
Reviewed-by: Tommy Nyquist <[email protected]>
Commit-Queue: Chris Mumford <[email protected]>
Cr-Commit-Position: refs/heads/master@{#503294}
diff --git a/components/leveldb_proto/proto_database.h b/components/leveldb_proto/proto_database.h
index 37fbf1b3..1d6305c 100644
--- a/components/leveldb_proto/proto_database.h
+++ b/components/leveldb_proto/proto_database.h
@@ -40,20 +40,12 @@
 
   virtual ~ProtoDatabase() {}
 
-  // Asynchronously initializes the object with default options. |callback| will
-  // be invoked on the calling thread when complete.
-  void Init(const char* client_name,
-            const base::FilePath& database_dir,
-            InitCallback callback) {
-    InitWithOptions(client_name, database_dir, leveldb_env::Options(),
-                    std::move(callback));
-  }
-
-  // Similar to Init, but takes additional options.
-  virtual void InitWithOptions(const char* client_name,
-                               const base::FilePath& database_dir,
-                               const leveldb_env::Options& options,
-                               InitCallback callback) = 0;
+  // Asynchronously initializes the object with the specified |options|.
+  // |callback| will be invoked on the calling thread when complete.
+  virtual void Init(const char* client_name,
+                    const base::FilePath& database_dir,
+                    const leveldb_env::Options& options,
+                    InitCallback callback) = 0;
 
   // Asynchronously saves |entries_to_save| and deletes entries from
   // |keys_to_remove| from the database. |callback| will be invoked on the
@@ -80,6 +72,11 @@
   virtual void Destroy(DestroyCallback callback) = 0;
 };
 
+// Return a new instance of Options, but with two additions:
+// 1) create_if_missing = true
+// 2) max_open_files = 0
+leveldb_env::Options CreateSimpleOptions();
+
 }  // namespace leveldb_proto
 
 #endif  // COMPONENTS_LEVELDB_PROTO_PROTO_DATABASE_H_