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

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: Explicitly use base::RunLoop everywhere. 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
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..09bda02b7f89e9f9326cf9bba7bdee4bf97ad1e1 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,18 @@ 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 */)>;
johnme 2016/06/15 09:59:06 Nit: you don't need to comment out budget.
harkness 2016/06/20 11:22:19 Done.
+
+ // 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);
+ void StoreBudget(const GURL& origin,
+ double budget,
+ const base::Closure& closure);
johnme 2016/06/15 09:59:06 Nit: please rename this to done_callback and/or co
harkness 2016/06/20 11:22:19 Done.
private:
friend class BackgroundBudgetServiceTest;

Powered by Google App Engine
This is Rietveld 408576698