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

Unified Diff: third_party/WebKit/Source/modules/budget/BudgetService.h

Issue 2231873002: Added budget_service.mojom (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@budget_api
Patch Set: Add a connection error handler to BudgetService Created 4 years, 4 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: third_party/WebKit/Source/modules/budget/BudgetService.h
diff --git a/third_party/WebKit/Source/modules/budget/BudgetService.h b/third_party/WebKit/Source/modules/budget/BudgetService.h
index 6d858bc7977e90f5de0f22aaf1fc36c005cadaf8..73c0313040c74549a0049b50e20cd3a3767ea833 100644
--- a/third_party/WebKit/Source/modules/budget/BudgetService.h
+++ b/third_party/WebKit/Source/modules/budget/BudgetService.h
@@ -7,16 +7,18 @@
#include "bindings/core/v8/ScriptWrappable.h"
#include "modules/ModulesExport.h"
+#include "public/platform/modules/budget_service/budget_service.mojom-blink.h"
namespace blink {
class ScriptPromise;
+class ScriptPromiseResolver;
class ScriptState;
// This is the entry point into the browser for the BudgetService API, which is
// designed to give origins the ability to perform background operations
// on the user's behalf.
-class BudgetService final : public GarbageCollected<BudgetService>, public ScriptWrappable {
+class BudgetService final : public GarbageCollectedFinalized<BudgetService>, public ScriptWrappable {
DEFINE_WRAPPERTYPEINFO();
public:
@@ -25,13 +27,26 @@ public:
return new BudgetService();
}
+ ~BudgetService();
+
+ // Implementation of the Budget API interface.
ScriptPromise getCost(ScriptState*, const AtomicString& actionType);
ScriptPromise getBudget(ScriptState*);
DEFINE_INLINE_TRACE() {}
private:
+ // Callbacks from the BudgetService to the blink layer.
+ void gotCost(ScriptPromiseResolver*, double cost) const;
+ void gotBudget(ScriptPromiseResolver*, const mojo::WTFArray<mojom::blink::BudgetStatePtr> expectations) const;
+
+ // Error handler for use if mojo service doesn't connect.
+ void onConnectionError();
+
BudgetService();
+
+ // Pointer to the Mojo service which will proxy calls to the browser.
+ mojom::blink::BudgetServicePtr m_service;
};
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698