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_MANAGER_H_ | 5 #ifndef CHROME_BROWSER_BUDGET_SERVICE_BUDGET_MANAGER_H_ |
6 #define CHROME_BROWSER_BUDGET_SERVICE_BUDGET_MANAGER_H_ | 6 #define CHROME_BROWSER_BUDGET_SERVICE_BUDGET_MANAGER_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <memory> | 9 #include <memory> |
10 | 10 |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
56 | 56 |
57 // Spend budget, first consuming a reservation if one exists, or spend | 57 // Spend budget, first consuming a reservation if one exists, or spend |
58 // directly from the budget. | 58 // directly from the budget. |
59 void Consume(const url::Origin& origin, | 59 void Consume(const url::Origin& origin, |
60 blink::mojom::BudgetOperationType type, | 60 blink::mojom::BudgetOperationType type, |
61 const ConsumeCallback& callback); | 61 const ConsumeCallback& callback); |
62 | 62 |
63 private: | 63 private: |
64 friend class BudgetManagerTest; | 64 friend class BudgetManagerTest; |
65 | 65 |
66 // Called as a callback from BudgetDatabase when it returns the GetBudget | |
67 // details. | |
Peter Beverloo
2016/11/28 10:59:00
micro nit: I don't think these comments (dito re:
harkness
2016/11/28 13:58:04
I agree in this case. I've removed this one and th
| |
68 void DidGetBudget(const GetBudgetCallback& callback, | |
69 blink::mojom::BudgetServiceErrorType error, | |
70 mojo::Array<blink::mojom::BudgetStatePtr> budget); | |
71 | |
66 // Called as a callback from BudgetDatabase after it made a SpendBudget | 72 // Called as a callback from BudgetDatabase after it made a SpendBudget |
67 // decision. | 73 // decision. |
68 void DidConsume(const ConsumeCallback& callback, | 74 void DidConsume(const ConsumeCallback& callback, |
69 blink::mojom::BudgetServiceErrorType error, | 75 blink::mojom::BudgetServiceErrorType error, |
70 bool success); | 76 bool success); |
71 | 77 |
72 // Called as a callback from BudgetDatabase after it has made a reserve | 78 // Called as a callback from BudgetDatabase after it has made a reserve |
73 // decision. | 79 // decision. |
74 void DidReserve(const url::Origin& origin, | 80 void DidReserve(const url::Origin& origin, |
75 const ReserveCallback& callback, | 81 const ReserveCallback& callback, |
76 blink::mojom::BudgetServiceErrorType error, | 82 blink::mojom::BudgetServiceErrorType error, |
77 bool success); | 83 bool success); |
78 | 84 |
79 Profile* profile_; | 85 Profile* profile_; |
80 BudgetDatabase db_; | 86 BudgetDatabase db_; |
81 | 87 |
82 std::map<url::Origin, int> reservation_map_; | 88 std::map<url::Origin, int> reservation_map_; |
83 base::WeakPtrFactory<BudgetManager> weak_ptr_factory_; | 89 base::WeakPtrFactory<BudgetManager> weak_ptr_factory_; |
84 | 90 |
85 DISALLOW_COPY_AND_ASSIGN(BudgetManager); | 91 DISALLOW_COPY_AND_ASSIGN(BudgetManager); |
86 }; | 92 }; |
87 | 93 |
88 #endif // CHROME_BROWSER_BUDGET_SERVICE_BUDGET_MANAGER_H_ | 94 #endif // CHROME_BROWSER_BUDGET_SERVICE_BUDGET_MANAGER_H_ |
OLD | NEW |