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..2af6d0fe611da1adf9d5cdb2210fa17ee958282a |
| --- /dev/null |
| +++ b/components/data_reduction_proxy/core/browser/data_reduction_proxy_store_impl.h |
| @@ -0,0 +1,57 @@ |
| +// 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/memory/weak_ptr.h" |
|
bengr
2015/06/25 23:22:55
Why is this needed?
Not at Google. Contact bengr
2015/06/29 20:53:27
Done.
|
| +#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. |
| + friend class base::RefCountedThreadSafe<DataReductionProxyStore>; |
|
michaeln
2015/06/26 20:15:01
drive by: is this friend decl really needed?
Not at Google. Contact bengr
2015/06/29 20:53:27
Removed here. Declaration in DataReductionProxySto
|
| + ~DataReductionProxyStoreImpl() override; |
| + Status OpenDB(); |
|
bengr
2015/06/25 23:22:55
Please add comments for these methods and separate
Not at Google. Contact bengr
2015/06/29 20:53:27
Done.
|
| + 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_ |