OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef UnderlyingSourceBase_h |
| 6 #define UnderlyingSourceBase_h |
| 7 |
| 8 #include "bindings/core/v8/ScriptPromise.h" |
| 9 #include "bindings/core/v8/ScriptState.h" |
| 10 #include "bindings/core/v8/ScriptValue.h" |
| 11 #include "bindings/core/v8/ScriptWrappable.h" |
| 12 #include "core/CoreExport.h" |
| 13 #include "core/dom/ActiveDOMObject.h" |
| 14 #include "platform/heap/Handle.h" |
| 15 |
| 16 namespace blink { |
| 17 |
| 18 class ReadableStreamController; |
| 19 |
| 20 class CORE_EXPORT UnderlyingSourceBase : public GarbageCollectedFinalized<Underl
yingSourceBase>, public ScriptWrappable, public ActiveDOMObject { |
| 21 DEFINE_WRAPPERTYPEINFO(); |
| 22 |
| 23 public: |
| 24 DECLARE_VIRTUAL_TRACE(); |
| 25 virtual ~UnderlyingSourceBase() {} |
| 26 |
| 27 ScriptPromise startWrapper(ScriptState*, ScriptValue stream); |
| 28 virtual ScriptPromise start(ScriptState*); |
| 29 |
| 30 virtual ScriptPromise pull(ScriptState*); |
| 31 |
| 32 ScriptPromise cancelWrapper(ScriptState*, ScriptValue reason); |
| 33 virtual ScriptPromise cancel(ScriptState*, ScriptValue reason); |
| 34 |
| 35 // ActiveDOMObject |
| 36 bool hasPendingActivity() const override; |
| 37 |
| 38 protected: |
| 39 explicit UnderlyingSourceBase(ScriptState* scriptState) |
| 40 : ActiveDOMObject(scriptState->executionContext()) |
| 41 { |
| 42 this->suspendIfNeeded(); |
| 43 } |
| 44 |
| 45 ReadableStreamController* controller() const { return m_controller; } |
| 46 |
| 47 private: |
| 48 Member<ReadableStreamController> m_controller; |
| 49 }; |
| 50 |
| 51 } // namespace blink |
| 52 |
| 53 #endif // UnderlyingSourceBase_h |
OLD | NEW |