 Chromium Code Reviews
 Chromium Code Reviews Issue 1167343002:
  Add methods for creating V8 extras-based ReadableStreams from C++  (Closed) 
  Base URL: https://chromium.googlesource.com/chromium/blink.git@master
    
  
    Issue 1167343002:
  Add methods for creating V8 extras-based ReadableStreams from C++  (Closed) 
  Base URL: https://chromium.googlesource.com/chromium/blink.git@master| Index: Source/core/streams/UnderlyingSourceBase.h | 
| diff --git a/Source/core/streams/UnderlyingSourceBase.h b/Source/core/streams/UnderlyingSourceBase.h | 
| new file mode 100644 | 
| index 0000000000000000000000000000000000000000..6e178f279e8abd09b2ccbce3b59631d2496f5614 | 
| --- /dev/null | 
| +++ b/Source/core/streams/UnderlyingSourceBase.h | 
| @@ -0,0 +1,38 @@ | 
| +#ifndef UnderlyingSourceBase_h | 
| +#define UnderlyingSourceBase_h | 
| + | 
| +#include "bindings/core/v8/ScriptPromise.h" | 
| +#include "bindings/core/v8/ScriptValue.h" | 
| +#include "bindings/core/v8/ScriptWrappable.h" | 
| +#include "core/CoreExport.h" | 
| +#include "core/streams/ReadableStreamController.h" | 
| + | 
| +namespace blink { | 
| + | 
| +// TODO do we need ActiveDOMObject?? | 
| + | 
| +class CORE_EXPORT UnderlyingSourceBase : public GarbageCollectedFinalized<UnderlyingSourceBase>, public ScriptWrappable { | 
| + DEFINE_WRAPPERTYPEINFO(); | 
| + | 
| +public: | 
| + ScriptPromise startWrapper(ScriptState*, ScriptValue stream); | 
| + virtual ScriptPromise start(ScriptState*); | 
| + virtual ScriptPromise pull(ScriptState*); | 
| + virtual ScriptPromise cancel(ScriptState*, ScriptValue reason); | 
| + | 
| + DECLARE_VIRTUAL_TRACE(); | 
| + | 
| +protected: | 
| + // TODO is a reference a good idea? | 
| + ReadableStreamController& controller() const { return *m_controller; } | 
| + | 
| +private: | 
| + // TODO should be using a smart pointer of some sort ... Member<>? Persistent<>? RefPtr<>? | 
| + // ReadableStreamController is not GarbageCollectedFinalized<>... if we made it so, how do we handle it | 
| + // containing a ScriptValue? | 
| + ReadableStreamController* m_controller; | 
| 
yhirano
2015/06/12 03:40:59
Can we have a controller of type ReadableStreamCon
 | 
| +}; | 
| + | 
| +} // namespace blink | 
| + | 
| +#endif UnderlyingSourceBase_h |