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 be1f910d242380c3f5c996e972fa2aad0d4e3bc8..6ce5efc94a00da9adb3596ec64c4d52e5f912ecb 100644 |
--- a/chrome/browser/budget_service/budget_service_impl.cc |
+++ b/chrome/browser/budget_service/budget_service_impl.cc |
@@ -55,6 +55,15 @@ 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(); |
+ BudgetManagerFactory::GetForProfile(context)->Reserve(origin, operation, |
+ callback); |
} |