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

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

Issue 2326523003: Connect Mojo budget_service to BudgetManager implementation of Reserve. (Closed)
Patch Set: Fixed issue dependency. 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
« no previous file with comments | « chrome/browser/budget_service/budget_manager_unittest.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
}
« no previous file with comments | « chrome/browser/budget_service/budget_manager_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698