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

Side by Side Diff: third_party/WebKit/Source/modules/fetch/Body.cpp

Issue 2804023004: Replace ASSERT with DCHECK in modules/fetch. (Closed)
Patch Set: Use DCHECK_EQ in all but a few instances Created 3 years, 8 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 | « no previous file | third_party/WebKit/Source/modules/fetch/BodyStreamBuffer.cpp » ('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 #include "modules/fetch/Body.h" 5 #include "modules/fetch/Body.h"
6 6
7 #include <memory> 7 #include <memory>
8 #include "bindings/core/v8/ScriptPromiseResolver.h" 8 #include "bindings/core/v8/ScriptPromiseResolver.h"
9 #include "bindings/core/v8/ScriptState.h" 9 #include "bindings/core/v8/ScriptState.h"
10 #include "bindings/core/v8/V8ArrayBuffer.h" 10 #include "bindings/core/v8/V8ArrayBuffer.h"
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
196 } else { 196 } else {
197 resolver->Resolve(String()); 197 resolver->Resolve(String());
198 } 198 }
199 return promise; 199 return promise;
200 } 200 }
201 201
202 ScriptValue Body::body(ScriptState* script_state) { 202 ScriptValue Body::body(ScriptState* script_state) {
203 if (!BodyBuffer()) 203 if (!BodyBuffer())
204 return ScriptValue::CreateNull(script_state); 204 return ScriptValue::CreateNull(script_state);
205 ScriptValue stream = BodyBuffer()->Stream(); 205 ScriptValue stream = BodyBuffer()->Stream();
206 ASSERT(stream.GetScriptState() == script_state); 206 DCHECK_EQ(stream.GetScriptState(), script_state);
207 return stream; 207 return stream;
208 } 208 }
209 209
210 bool Body::bodyUsed() { 210 bool Body::bodyUsed() {
211 return BodyBuffer() && BodyBuffer()->IsStreamDisturbed(); 211 return BodyBuffer() && BodyBuffer()->IsStreamDisturbed();
212 } 212 }
213 213
214 bool Body::IsBodyLocked() { 214 bool Body::IsBodyLocked() {
215 return BodyBuffer() && BodyBuffer()->IsStreamLocked(); 215 return BodyBuffer() && BodyBuffer()->IsStreamLocked();
216 } 216 }
(...skipping 10 matching lines...) Expand all
227 227
228 ScriptPromise Body::RejectInvalidConsumption(ScriptState* script_state) { 228 ScriptPromise Body::RejectInvalidConsumption(ScriptState* script_state) {
229 if (IsBodyLocked() || bodyUsed()) 229 if (IsBodyLocked() || bodyUsed())
230 return ScriptPromise::Reject( 230 return ScriptPromise::Reject(
231 script_state, V8ThrowException::CreateTypeError( 231 script_state, V8ThrowException::CreateTypeError(
232 script_state->GetIsolate(), "Already read")); 232 script_state->GetIsolate(), "Already read"));
233 return ScriptPromise(); 233 return ScriptPromise();
234 } 234 }
235 235
236 } // namespace blink 236 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/modules/fetch/BodyStreamBuffer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698