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 | |
12 }; | |
13 | |
14 enum BudgetServiceErrorType { | |
15 NO_ERROR, | |
16 // Returned if there is an issue reading or writing the budget database. | |
17 DATABASE_ERROR, | |
18 // Returned if functionality is called which is not yet implemented. | |
19 NOT_SUPPORTED | |
11 }; | 20 }; |
12 | 21 |
13 // Structure representing the budget at points in time in the future. | 22 // Structure representing the budget at points in time in the future. |
14 struct BudgetState { | 23 struct BudgetState { |
15 // Amount of budget that will be available. This should be the lower bound of | 24 // Amount of budget that will be available. This should be the lower bound of |
16 // the budget between this time and the previous time. | 25 // the budget between this time and the previous time. |
17 double budget_at; | 26 double budget_at; |
18 | 27 |
19 // Time at which the budget is available, in milliseconds since 00:00:00 UTC | 28 // 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. | 29 // on 1 January 1970, at which the budget_at will be valid. |
21 double time; | 30 double time; |
22 }; | 31 }; |
23 | 32 |
24 // Service through which Blink can query for the cost of particular actions and | 33 // Service through which Blink can query for the cost of particular actions and |
25 // for the budget available for an origin. | 34 // for the budget available for an origin. |
26 interface BudgetService { | 35 interface BudgetService { |
27 GetCost(BudgetOperationType operation) => (double cost); | 36 GetCost(BudgetOperationType operation) => (double cost); |
28 GetBudget(url.mojom.Origin origin) => (array<BudgetState> budget); | 37 GetBudget(url.mojom.Origin origin) => (BudgetServiceErrorType errorType, array <BudgetState> budget); |
38 Reserve(url.mojom.Origin origin, BudgetOperationType operation) => (BudgetServ iceErrorType errorType, bool success); | |
Peter Beverloo
2016/09/06 15:54:10
errorType -> error_type (you use hacker_style on l
harkness
2016/09/06 16:17:26
Done.
| |
29 }; | 39 }; |
30 | 40 |
OLD | NEW |