OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2010 Google Inc. All rights reserved. | 2 * Copyright (C) 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 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
170 } else { | 170 } else { |
171 Vector<v8::Local<v8::ArrayBuffer>, 4> bufferHandles; | 171 Vector<v8::Local<v8::ArrayBuffer>, 4> bufferHandles; |
172 v8::HandleScope handleScope(isolate); | 172 v8::HandleScope handleScope(isolate); |
173 acculumateArrayBuffersForAllWorlds(isolate, static_cast<DOMArrayBuff
er*>(arrayBuffers[i].get()), bufferHandles); | 173 acculumateArrayBuffersForAllWorlds(isolate, static_cast<DOMArrayBuff
er*>(arrayBuffers[i].get()), bufferHandles); |
174 bool isNeuterable = true; | 174 bool isNeuterable = true; |
175 for (size_t j = 0; j < bufferHandles.size(); ++j) | 175 for (size_t j = 0; j < bufferHandles.size(); ++j) |
176 isNeuterable &= bufferHandles[j]->IsNeuterable(); | 176 isNeuterable &= bufferHandles[j]->IsNeuterable(); |
177 | 177 |
178 DOMArrayBufferBase* toTransfer = arrayBuffers[i]; | 178 DOMArrayBufferBase* toTransfer = arrayBuffers[i]; |
179 if (!isNeuterable) | 179 if (!isNeuterable) |
180 toTransfer = DOMArrayBuffer::create(arrayBuffers[i]->buffer()); | 180 toTransfer = DOMArrayBuffer::create(arrayBuffers[i]->buffer()->d
ata(), arrayBuffers[i]->buffer()->byteLength()); |
181 bool result = toTransfer->transfer(contents->at(i)); | 181 bool result = toTransfer->transfer(contents->at(i)); |
182 if (!result) { | 182 if (!result) { |
183 exceptionState.throwDOMException(DataCloneError, "ArrayBuffer at
index " + String::number(i) + " could not be transferred."); | 183 exceptionState.throwDOMException(DataCloneError, "ArrayBuffer at
index " + String::number(i) + " could not be transferred."); |
184 return; | 184 return; |
185 } | 185 } |
186 | 186 |
187 if (isNeuterable) | 187 if (isNeuterable) |
188 for (size_t j = 0; j < bufferHandles.size(); ++j) | 188 for (size_t j = 0; j < bufferHandles.size(); ++j) |
189 bufferHandles[j]->Neuter(); | 189 bufferHandles[j]->Neuter(); |
190 } | 190 } |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
281 m_externallyAllocatedMemory = static_cast<intptr_t>(m_data.length()); | 281 m_externallyAllocatedMemory = static_cast<intptr_t>(m_data.length()); |
282 v8::Isolate::GetCurrent()->AdjustAmountOfExternalAllocatedMemory(m_externall
yAllocatedMemory); | 282 v8::Isolate::GetCurrent()->AdjustAmountOfExternalAllocatedMemory(m_externall
yAllocatedMemory); |
283 } | 283 } |
284 | 284 |
285 bool SerializedScriptValue::containsTransferableArrayBuffer() const | 285 bool SerializedScriptValue::containsTransferableArrayBuffer() const |
286 { | 286 { |
287 return m_arrayBufferContentsArray && !m_arrayBufferContentsArray->isEmpty(); | 287 return m_arrayBufferContentsArray && !m_arrayBufferContentsArray->isEmpty(); |
288 } | 288 } |
289 | 289 |
290 } // namespace blink | 290 } // namespace blink |
OLD | NEW |