| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 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 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 113 { | 113 { |
| 114 // FIXME: handle sequences based on ES6 @@iterator, see http://crbug.com/393
866 | 114 // FIXME: handle sequences based on ES6 @@iterator, see http://crbug.com/393
866 |
| 115 v8::Local<v8::Array> array = v8::Local<v8::Array>::Cast(blobParts); | 115 v8::Local<v8::Array> array = v8::Local<v8::Array>::Cast(blobParts); |
| 116 uint32_t length = v8::Local<v8::Array>::Cast(blobParts)->Length(); | 116 uint32_t length = v8::Local<v8::Array>::Cast(blobParts)->Length(); |
| 117 for (uint32_t i = 0; i < length; ++i) { | 117 for (uint32_t i = 0; i < length; ++i) { |
| 118 v8::Local<v8::Value> item = array->Get(i); | 118 v8::Local<v8::Value> item = array->Get(i); |
| 119 if (item.IsEmpty()) | 119 if (item.IsEmpty()) |
| 120 return false; | 120 return false; |
| 121 | 121 |
| 122 if (V8ArrayBuffer::hasInstance(item, isolate)) { | 122 if (V8ArrayBuffer::hasInstance(item, isolate)) { |
| 123 DOMArrayBuffer* arrayBuffer = V8ArrayBuffer::toImpl(v8::Handle<v8::O
bject>::Cast(item)); | 123 DOMArrayBuffer* arrayBuffer = V8ArrayBuffer::toImpl(v8::Local<v8::Ob
ject>::Cast(item)); |
| 124 ASSERT(arrayBuffer); | 124 ASSERT(arrayBuffer); |
| 125 blobData.appendBytes(arrayBuffer->data(), arrayBuffer->byteLength())
; | 125 blobData.appendBytes(arrayBuffer->data(), arrayBuffer->byteLength())
; |
| 126 } else if (V8ArrayBufferView::hasInstance(item, isolate)) { | 126 } else if (V8ArrayBufferView::hasInstance(item, isolate)) { |
| 127 DOMArrayBufferView* arrayBufferView = V8ArrayBufferView::toImpl(v8::
Handle<v8::Object>::Cast(item)); | 127 DOMArrayBufferView* arrayBufferView = V8ArrayBufferView::toImpl(v8::
Local<v8::Object>::Cast(item)); |
| 128 ASSERT(arrayBufferView); | 128 ASSERT(arrayBufferView); |
| 129 blobData.appendBytes(arrayBufferView->baseAddress(), arrayBufferView
->byteLength()); | 129 blobData.appendBytes(arrayBufferView->baseAddress(), arrayBufferView
->byteLength()); |
| 130 } else if (V8Blob::hasInstance(item, isolate)) { | 130 } else if (V8Blob::hasInstance(item, isolate)) { |
| 131 Blob* blob = V8Blob::toImpl(v8::Handle<v8::Object>::Cast(item)); | 131 Blob* blob = V8Blob::toImpl(v8::Local<v8::Object>::Cast(item)); |
| 132 ASSERT(blob); | 132 ASSERT(blob); |
| 133 blob->appendTo(blobData); | 133 blob->appendTo(blobData); |
| 134 } else { | 134 } else { |
| 135 TOSTRING_DEFAULT(V8StringResource<>, stringValue, item, false); | 135 TOSTRING_DEFAULT(V8StringResource<>, stringValue, item, false); |
| 136 blobData.appendText(stringValue, normalizeLineEndingsToNative); | 136 blobData.appendText(stringValue, normalizeLineEndingsToNative); |
| 137 } | 137 } |
| 138 } | 138 } |
| 139 return true; | 139 return true; |
| 140 } | 140 } |
| 141 | 141 |
| 142 } // namespace V8BlobCustomHelpers | 142 } // namespace V8BlobCustomHelpers |
| 143 | 143 |
| 144 } // namespace blink | 144 } // namespace blink |
| OLD | NEW |