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

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

Issue 899653002: Use ExclusiveStreamReader to lock Body. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@exclusive-reader
Patch Set: rebase Created 5 years, 10 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 | « LayoutTests/http/tests/fetch/script-tests/stream-reader.js ('k') | Source/modules/fetch/Body.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 ReadableStream_h 5 #ifndef ReadableStream_h
6 #define ReadableStream_h 6 #define ReadableStream_h
7 7
8 #include "bindings/core/v8/ScriptPromise.h" 8 #include "bindings/core/v8/ScriptPromise.h"
9 #include "bindings/core/v8/ScriptPromiseProperty.h" 9 #include "bindings/core/v8/ScriptPromiseProperty.h"
10 #include "bindings/core/v8/ScriptState.h" 10 #include "bindings/core/v8/ScriptState.h"
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 void close(); 62 void close();
63 void error(PassRefPtrWillBeRawPtr<DOMException>); 63 void error(PassRefPtrWillBeRawPtr<DOMException>);
64 64
65 void didSourceStart(); 65 void didSourceStart();
66 66
67 // This function is not a getter. It creates an ExclusiveStreamReader and 67 // This function is not a getter. It creates an ExclusiveStreamReader and
68 // returns it. 68 // returns it.
69 ExclusiveStreamReader* getReader(ExceptionState&); 69 ExclusiveStreamReader* getReader(ExceptionState&);
70 // Only ExclusiveStreamReader methods should call this function. 70 // Only ExclusiveStreamReader methods should call this function.
71 void setReader(ExclusiveStreamReader*); 71 void setReader(ExclusiveStreamReader*);
72
73 bool isLocked() const { return m_reader; }
72 bool isLockedTo(const ExclusiveStreamReader* reader) const { return m_reader == reader; } 74 bool isLockedTo(const ExclusiveStreamReader* reader) const { return m_reader == reader; }
73 75
74 bool hasPendingActivity() const override; 76 bool hasPendingActivity() const override;
75 void stop() override; 77 void stop() override;
76 DECLARE_VIRTUAL_TRACE(); 78 DECLARE_VIRTUAL_TRACE();
77 79
78 // Returns the string representation of the given State. 80 // Returns the string representation of the given State.
79 static String stateToString(State); 81 static String stateToString(State);
80 82
81 protected: 83 protected:
(...skipping 22 matching lines...) Expand all
104 Member<WaitPromise> m_ready; 106 Member<WaitPromise> m_ready;
105 Member<ClosedPromise> m_closed; 107 Member<ClosedPromise> m_closed;
106 108
107 RefPtrWillBeMember<DOMException> m_exception; 109 RefPtrWillBeMember<DOMException> m_exception;
108 Member<ExclusiveStreamReader> m_reader; 110 Member<ExclusiveStreamReader> m_reader;
109 }; 111 };
110 112
111 } // namespace blink 113 } // namespace blink
112 114
113 #endif // ReadableStream_h 115 #endif // ReadableStream_h
OLDNEW
« no previous file with comments | « LayoutTests/http/tests/fetch/script-tests/stream-reader.js ('k') | Source/modules/fetch/Body.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698