Chromium Code Reviews| 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 #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 | 11 |
| 11 namespace blink { | 12 namespace blink { |
| 12 | 13 |
| 13 class ScriptPromise; | 14 class ScriptPromise; |
| 15 class ScriptPromiseResolver; | |
| 14 class ScriptState; | 16 class ScriptState; |
| 15 | 17 |
| 16 // This is the entry point into the browser for the BudgetService API, which is | 18 // This is the entry point into the browser for the BudgetService API, which is |
| 17 // designed to give origins the ability to perform background operations | 19 // designed to give origins the ability to perform background operations |
| 18 // on the user's behalf. | 20 // on the user's behalf. |
| 19 class BudgetService final : public GarbageCollected<BudgetService>, public Scrip tWrappable { | 21 class BudgetService final : public GarbageCollectedFinalized<BudgetService>, pub lic ScriptWrappable { |
|
johnme
2016/08/17 13:54:02
Why does this need to be Finalized?
harkness
2016/08/18 10:23:26
m_service requires it.
johnme
2016/08/18 13:04:31
Some Mojo consumers reset their InterfacePtrs when
harkness
2016/08/22 08:57:47
It appears that mojo Ptrs can't be traced using th
johnme
2016/08/22 13:14:37
Yes, my question is whether we should be cleaning
| |
| 20 DEFINE_WRAPPERTYPEINFO(); | 22 DEFINE_WRAPPERTYPEINFO(); |
| 21 | 23 |
| 22 public: | 24 public: |
| 23 static BudgetService* create() | 25 static BudgetService* create() |
| 24 { | 26 { |
| 25 return new BudgetService(); | 27 return new BudgetService(); |
| 26 } | 28 } |
| 27 | 29 |
| 30 ~BudgetService(); | |
| 31 | |
| 32 // Implementation of the Budget API interface. | |
| 28 ScriptPromise getCost(ScriptState*, const AtomicString& actionType); | 33 ScriptPromise getCost(ScriptState*, const AtomicString& actionType); |
| 29 ScriptPromise getBudget(ScriptState*); | 34 ScriptPromise getBudget(ScriptState*); |
| 30 | 35 |
| 36 // Callbacks from the BudgetService to the blink layer. | |
| 37 void asyncGetCost(ScriptPromiseResolver*, double) const; | |
|
johnme
2016/08/17 13:54:02
Nit: gotCost or onGetCost?
harkness
2016/08/18 10:23:26
Normally I hesititate on just changing verb tense,
| |
| 38 void asyncGetBudget(PassRefPtr<ScriptState>, ScriptPromiseResolver*, const m ojo::WTFArray<mojom::blink::BudgetStatePtr>) const; | |
| 39 | |
| 31 DEFINE_INLINE_TRACE() {} | 40 DEFINE_INLINE_TRACE() {} |
| 32 | 41 |
| 33 private: | 42 private: |
| 34 BudgetService(); | 43 BudgetService(); |
| 44 | |
| 45 // Pointer to the Mojo service which will proxy calls to the browser. | |
| 46 mojom::blink::BudgetServicePtr m_service; | |
| 35 }; | 47 }; |
| 36 | 48 |
| 37 } // namespace blink | 49 } // namespace blink |
| 38 | 50 |
| 39 #endif // BudgetService_h | 51 #endif // BudgetService_h |
| OLD | NEW |