Chromium Code Reviews| Index: components/data_reduction_proxy/core/browser/db_data_owner.h |
| diff --git a/components/data_reduction_proxy/core/browser/db_data_owner.h b/components/data_reduction_proxy/core/browser/db_data_owner.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..2a80194e2d0dc9d88876e970374e61a09055d263 |
| --- /dev/null |
| +++ b/components/data_reduction_proxy/core/browser/db_data_owner.h |
| @@ -0,0 +1,49 @@ |
| +// 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_SERVICE_H_ |
| +#define COMPONENTS_DATA_REDUCTION_PROXY_CORE_BROWSER_DB_SERVICE_H_ |
| + |
| +#include "base/macros.h" |
| +#include "base/memory/weak_ptr.h" |
| +#include "base/sequence_checker.h" |
| + |
| +namespace base { |
| +class FilePath; |
| +} // namespace base |
| + |
| +namespace data_reduction_proxy { |
| +class DBDataStore; |
|
jeremyim
2015/07/08 18:21:46
Sorting
Not at Google. Contact bengr
2015/07/08 19:07:20
Done.
|
| +class DataUsageStore; |
| +class DataUsageBucket; |
| + |
| +typedef base::Callback<void(scoped_ptr<DataUsageBucket>)> |
| + OnLoadDataUsageBucketCallback; |
| + |
| +// Contains and initializes all Data Reduction Proxy objects that have a |
| +// lifetime based on the DB thread. |
| +class DBDataOwner { |
| + public: |
| + explicit DBDataOwner(scoped_ptr<DBDataStore> store); |
| + virtual ~DBDataOwner(); |
| + |
| + void InitializeOnDBThread(); |
| + |
| + void LoadCurrentDataUsageBucket(DataUsageBucket* bucket); |
| + |
| + void StoreCurrentDataUsageBucket(scoped_ptr<DataUsageBucket> current); |
| + |
| + base::WeakPtr<DBDataOwner> GetWeakPtr(); |
| + |
| + private: |
| + scoped_ptr<DBDataStore> store_; |
| + scoped_ptr<DataUsageStore> data_usage_; |
| + base::SequenceChecker sequence_checker_; |
| + base::WeakPtrFactory<DBDataOwner> weak_factory_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(DBDataOwner); |
| +}; |
| + |
| +} // namespace data_reduction_proxy |
| +#endif // COMPONENTS_DATA_REDUCTION_PROXY_CORE_BROWSER_DB_SERVICE_H_ |