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

Unified Diff: components/data_reduction_proxy/core/browser/db_data_store_impl.h

Issue 1173343009: LevelDB storage for data reduction proxy to store data usage stats. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rename classes to remove DataReductionProxy prefix. Created 5 years, 5 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/data_reduction_proxy/core/browser/db_data_store_impl.h
diff --git a/components/data_reduction_proxy/core/browser/db_data_store_impl.h b/components/data_reduction_proxy/core/browser/db_data_store_impl.h
new file mode 100644
index 0000000000000000000000000000000000000000..c8e9ba0b6aafbc111ccb7a4f1cc522a84239cd7b
--- /dev/null
+++ b/components/data_reduction_proxy/core/browser/db_data_store_impl.h
@@ -0,0 +1,52 @@
+// Copyright 2015 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_DATA_REDUCTION_PROXY_CORE_BROWSER_DB_DATA_STORE_IMPL_H_
+#define COMPONENTS_DATA_REDUCTION_PROXY_CORE_BROWSER_DB_DATA_STORE_IMPL_H_
+
+#include <map>
+#include <string>
+
+#include "base/files/file_path.h"
+#include "base/macros.h"
+#include "base/memory/scoped_ptr.h"
+#include "base/sequence_checker.h"
+#include "components/data_reduction_proxy/core/browser/db_data_store.h"
+
+namespace leveldb {
+class DB;
+}
+
+namespace data_reduction_proxy {
+
+// Implementation of DataReductionProxyStore using LevelDB.
jeremyim 2015/07/08 18:21:46 Rename in comment
Not at Google. Contact bengr 2015/07/08 19:07:20 Done.
+class DBDataStoreImpl : public DBDataStore {
+ public:
+ explicit DBDataStoreImpl(const base::FilePath& profile_path);
+ ~DBDataStoreImpl() override;
+
+ void InitializeOnDBThread() override;
+
+ Status Get(const std::string& key, std::string* value) override;
+
+ Status Put(const std::map<std::string, std::string>& map) override;
+
+ private:
+ // Opens the underlying Level DB for read and write.
+ Status OpenDB();
+
+ // Deletes the LevelDB and recreates it. Call this method if any DB calls
+ // return |CORRUPTED| status.
+ void RecreateDB();
+
+ scoped_ptr<leveldb::DB> db_;
+ const base::FilePath profile_path_;
+ base::SequenceChecker sequence_checker_;
+
+ DISALLOW_COPY_AND_ASSIGN(DBDataStoreImpl);
+};
+
+} // namespace data_reduction_proxy
+
+#endif // COMPONENTS_DATA_REDUCTION_PROXY_CORE_BROWSER_DB_DATA_STORE_IMPL_H_

Powered by Google App Engine
This is Rietveld 408576698