Chromium Code Reviews| Index: components/data_reduction_proxy/core/browser/data_reduction_proxy_store_impl.h |
| diff --git a/components/data_reduction_proxy/core/browser/data_reduction_proxy_store_impl.h b/components/data_reduction_proxy/core/browser/data_reduction_proxy_store_impl.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..6236907645a954fe21deb6ca9f04f4c056e116af |
| --- /dev/null |
| +++ b/components/data_reduction_proxy/core/browser/data_reduction_proxy_store_impl.h |
| @@ -0,0 +1,56 @@ |
| +// 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_DATA_REDUCTION_PROXY_STORE_IMPL_H_ |
| +#define COMPONENTS_DATA_REDUCTION_PROXY_CORE_BROWSER_DATA_REDUCTION_PROXY_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/threading/thread_checker.h" |
|
jeremyim
2015/07/01 21:31:01
Unused
Not at Google. Contact bengr
2015/07/01 23:17:37
Done.
|
| +#include "components/data_reduction_proxy/core/browser/data_reduction_proxy_store.h" |
| + |
| +namespace leveldb { |
| +class DB; |
| +class Iterator; |
| +class Slice; |
| +class Status; |
| +class WriteBatch; |
| +} |
| + |
| +namespace data_reduction_proxy { |
| +class DataUsageBucket; |
| + |
| +// Implementation of DataReductionProxyStore using LevelDB. |
| +class DataReductionProxyStoreImpl : public DataReductionProxyStore { |
| + public: |
| + explicit DataReductionProxyStoreImpl(const base::FilePath& profile_path); |
| + ~DataReductionProxyStoreImpl() 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_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(DataReductionProxyStoreImpl); |
| +}; |
| + |
| +} // namespace data_reduction_proxy |
| + |
| +#endif // COMPONENTS_DATA_REDUCTION_PROXY_CORE_BROWSER_DATA_REDUCTION_PROXY_STORE_IMPL_H_ |