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

Side by Side Diff: Source/core/streams/ReadableStreamReader.cpp

Issue 1028913002: ReadableStream.cancel's parameter should be optional. (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
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 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 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 #include "config.h" 5 #include "config.h"
6 #include "core/streams/ReadableStreamReader.h" 6 #include "core/streams/ReadableStreamReader.h"
7 7
8 #include "bindings/core/v8/ExceptionState.h" 8 #include "bindings/core/v8/ExceptionState.h"
9 #include "bindings/core/v8/ScriptPromiseResolver.h" 9 #include "bindings/core/v8/ScriptPromiseResolver.h"
10 #include "bindings/core/v8/V8IteratorResultValue.h" 10 #include "bindings/core/v8/V8IteratorResultValue.h"
(...skipping 22 matching lines...) Expand all
33 ScriptPromise ReadableStreamReader::closed(ScriptState* scriptState) 33 ScriptPromise ReadableStreamReader::closed(ScriptState* scriptState)
34 { 34 {
35 return m_closed->promise(scriptState->world()); 35 return m_closed->promise(scriptState->world());
36 } 36 }
37 37
38 bool ReadableStreamReader::isActive() const 38 bool ReadableStreamReader::isActive() const
39 { 39 {
40 return m_stream->isLockedTo(this); 40 return m_stream->isLockedTo(this);
41 } 41 }
42 42
43 ScriptPromise ReadableStreamReader::cancel(ScriptState* scriptState)
44 {
45 return cancel(scriptState, ScriptValue(scriptState, v8::Undefined(scriptStat e->isolate())));
46 }
47
43 ScriptPromise ReadableStreamReader::cancel(ScriptState* scriptState, ScriptValue reason) 48 ScriptPromise ReadableStreamReader::cancel(ScriptState* scriptState, ScriptValue reason)
44 { 49 {
45 if (isActive()) 50 if (isActive())
46 return m_stream->cancelInternal(scriptState, reason); 51 return m_stream->cancelInternal(scriptState, reason);
47 52
48 // A method should return a different promise on each call. 53 // A method should return a different promise on each call.
49 RefPtrWillBeRawPtr<ScriptPromiseResolver> resolver = ScriptPromiseResolver:: create(scriptState); 54 RefPtrWillBeRawPtr<ScriptPromiseResolver> resolver = ScriptPromiseResolver:: create(scriptState);
50 ScriptPromise promise = resolver->promise(); 55 ScriptPromise promise = resolver->promise();
51 resolver->resolve(closed(scriptState).v8Value()); 56 resolver->resolve(closed(scriptState).v8Value());
52 return promise; 57 return promise;
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 } 124 }
120 125
121 DEFINE_TRACE(ReadableStreamReader) 126 DEFINE_TRACE(ReadableStreamReader)
122 { 127 {
123 visitor->trace(m_stream); 128 visitor->trace(m_stream);
124 visitor->trace(m_closed); 129 visitor->trace(m_closed);
125 ActiveDOMObject::trace(visitor); 130 ActiveDOMObject::trace(visitor);
126 } 131 }
127 132
128 } // namespace blink 133 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/streams/ReadableStreamReader.h ('k') | Source/core/streams/ReadableStreamReader.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698