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

Side by Side Diff: Source/bindings/v8/custom/V8XMLHttpRequestCustom.cpp

Issue 18883002: Add Streams API support to XMLHttpRequest (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: kinuko's comment Created 7 years, 3 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 | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2008, 2009, 2010 Google Inc. All rights reserved. 2 * Copyright (C) 2008, 2009, 2010 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 17 matching lines...) Expand all
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */ 29 */
30 30
31 #include "config.h" 31 #include "config.h"
32 #include "V8XMLHttpRequest.h" 32 #include "V8XMLHttpRequest.h"
33 33
34 #include "V8Blob.h" 34 #include "V8Blob.h"
35 #include "V8Document.h" 35 #include "V8Document.h"
36 #include "V8FormData.h" 36 #include "V8FormData.h"
37 #include "V8HTMLDocument.h" 37 #include "V8HTMLDocument.h"
38 #include "V8Stream.h"
38 #include "bindings/v8/ExceptionState.h" 39 #include "bindings/v8/ExceptionState.h"
39 #include "bindings/v8/V8Binding.h" 40 #include "bindings/v8/V8Binding.h"
40 #include "bindings/v8/V8Utilities.h" 41 #include "bindings/v8/V8Utilities.h"
41 #include "bindings/v8/custom/V8ArrayBufferCustom.h" 42 #include "bindings/v8/custom/V8ArrayBufferCustom.h"
42 #include "bindings/v8/custom/V8ArrayBufferViewCustom.h" 43 #include "bindings/v8/custom/V8ArrayBufferViewCustom.h"
43 #include "core/dom/Document.h" 44 #include "core/dom/Document.h"
45 #include "core/fileapi/Stream.h"
44 #include "core/inspector/InspectorInstrumentation.h" 46 #include "core/inspector/InspectorInstrumentation.h"
45 #include "core/page/Frame.h" 47 #include "core/page/Frame.h"
46 #include "core/workers/WorkerGlobalScope.h" 48 #include "core/workers/WorkerGlobalScope.h"
47 #include "core/xml/XMLHttpRequest.h" 49 #include "core/xml/XMLHttpRequest.h"
48 #include "wtf/ArrayBuffer.h" 50 #include "wtf/ArrayBuffer.h"
49 51
50 #include <v8.h> 52 #include <v8.h>
51 53
52 namespace WebCore { 54 namespace WebCore {
53 55
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 return; 131 return;
130 } 132 }
131 133
132 case XMLHttpRequest::ResponseTypeBlob: 134 case XMLHttpRequest::ResponseTypeBlob:
133 { 135 {
134 Blob* blob = xmlHttpRequest->responseBlob(); 136 Blob* blob = xmlHttpRequest->responseBlob();
135 v8SetReturnValueFast(info, blob, xmlHttpRequest); 137 v8SetReturnValueFast(info, blob, xmlHttpRequest);
136 return; 138 return;
137 } 139 }
138 140
141 case XMLHttpRequest::ResponseTypeStream:
142 {
143 Stream* stream = xmlHttpRequest->responseStream();
144 v8SetReturnValueFast(info, stream, xmlHttpRequest);
145 return;
146 }
147
139 case XMLHttpRequest::ResponseTypeArrayBuffer: 148 case XMLHttpRequest::ResponseTypeArrayBuffer:
140 { 149 {
141 ArrayBuffer* arrayBuffer = xmlHttpRequest->responseArrayBuffer(); 150 ArrayBuffer* arrayBuffer = xmlHttpRequest->responseArrayBuffer();
142 if (arrayBuffer && !arrayBuffer->hasDeallocationObserver()) { 151 if (arrayBuffer && !arrayBuffer->hasDeallocationObserver()) {
143 arrayBuffer->setDeallocationObserver(V8ArrayBufferDeallocationOb server::instance()); 152 arrayBuffer->setDeallocationObserver(V8ArrayBufferDeallocationOb server::instance());
144 v8::V8::AdjustAmountOfExternalAllocatedMemory(arrayBuffer->byteL ength()); 153 v8::V8::AdjustAmountOfExternalAllocatedMemory(arrayBuffer->byteL ength());
145 } 154 }
146 v8SetReturnValueFast(info, arrayBuffer, xmlHttpRequest); 155 v8SetReturnValueFast(info, arrayBuffer, xmlHttpRequest);
147 return; 156 return;
148 } 157 }
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
240 ASSERT(arrayBufferView); 249 ASSERT(arrayBufferView);
241 xmlHttpRequest->send(arrayBufferView, es); 250 xmlHttpRequest->send(arrayBufferView, es);
242 } else 251 } else
243 xmlHttpRequest->send(toWebCoreStringWithNullCheck(arg), es); 252 xmlHttpRequest->send(toWebCoreStringWithNullCheck(arg), es);
244 } 253 }
245 254
246 es.throwIfNeeded(); 255 es.throwIfNeeded();
247 } 256 }
248 257
249 } // namespace WebCore 258 } // namespace WebCore
OLDNEW
« no previous file with comments | « LayoutTests/http/tests/xmlhttprequest/response-stream-expected.txt ('k') | Source/core/fileapi/Stream.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698