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

Unified Diff: Source/core/streams/UnderlyingSourceBase.h

Issue 1167343002: Add methods for creating V8 extras-based ReadableStreams from C++ (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: That todo is not necessary according to yhirano@ Created 5 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/streams/ReadableStreamController.h ('k') | Source/core/streams/UnderlyingSourceBase.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..fb7ca6cb609160dc1c63d52b9e056df21d926617
--- /dev/null
+++ b/Source/core/streams/UnderlyingSourceBase.h
@@ -0,0 +1,51 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#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/dom/ActiveDOMObject.h"
+#include "platform/heap/Handle.h"
+
+namespace blink {
+
+class ReadableStreamController;
+
+class CORE_EXPORT UnderlyingSourceBase : public GarbageCollectedFinalized<UnderlyingSourceBase>, public ScriptWrappable, public ActiveDOMObject {
+ DEFINE_WRAPPERTYPEINFO();
+
+public:
+ DECLARE_VIRTUAL_TRACE();
+ virtual ~UnderlyingSourceBase() { }
+
+ ScriptPromise startWrapper(ScriptState*, ScriptValue stream);
+ virtual ScriptPromise start(ScriptState*);
+
+ virtual ScriptPromise pull(ScriptState*);
+
+ ScriptPromise cancelWrapper(ScriptState*, ScriptValue reason);
+ virtual ScriptPromise cancel(ScriptState*, ScriptValue reason);
+
+ // ActiveDOMObject
+ virtual bool hasPendingActivity() const override;
+
+protected:
+ UnderlyingSourceBase(ScriptState* scriptState) : ActiveDOMObject(scriptState->executionContext())
+ {
+ this->suspendIfNeeded();
+ }
+
+ ReadableStreamController* controller() { return m_controller; }
+
+private:
+ Member<ReadableStreamController> m_controller;
+};
+
+} // namespace blink
+
+#endif // UnderlyingSourceBase_h
« no previous file with comments | « Source/core/streams/ReadableStreamController.h ('k') | Source/core/streams/UnderlyingSourceBase.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698