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

Side by Side Diff: third_party/WebKit/Source/modules/budget/BudgetService.h

Issue 2309863002: Plumb reserve method of the BudgetAPI (Closed)
Patch Set: Rename BudgetServiceErrorType::NO_ERROR to ::NONE to avoid Windows constant name clash. 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 unified diff | Download patch
OLDNEW
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 #ifndef BudgetService_h 5 #ifndef BudgetService_h
6 #define BudgetService_h 6 #define BudgetService_h
7 7
8 #include "bindings/core/v8/ScriptWrappable.h" 8 #include "bindings/core/v8/ScriptWrappable.h"
9 #include "modules/ModulesExport.h" 9 #include "modules/ModulesExport.h"
10 #include "public/platform/modules/budget_service/budget_service.mojom-blink.h" 10 #include "public/platform/modules/budget_service/budget_service.mojom-blink.h"
(...skipping 12 matching lines...) Expand all
23 23
24 public: 24 public:
25 static BudgetService* create() 25 static BudgetService* create()
26 { 26 {
27 return new BudgetService(); 27 return new BudgetService();
28 } 28 }
29 29
30 ~BudgetService(); 30 ~BudgetService();
31 31
32 // Implementation of the Budget API interface. 32 // Implementation of the Budget API interface.
33 ScriptPromise getCost(ScriptState*, const AtomicString& actionType); 33 ScriptPromise getCost(ScriptState*, const AtomicString& operation);
34 ScriptPromise getBudget(ScriptState*); 34 ScriptPromise getBudget(ScriptState*);
35 ScriptPromise reserve(ScriptState*, const AtomicString& operation);
35 36
36 DEFINE_INLINE_TRACE() {} 37 DEFINE_INLINE_TRACE() {}
37 38
38 private: 39 private:
39 // Callbacks from the BudgetService to the blink layer. 40 // Callbacks from the BudgetService to the blink layer.
40 void gotCost(ScriptPromiseResolver*, double cost) const; 41 void gotCost(ScriptPromiseResolver*, double cost) const;
41 void gotBudget(ScriptPromiseResolver*, const mojo::WTFArray<mojom::blink::Bu dgetStatePtr> expectations) const; 42 void gotBudget(ScriptPromiseResolver*, mojom::blink::BudgetServiceErrorType, const mojo::WTFArray<mojom::blink::BudgetStatePtr> expectations) const;
43 void gotReservation(ScriptPromiseResolver*, mojom::blink::BudgetServiceError Type, bool success) const;
42 44
43 // Error handler for use if mojo service doesn't connect. 45 // Error handler for use if mojo service doesn't connect.
44 void onConnectionError(); 46 void onConnectionError();
45 47
46 BudgetService(); 48 BudgetService();
47 49
48 // Pointer to the Mojo service which will proxy calls to the browser. 50 // Pointer to the Mojo service which will proxy calls to the browser.
49 mojom::blink::BudgetServicePtr m_service; 51 mojom::blink::BudgetServicePtr m_service;
50 }; 52 };
51 53
52 } // namespace blink 54 } // namespace blink
53 55
54 #endif // BudgetService_h 56 #endif // BudgetService_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698