OLD | NEW |
---|---|
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 module blink.mojom; | 5 module blink.mojom; |
6 | 6 |
7 import "url/mojo/origin.mojom"; | 7 import "url/mojo/origin.mojom"; |
8 | 8 |
9 enum BudgetOperationType { | 9 enum BudgetOperationType { |
10 SILENT_PUSH | 10 SILENT_PUSH, |
11 INVALID_OPERATION | |
11 }; | 12 }; |
12 | 13 |
14 enum BudgetServiceErrorType { | |
15 NO_ERROR, | |
16 DATABASE_ERROR, | |
17 NOT_SUPPORTED | |
18 }; | |
Peter Beverloo
2016/09/05 17:06:16
nit: mind documenting what these all mean? Being s
harkness
2016/09/06 15:45:01
Done.
| |
19 | |
Peter Beverloo
2016/09/05 17:06:16
nit: no double blank lines
harkness
2016/09/06 15:45:01
Done.
| |
20 | |
13 // Structure representing the budget at points in time in the future. | 21 // Structure representing the budget at points in time in the future. |
14 struct BudgetState { | 22 struct BudgetState { |
15 // Amount of budget that will be available. This should be the lower bound of | 23 // Amount of budget that will be available. This should be the lower bound of |
16 // the budget between this time and the previous time. | 24 // the budget between this time and the previous time. |
17 double budget_at; | 25 double budget_at; |
18 | 26 |
19 // Time at which the budget is available, in milliseconds since 00:00:00 UTC | 27 // Time at which the budget is available, in milliseconds since 00:00:00 UTC |
20 // on 1 January 1970, at which the budget_at will be valid. | 28 // on 1 January 1970, at which the budget_at will be valid. |
21 double time; | 29 double time; |
22 }; | 30 }; |
23 | 31 |
24 // Service through which Blink can query for the cost of particular actions and | 32 // Service through which Blink can query for the cost of particular actions and |
25 // for the budget available for an origin. | 33 // for the budget available for an origin. |
26 interface BudgetService { | 34 interface BudgetService { |
27 GetCost(BudgetOperationType operation) => (double cost); | 35 GetCost(BudgetOperationType operation) => (double cost); |
28 GetBudget(url.mojom.Origin origin) => (array<BudgetState> budget); | 36 GetBudget(url.mojom.Origin origin) => (BudgetServiceErrorType errorType, array <BudgetState> budget); |
37 Reserve(url.mojom.Origin origin, BudgetOperationType operation) => (BudgetServ iceErrorType errorType, bool success); | |
29 }; | 38 }; |
30 | 39 |
OLD | NEW |