| 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 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 260 } | 260 } |
| 261 // Validation of Objects implementing an interface, per WebIDL spec 4.1.
15. | 261 // Validation of Objects implementing an interface, per WebIDL spec 4.1.
15. |
| 262 if (V8MessagePort::hasInstance(transferableObject, isolate)) { | 262 if (V8MessagePort::hasInstance(transferableObject, isolate)) { |
| 263 MessagePort* port = V8MessagePort::toImpl(v8::Local<v8::Object>::Cas
t(transferableObject)); | 263 MessagePort* port = V8MessagePort::toImpl(v8::Local<v8::Object>::Cas
t(transferableObject)); |
| 264 // Check for duplicate MessagePorts. | 264 // Check for duplicate MessagePorts. |
| 265 if (transferables.messagePorts.contains(port)) { | 265 if (transferables.messagePorts.contains(port)) { |
| 266 exceptionState.throwDOMException(DataCloneError, "Message port a
t index " + String::number(i) + " is a duplicate of an earlier port."); | 266 exceptionState.throwDOMException(DataCloneError, "Message port a
t index " + String::number(i) + " is a duplicate of an earlier port."); |
| 267 return false; | 267 return false; |
| 268 } | 268 } |
| 269 transferables.messagePorts.append(port); | 269 transferables.messagePorts.append(port); |
| 270 } else if (V8ArrayBuffer::hasInstance(transferableObject, isolate)) { | 270 } else if (transferableObject->IsArrayBuffer()) { |
| 271 DOMArrayBuffer* arrayBuffer = V8ArrayBuffer::toImpl(v8::Local<v8::Ob
ject>::Cast(transferableObject)); | 271 DOMArrayBuffer* arrayBuffer = V8ArrayBuffer::toImpl(v8::Local<v8::Ob
ject>::Cast(transferableObject)); |
| 272 if (transferables.arrayBuffers.contains(arrayBuffer)) { | 272 if (transferables.arrayBuffers.contains(arrayBuffer)) { |
| 273 exceptionState.throwDOMException(DataCloneError, "ArrayBuffer at
index " + String::number(i) + " is a duplicate of an earlier ArrayBuffer."); | 273 exceptionState.throwDOMException(DataCloneError, "ArrayBuffer at
index " + String::number(i) + " is a duplicate of an earlier ArrayBuffer."); |
| 274 return false; | 274 return false; |
| 275 } | 275 } |
| 276 transferables.arrayBuffers.append(arrayBuffer); | 276 transferables.arrayBuffers.append(arrayBuffer); |
| 277 } else if (V8SharedArrayBuffer::hasInstance(transferableObject, isolate)
) { | 277 } else if (transferableObject->IsSharedArrayBuffer()) { |
| 278 DOMSharedArrayBuffer* sharedArrayBuffer = V8SharedArrayBuffer::toImp
l(v8::Local<v8::Object>::Cast(transferableObject)); | 278 DOMSharedArrayBuffer* sharedArrayBuffer = V8SharedArrayBuffer::toImp
l(v8::Local<v8::Object>::Cast(transferableObject)); |
| 279 if (transferables.arrayBuffers.contains(sharedArrayBuffer)) { | 279 if (transferables.arrayBuffers.contains(sharedArrayBuffer)) { |
| 280 exceptionState.throwDOMException(DataCloneError, "SharedArrayBuf
fer at index " + String::number(i) + " is a duplicate of an earlier SharedArrayB
uffer."); | 280 exceptionState.throwDOMException(DataCloneError, "SharedArrayBuf
fer at index " + String::number(i) + " is a duplicate of an earlier SharedArrayB
uffer."); |
| 281 return false; | 281 return false; |
| 282 } | 282 } |
| 283 transferables.arrayBuffers.append(sharedArrayBuffer); | 283 transferables.arrayBuffers.append(sharedArrayBuffer); |
| 284 } else if (V8ImageBitmap::hasInstance(transferableObject, isolate)) { | 284 } else if (V8ImageBitmap::hasInstance(transferableObject, isolate)) { |
| 285 ImageBitmap* imageBitmap = V8ImageBitmap::toImpl(v8::Local<v8::Objec
t>::Cast(transferableObject)); | 285 ImageBitmap* imageBitmap = V8ImageBitmap::toImpl(v8::Local<v8::Objec
t>::Cast(transferableObject)); |
| 286 if (transferables.imageBitmaps.contains(imageBitmap)) { | 286 if (transferables.imageBitmaps.contains(imageBitmap)) { |
| 287 exceptionState.throwDOMException(DataCloneError, "ImageBitmap at
index " + String::number(i) + " is a duplicate of an earlier ImageBitmap."); | 287 exceptionState.throwDOMException(DataCloneError, "ImageBitmap at
index " + String::number(i) + " is a duplicate of an earlier ImageBitmap."); |
| (...skipping 22 matching lines...) Expand all Loading... |
| 310 m_externallyAllocatedMemory = static_cast<intptr_t>(m_data.length()); | 310 m_externallyAllocatedMemory = static_cast<intptr_t>(m_data.length()); |
| 311 v8::Isolate::GetCurrent()->AdjustAmountOfExternalAllocatedMemory(m_externall
yAllocatedMemory); | 311 v8::Isolate::GetCurrent()->AdjustAmountOfExternalAllocatedMemory(m_externall
yAllocatedMemory); |
| 312 } | 312 } |
| 313 | 313 |
| 314 bool SerializedScriptValue::containsTransferableArrayBuffer() const | 314 bool SerializedScriptValue::containsTransferableArrayBuffer() const |
| 315 { | 315 { |
| 316 return m_arrayBufferContentsArray && !m_arrayBufferContentsArray->isEmpty(); | 316 return m_arrayBufferContentsArray && !m_arrayBufferContentsArray->isEmpty(); |
| 317 } | 317 } |
| 318 | 318 |
| 319 } // namespace blink | 319 } // namespace blink |
| OLD | NEW |