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

Unified Diff: chrome/browser/budget_service/budget_service_impl.cc

Issue 2326523003: Connect Mojo budget_service to BudgetManager implementation of Reserve. (Closed)
Patch Set: 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_service_impl.cc
diff --git a/chrome/browser/budget_service/budget_service_impl.cc b/chrome/browser/budget_service/budget_service_impl.cc
index 2f798cb36998b514b893f440d5ca8970b24566fa..6a202a6670cd496431df57fdddc2e693d870c843 100644
--- a/chrome/browser/budget_service/budget_service_impl.cc
+++ b/chrome/browser/budget_service/budget_service_impl.cc
@@ -56,6 +56,17 @@ void BudgetServiceImpl::GetBudget(const url::Origin& origin,
void BudgetServiceImpl::Reserve(const url::Origin& origin,
blink::mojom::BudgetOperationType operation,
const ReserveCallback& callback) {
- // TODO(harkness): Call the BudgetManager::Reserve when it is available.
- callback.Run(blink::mojom::BudgetServiceErrorType::NONE, false);
+ // The RenderProcessHost should still be alive as long as any connections are
+ // alive, and if the BudgetService mojo connection is down, the
+ // BudgetServiceImpl should have been destroyed.
+ content::RenderProcessHost* host =
+ content::RenderProcessHost::FromID(render_process_id_);
+ DCHECK(host);
+
+ // Request a reservation from the BudgetManager.
+ content::BrowserContext* context = host->GetBrowserContext();
+ // TODO(harkness): Convert BudgetManager to use url::Origin.
+ const GURL gurl(origin.Serialize());
+ BudgetManagerFactory::GetForProfile(context)->Reserve(gurl, operation,
+ callback);
}

Powered by Google App Engine
This is Rietveld 408576698