| 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..36293bf70d6c3f6eac5e8d1d5f789ab4d8bf8f5e
|
| --- /dev/null
|
| +++ b/components/data_reduction_proxy/core/browser/data_reduction_proxy_store_impl.h
|
| @@ -0,0 +1,60 @@
|
| +// 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"
|
| +#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);
|
| +
|
| + 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:
|
| + // Ref counted classes have private destructors to prevent accidental deletion
|
| + // of the object when there are still references to it.
|
| + ~DataReductionProxyStoreImpl() override;
|
| +
|
| + // 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_;
|
| + base::ThreadChecker thread_checker_;
|
| + 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_
|
|
|