Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(466)

Unified Diff: chrome/browser/budget_service/budget_manager.h

Issue 2326523003: Connect Mojo budget_service to BudgetManager implementation of Reserve. (Closed)
Patch Set: Fixed issue dependency. Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/budget_service/budget_manager.h
diff --git a/chrome/browser/budget_service/budget_manager.h b/chrome/browser/budget_service/budget_manager.h
index 0758788d29e42b90b1c5ebc63dc45cc329c55b82..99fa4fe2c9dea724a01c58b8980df6b1d63c3036 100644
--- a/chrome/browser/budget_service/budget_manager.h
+++ b/chrome/browser/budget_service/budget_manager.h
@@ -5,8 +5,8 @@
#ifndef CHROME_BROWSER_BUDGET_SERVICE_BUDGET_MANAGER_H_
#define CHROME_BROWSER_BUDGET_SERVICE_BUDGET_MANAGER_H_
+#include <map>
#include <memory>
-#include <string>
#include "base/callback_forward.h"
#include "base/gtest_prod_util.h"
@@ -39,7 +39,7 @@ class BudgetManager : public KeyedService {
static double GetCost(blink::mojom::BudgetOperationType type);
using GetBudgetCallback = blink::mojom::BudgetService::GetBudgetCallback;
- using ReserveCallback = base::Callback<void(bool success)>;
+ using ReserveCallback = blink::mojom::BudgetService::ReserveCallback;
using ConsumeCallback = base::Callback<void(bool success)>;
// Get the budget associated with the origin. This is passed to the
@@ -63,17 +63,23 @@ class BudgetManager : public KeyedService {
private:
friend class BudgetManagerTest;
+ // Called as a callback from BudgetDatabase after it made a SpendBudget
+ // decision.
+ void DidConsume(const ConsumeCallback& callback,
+ blink::mojom::BudgetServiceErrorType error,
+ bool success);
+
// Called as a callback from BudgetDatabase after it has made a reserve
// decision.
void DidReserve(const url::Origin& origin,
- blink::mojom::BudgetOperationType type,
const ReserveCallback& callback,
+ blink::mojom::BudgetServiceErrorType error,
bool success);
Profile* profile_;
BudgetDatabase db_;
- std::unordered_map<std::string, int> reservation_map_;
+ std::map<url::Origin, int> reservation_map_;
base::WeakPtrFactory<BudgetManager> weak_ptr_factory_;
DISALLOW_COPY_AND_ASSIGN(BudgetManager);
« no previous file with comments | « chrome/browser/budget_service/budget_database_unittest.cc ('k') | chrome/browser/budget_service/budget_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698