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

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

Issue 2058523003: Make BackgroundBudgetService calls asynchronous. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: More test code cleanup Created 4 years, 6 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
« no previous file with comments | « no previous file | chrome/browser/budget_service/background_budget_service.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/budget_service/background_budget_service.h
diff --git a/chrome/browser/budget_service/background_budget_service.h b/chrome/browser/budget_service/background_budget_service.h
index 35f79d3da9f5733fa0cfe5a1f57c87f15351a33b..6967efafd497c004bbb16015b58dd30077742ac6 100644
--- a/chrome/browser/budget_service/background_budget_service.h
+++ b/chrome/browser/budget_service/background_budget_service.h
@@ -8,6 +8,7 @@
#include <memory>
#include <string>
+#include "base/callback_forward.h"
#include "base/gtest_prod_util.h"
#include "components/keyed_service/core/keyed_service.h"
#include "url/gurl.h"
@@ -41,14 +42,19 @@ class BackgroundBudgetService : public KeyedService {
// Query for the base cost for any background processing.
static double GetCost(CostType type);
- // Get the budget associated with the origin. This is returned as the double
- // budget. Budget will be a value between 0.0 and
+ using GetBudgetCallback = base::Callback<void(double budget)>;
+
+ // Get the budget associated with the origin. This is passed to the
+ // callback. Budget will be a value between 0.0 and
// SiteEngagementScore::kMaxPoints.
- double GetBudget(const GURL& origin);
+ void GetBudget(const GURL& origin, const GetBudgetCallback& callback);
// Store the budget associated with the origin. Budget should be a value
- // between 0.0 and SiteEngagementScore::kMaxPoints.
- void StoreBudget(const GURL& origin, double budget);
+ // between 0.0 and SiteEngagementScore::kMaxPoints. closure will be called
+ // when the store completes.
+ void StoreBudget(const GURL& origin,
+ double budget,
+ const base::Closure& closure);
private:
friend class BackgroundBudgetServiceTest;
« no previous file with comments | « no previous file | chrome/browser/budget_service/background_budget_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698