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

Side by Side Diff: Source/core/streams/ExclusiveStreamReader.h

Issue 1001233002: Streams Implementation Update: Reader name and Stream methods (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 9 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 unified diff | Download patch
« no previous file with comments | « Source/core/core.gypi ('k') | Source/core/streams/ExclusiveStreamReader.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2015 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 ExclusiveStreamReader_h
6 #define ExclusiveStreamReader_h
7
8 #include "bindings/core/v8/ScriptPromise.h"
9 #include "bindings/core/v8/ScriptPromiseProperty.h"
10 #include "bindings/core/v8/ScriptValue.h"
11 #include "bindings/core/v8/ScriptWrappable.h"
12 #include "bindings/core/v8/ToV8.h"
13 #include "core/dom/ActiveDOMObject.h"
14 #include "core/streams/ReadableStream.h"
15 #include "platform/heap/Handle.h"
16
17 namespace blink {
18
19 class DOMException;
20 class ExceptionState;
21 class ScriptState;
22
23 // ExclusiveStreamReader corresponds to the same-name class in the Streams spec
24 // https://streams.spec.whatwg.org/. This class trusts ReadableStream, contrary
25 // to the class in the Streams spec, because we only support
26 // blink::Readable[Byte]Stream as this reader's customer.
27 class ExclusiveStreamReader final : public GarbageCollectedFinalized<ExclusiveSt reamReader>, public ScriptWrappable, public ActiveDOMObject {
28 DEFINE_WRAPPERTYPEINFO();
29 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(ExclusiveStreamReader);
30 public:
31 // The stream must not be locked to any ExclusiveStreamReader when called.
32 ExclusiveStreamReader(ReadableStream*);
33
34 ScriptPromise closed(ScriptState*);
35 bool isActive() const;
36 ScriptPromise ready(ScriptState*);
37 String state() const;
38 ScriptPromise cancel(ScriptState*, ScriptValue reason);
39 ScriptValue read(ScriptState*, ExceptionState&);
40 void releaseLock();
41 ScriptPromise released(ScriptState*);
42
43 bool hasPendingActivity() const override;
44 void stop() override;
45
46 DECLARE_TRACE();
47
48 private:
49 using ReleasedPromise = ScriptPromiseProperty<Member<ExclusiveStreamReader>, ToV8UndefinedGenerator, ToV8UndefinedGenerator>;
50 using ClosedPromise = ScriptPromiseProperty<Member<ExclusiveStreamReader>, T oV8UndefinedGenerator, RefPtrWillBeMember<DOMException>>;
51 using ReadyPromise = ScriptPromiseProperty<Member<ExclusiveStreamReader>, To V8UndefinedGenerator, ToV8UndefinedGenerator>;
52
53 const Member<ReadableStream> m_stream;
54 const Member<ReleasedPromise> m_released;
55 ReadableStream::State m_stateAfterRelease;
56 Member<ClosedPromise> m_closedAfterRelease;
57 Member<ReadyPromise> m_readyAfterRelease;
58 };
59
60 } // namespace blink
61
62 #endif // ExclusiveStreamReader_h
OLDNEW
« no previous file with comments | « Source/core/core.gypi ('k') | Source/core/streams/ExclusiveStreamReader.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698