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 ReadableStreamController_h | 5 #ifndef ReadableStreamController_h |
6 #define ReadableStreamController_h | 6 #define ReadableStreamController_h |
7 | 7 |
8 #include "bindings/core/v8/ScopedPersistent.h" | 8 #include "bindings/core/v8/ScopedPersistent.h" |
9 #include "bindings/core/v8/ScriptValue.h" | 9 #include "bindings/core/v8/ScriptValue.h" |
10 #include "bindings/core/v8/ToV8.h" | 10 #include "bindings/core/v8/ToV8.h" |
11 #include "bindings/core/v8/V8ScriptRunner.h" | 11 #include "bindings/core/v8/V8ScriptRunner.h" |
12 #include "core/CoreExport.h" | 12 #include "core/CoreExport.h" |
13 #include "platform/heap/Handle.h" | 13 #include "platform/heap/Handle.h" |
14 #include "wtf/RefPtr.h" | 14 #include "wtf/RefPtr.h" |
15 #include <v8.h> | 15 #include <v8.h> |
16 | 16 |
17 namespace blink { | 17 namespace blink { |
18 | 18 |
19 class CORE_EXPORT ReadableStreamController final : public GarbageCollectedFinali
zed<ReadableStreamController> { | 19 class CORE_EXPORT ReadableStreamController final : public GarbageCollectedFinali
zed<ReadableStreamController> { |
20 public: | 20 public: |
21 DEFINE_INLINE_TRACE() {} | 21 DEFINE_INLINE_TRACE() {} |
22 | 22 |
23 explicit ReadableStreamController(ScriptValue stream) | 23 explicit ReadableStreamController(ScriptValue stream) |
24 : m_scriptState(stream.scriptState()) | 24 : m_scriptState(stream.getScriptState()) |
25 , m_stream(stream.isolate(), stream.v8Value()) | 25 , m_stream(stream.isolate(), stream.v8Value()) |
26 { | 26 { |
27 m_stream.setWeak(&m_stream, ReadableStreamController::streamWeakCallback
); | 27 m_stream.setWeak(&m_stream, ReadableStreamController::streamWeakCallback
); |
28 } | 28 } |
29 | 29 |
30 // Users of the ReadableStreamController can call this to note that the stre
am has been canceled and thus they | 30 // Users of the ReadableStreamController can call this to note that the stre
am has been canceled and thus they |
31 // don't anticipate using the ReadableStreamController anymore. (close/desir
edSize/enqueue/error will become no-ops | 31 // don't anticipate using the ReadableStreamController anymore. (close/desir
edSize/enqueue/error will become no-ops |
32 // afterward.) | 32 // afterward.) |
33 void noteHasBeenCanceled() | 33 void noteHasBeenCanceled() |
34 { | 34 { |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 weakInfo.GetParameter()->clear(); | 112 weakInfo.GetParameter()->clear(); |
113 } | 113 } |
114 | 114 |
115 RefPtr<ScriptState> m_scriptState; | 115 RefPtr<ScriptState> m_scriptState; |
116 ScopedPersistent<v8::Value> m_stream; | 116 ScopedPersistent<v8::Value> m_stream; |
117 }; | 117 }; |
118 | 118 |
119 } // namespace blink | 119 } // namespace blink |
120 | 120 |
121 #endif // ReadableStreamController_h | 121 #endif // ReadableStreamController_h |
OLD | NEW |