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

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

Issue 2292763002: [Fetch API] Implement Request.formData and Response.formData. (Closed)
Patch Set: Rebase Created 3 years, 7 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 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/BodyStreamBuffer.h" 5 #include "modules/fetch/BodyStreamBuffer.h"
6 6
7 #include <memory> 7 #include <memory>
8 #include "bindings/core/v8/ExceptionState.h" 8 #include "bindings/core/v8/ExceptionState.h"
9 #include "bindings/core/v8/ScriptState.h" 9 #include "bindings/core/v8/ScriptState.h"
10 #include "bindings/core/v8/V8PrivateProperty.h" 10 #include "bindings/core/v8/V8PrivateProperty.h"
(...skipping 30 matching lines...) Expand all
41 PassRefPtr<BlobDataHandle> blob_data_handle) override { 41 PassRefPtr<BlobDataHandle> blob_data_handle) override {
42 buffer_->EndLoading(); 42 buffer_->EndLoading();
43 client_->DidFetchDataLoadedBlobHandle(std::move(blob_data_handle)); 43 client_->DidFetchDataLoadedBlobHandle(std::move(blob_data_handle));
44 } 44 }
45 45
46 void DidFetchDataLoadedArrayBuffer(DOMArrayBuffer* array_buffer) override { 46 void DidFetchDataLoadedArrayBuffer(DOMArrayBuffer* array_buffer) override {
47 buffer_->EndLoading(); 47 buffer_->EndLoading();
48 client_->DidFetchDataLoadedArrayBuffer(array_buffer); 48 client_->DidFetchDataLoadedArrayBuffer(array_buffer);
49 } 49 }
50 50
51 void DidFetchDataLoadedFormData(FormData* form_data) override {
52 buffer_->EndLoading();
53 client_->DidFetchDataLoadedFormData(form_data);
54 }
55
51 void DidFetchDataLoadedString(const String& string) override { 56 void DidFetchDataLoadedString(const String& string) override {
52 buffer_->EndLoading(); 57 buffer_->EndLoading();
53 client_->DidFetchDataLoadedString(string); 58 client_->DidFetchDataLoadedString(string);
54 } 59 }
55 60
56 void DidFetchDataLoadedDataPipe() override { 61 void DidFetchDataLoadedDataPipe() override {
57 buffer_->EndLoading(); 62 buffer_->EndLoading();
58 client_->DidFetchDataLoadedDataPipe(); 63 client_->DidFetchDataLoadedDataPipe();
59 } 64 }
60 65
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after
277 } 282 }
278 283
279 ScriptState::Scope scope(script_state_.Get()); 284 ScriptState::Scope scope(script_state_.Get());
280 NonThrowableExceptionState exception_state; 285 NonThrowableExceptionState exception_state;
281 ScriptValue reader = ReadableStreamOperations::GetReader( 286 ScriptValue reader = ReadableStreamOperations::GetReader(
282 script_state_.Get(), Stream(), exception_state); 287 script_state_.Get(), Stream(), exception_state);
283 ReadableStreamOperations::DefaultReaderRead(script_state_.Get(), reader); 288 ReadableStreamOperations::DefaultReaderRead(script_state_.Get(), reader);
284 } 289 }
285 290
286 void BodyStreamBuffer::Close() { 291 void BodyStreamBuffer::Close() {
287 Controller()->Close(); 292 if (Controller())
yhirano 2017/05/10 05:59:36 Can you tell me why we need this change?
e_hakkinen 2017/05/11 11:01:51 Without this change, external/wpt/fetch/api/respon
yhirano 2017/05/12 11:54:12 Hmm, I think calling CloseAndLockAndDisturb in suc
293 Controller()->Close();
288 CancelConsumer(); 294 CancelConsumer();
289 } 295 }
290 296
291 void BodyStreamBuffer::GetError() { 297 void BodyStreamBuffer::GetError() {
292 { 298 {
293 ScriptState::Scope scope(script_state_.Get()); 299 ScriptState::Scope scope(script_state_.Get());
294 Controller()->GetError(V8ThrowException::CreateTypeError( 300 Controller()->GetError(V8ThrowException::CreateTypeError(
295 script_state_->GetIsolate(), "network error")); 301 script_state_->GetIsolate(), "network error"));
296 } 302 }
297 CancelConsumer(); 303 CancelConsumer();
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
389 } 395 }
390 if (is_errored) 396 if (is_errored)
391 return BytesConsumer::CreateErrored(BytesConsumer::Error("error")); 397 return BytesConsumer::CreateErrored(BytesConsumer::Error("error"));
392 398
393 DCHECK(consumer); 399 DCHECK(consumer);
394 consumer->ClearClient(); 400 consumer->ClearClient();
395 return consumer; 401 return consumer;
396 } 402 }
397 403
398 } // namespace blink 404 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698