| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CHROME_BROWSER_BUDGET_SERVICE_BUDGET_DATABASE_H_ | 5 #ifndef CHROME_BROWSER_BUDGET_SERVICE_BUDGET_DATABASE_H_ |
| 6 #define CHROME_BROWSER_BUDGET_SERVICE_BUDGET_DATABASE_H_ | 6 #define CHROME_BROWSER_BUDGET_SERVICE_BUDGET_DATABASE_H_ |
| 7 | 7 |
| 8 #include <list> | 8 #include <list> |
| 9 #include <memory> | 9 #include <memory> |
| 10 #include <unordered_map> | 10 #include <unordered_map> |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 bool success, | 76 bool success, |
| 77 std::unique_ptr<budget_service::Budget> budget); | 77 std::unique_ptr<budget_service::Budget> budget); |
| 78 | 78 |
| 79 void DidGetBudget(const GURL& origin, | 79 void DidGetBudget(const GURL& origin, |
| 80 const GetBudgetDetailsCallback& callback, | 80 const GetBudgetDetailsCallback& callback, |
| 81 bool success); | 81 bool success); |
| 82 | 82 |
| 83 void WriteCachedValuesToDatabase(const GURL& origin, | 83 void WriteCachedValuesToDatabase(const GURL& origin, |
| 84 const StoreBudgetCallback& callback); | 84 const StoreBudgetCallback& callback); |
| 85 | 85 |
| 86 void CleanupExpiredBudget(const GURL& origin); |
| 87 |
| 86 // The database for storing budget information. | 88 // The database for storing budget information. |
| 87 std::unique_ptr<leveldb_proto::ProtoDatabase<budget_service::Budget>> db_; | 89 std::unique_ptr<leveldb_proto::ProtoDatabase<budget_service::Budget>> db_; |
| 88 | 90 |
| 89 // Cached data for the origins which have been loaded. | 91 // Cached data for the origins which have been loaded. |
| 90 std::unordered_map<std::string, BudgetInfo> budget_map_; | 92 std::unordered_map<std::string, BudgetInfo> budget_map_; |
| 91 | 93 |
| 92 // The clock used to vend times. | 94 // The clock used to vend times. |
| 93 std::unique_ptr<base::Clock> clock_; | 95 std::unique_ptr<base::Clock> clock_; |
| 94 | 96 |
| 95 base::WeakPtrFactory<BudgetDatabase> weak_ptr_factory_; | 97 base::WeakPtrFactory<BudgetDatabase> weak_ptr_factory_; |
| 96 | 98 |
| 97 DISALLOW_COPY_AND_ASSIGN(BudgetDatabase); | 99 DISALLOW_COPY_AND_ASSIGN(BudgetDatabase); |
| 98 }; | 100 }; |
| 99 | 101 |
| 100 #endif // CHROME_BROWSER_BUDGET_SERVICE_BUDGET_DATABASE_H_ | 102 #endif // CHROME_BROWSER_BUDGET_SERVICE_BUDGET_DATABASE_H_ |
| OLD | NEW |