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

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: Fix Created 7 years, 4 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
« no previous file with comments | « no previous file | Source/core/xml/XMLHttpRequest.h » ('j') | Source/core/xml/XMLHttpRequest.cpp » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 18 matching lines...) Expand all
29 */ 29 */
30 30
31 #include "config.h" 31 #include "config.h"
32 #include "V8XMLHttpRequest.h" 32 #include "V8XMLHttpRequest.h"
33 33
34 #include "V8ArrayBufferView.h" 34 #include "V8ArrayBufferView.h"
35 #include "V8Blob.h" 35 #include "V8Blob.h"
36 #include "V8Document.h" 36 #include "V8Document.h"
37 #include "V8FormData.h" 37 #include "V8FormData.h"
38 #include "V8HTMLDocument.h" 38 #include "V8HTMLDocument.h"
39 #include "V8Stream.h"
39 #include "bindings/v8/ExceptionState.h" 40 #include "bindings/v8/ExceptionState.h"
40 #include "bindings/v8/V8Binding.h" 41 #include "bindings/v8/V8Binding.h"
41 #include "bindings/v8/V8Utilities.h" 42 #include "bindings/v8/V8Utilities.h"
42 #include "bindings/v8/custom/V8ArrayBufferCustom.h" 43 #include "bindings/v8/custom/V8ArrayBufferCustom.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 namespace WebCore { 52 namespace WebCore {
51 53
52 void V8XMLHttpRequest::constructorCustom(const v8::FunctionCallbackInfo<v8::Valu e>& args) 54 void V8XMLHttpRequest::constructorCustom(const v8::FunctionCallbackInfo<v8::Valu e>& args)
53 { 55 {
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 case XMLHttpRequest::ResponseTypeBlob: 105 case XMLHttpRequest::ResponseTypeBlob:
104 { 106 {
105 ExceptionState es(info.GetIsolate()); 107 ExceptionState es(info.GetIsolate());
106 Blob* blob = xmlHttpRequest->responseBlob(es); 108 Blob* blob = xmlHttpRequest->responseBlob(es);
107 if (es.throwIfNeeded()) 109 if (es.throwIfNeeded())
108 return; 110 return;
109 v8SetReturnValue(info, toV8Fast(blob, info, xmlHttpRequest)); 111 v8SetReturnValue(info, toV8Fast(blob, info, xmlHttpRequest));
110 return; 112 return;
111 } 113 }
112 114
115 case XMLHttpRequest::ResponseTypeStream:
116 {
117 ExceptionState es(info.GetIsolate());
118 Stream* stream = xmlHttpRequest->responseStream(es);
119 if (es.throwIfNeeded())
120 return;
121 v8SetReturnValue(info, toV8Fast(stream, info, xmlHttpRequest));
122 return;
123 }
124
113 case XMLHttpRequest::ResponseTypeArrayBuffer: 125 case XMLHttpRequest::ResponseTypeArrayBuffer:
114 { 126 {
115 ExceptionState es(info.GetIsolate()); 127 ExceptionState es(info.GetIsolate());
116 ArrayBuffer* arrayBuffer = xmlHttpRequest->responseArrayBuffer(es); 128 ArrayBuffer* arrayBuffer = xmlHttpRequest->responseArrayBuffer(es);
117 if (es.throwIfNeeded()) 129 if (es.throwIfNeeded())
118 return; 130 return;
119 if (arrayBuffer && !arrayBuffer->hasDeallocationObserver()) { 131 if (arrayBuffer && !arrayBuffer->hasDeallocationObserver()) {
120 arrayBuffer->setDeallocationObserver(V8ArrayBufferDeallocationOb server::instance()); 132 arrayBuffer->setDeallocationObserver(V8ArrayBufferDeallocationOb server::instance());
121 v8::V8::AdjustAmountOfExternalAllocatedMemory(arrayBuffer->byteL ength()); 133 v8::V8::AdjustAmountOfExternalAllocatedMemory(arrayBuffer->byteL ength());
122 } 134 }
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
217 ASSERT(arrayBufferView); 229 ASSERT(arrayBufferView);
218 xmlHttpRequest->send(arrayBufferView, es); 230 xmlHttpRequest->send(arrayBufferView, es);
219 } else 231 } else
220 xmlHttpRequest->send(toWebCoreStringWithNullCheck(arg), es); 232 xmlHttpRequest->send(toWebCoreStringWithNullCheck(arg), es);
221 } 233 }
222 234
223 es.throwIfNeeded(); 235 es.throwIfNeeded();
224 } 236 }
225 237
226 } // namespace WebCore 238 } // namespace WebCore
OLDNEW
« no previous file with comments | « no previous file | Source/core/xml/XMLHttpRequest.h » ('j') | Source/core/xml/XMLHttpRequest.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698