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

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: 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..da2f81be1adc0a2203d6b6e6a9af80780550ba18 100644
--- a/chrome/browser/budget_service/background_budget_service.h
+++ b/chrome/browser/budget_service/background_budget_service.h
@@ -8,8 +8,11 @@
#include <memory>
#include <string>
+#include "base/callback_forward.h"
#include "base/gtest_prod_util.h"
+#include "base/memory/ref_counted.h"
Michael van Ouwerkerk 2016/06/10 12:10:19 Why is this include needed in the header?
harkness 2016/06/10 14:52:56 Removed.
#include "components/keyed_service/core/keyed_service.h"
+#include "content/public/browser/browser_thread.h"
Michael van Ouwerkerk 2016/06/10 12:10:19 Why is this include needed in the header?
harkness 2016/06/10 14:52:56 This was a bigger review, including some of the in
#include "url/gurl.h"
class Profile;
@@ -41,14 +44,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 */)>;
+
+ // 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);
Michael van Ouwerkerk 2016/06/10 12:10:19 I expect in future this will become a callback tha
harkness 2016/06/10 14:52:56 Correct. That will happen when I add in the level
private:
friend class BackgroundBudgetServiceTest;

Powered by Google App Engine
This is Rietveld 408576698