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

Unified Diff: components/leveldb_proto/leveldb_database.h

Issue 330833002: Extract protobuf database into a new 'leveldb_proto' component (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix test Created 6 years, 6 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_proto/README ('k') | components/leveldb_proto/leveldb_database.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/leveldb_proto/leveldb_database.h
diff --git a/components/leveldb_proto/leveldb_database.h b/components/leveldb_proto/leveldb_database.h
new file mode 100644
index 0000000000000000000000000000000000000000..16d3c304ccdcc13eea2be740b7bb7c2253362f9b
--- /dev/null
+++ b/components/leveldb_proto/leveldb_database.h
@@ -0,0 +1,42 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef COMPONENTS_LEVELDB_PROTO_LEVELDB_DATABASE_H_
+#define COMPONENTS_LEVELDB_PROTO_LEVELDB_DATABASE_H_
+
+#include <string>
+#include <vector>
+
+#include "base/files/file_path.h"
+#include "base/memory/scoped_ptr.h"
+#include "base/threading/thread_collision_warner.h"
+
+namespace leveldb {
+class DB;
+} // namespace leveldb
+
+namespace leveldb_proto {
+
+// Interacts with the LevelDB third party module.
+// Once constructed, function calls and destruction should all occur on the
+// same thread (not necessarily the same as the constructor).
+class LevelDB {
+ public:
+ LevelDB();
+ virtual ~LevelDB();
+
+ virtual bool Init(const base::FilePath& database_dir);
+ virtual bool Save(
+ const std::vector<std::pair<std::string, std::string> >& pairs_to_save,
+ const std::vector<std::string>& keys_to_remove);
+ virtual bool Load(std::vector<std::string>* entries);
+
+ private:
+ DFAKE_MUTEX(thread_checker_);
+ scoped_ptr<leveldb::DB> db_;
+};
+
+} // namespace leveldb_proto
+
+#endif // COMPONENTS_LEVELDB_PROTO_LEVELDB_DATABASE_H_
« no previous file with comments | « components/leveldb_proto/README ('k') | components/leveldb_proto/leveldb_database.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698