| 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 3000 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3011 // Validate the passed array of transferrables. | 3011 // Validate the passed array of transferrables. |
| 3012 for (unsigned i = 0; i < length; ++i) { | 3012 for (unsigned i = 0; i < length; ++i) { |
| 3013 v8::Local<v8::Value> transferrable = transferrables->Get(i); | 3013 v8::Local<v8::Value> transferrable = transferrables->Get(i); |
| 3014 // Validation of non-null objects, per HTML5 spec 10.3.3. | 3014 // Validation of non-null objects, per HTML5 spec 10.3.3. |
| 3015 if (isUndefinedOrNull(transferrable)) { | 3015 if (isUndefinedOrNull(transferrable)) { |
| 3016 exceptionState.throwDOMException(DataCloneError, "Value at index " +
String::number(i) + " is an untransferable " + (transferrable->IsUndefined() ?
"'undefined'" : "'null'") + " value."); | 3016 exceptionState.throwDOMException(DataCloneError, "Value at index " +
String::number(i) + " is an untransferable " + (transferrable->IsUndefined() ?
"'undefined'" : "'null'") + " value."); |
| 3017 return false; | 3017 return false; |
| 3018 } | 3018 } |
| 3019 // Validation of Objects implementing an interface, per WebIDL spec 4.1.
15. | 3019 // Validation of Objects implementing an interface, per WebIDL spec 4.1.
15. |
| 3020 if (V8MessagePort::hasInstance(transferrable, isolate)) { | 3020 if (V8MessagePort::hasInstance(transferrable, isolate)) { |
| 3021 RefPtr<MessagePort> port = V8MessagePort::toNative(v8::Handle<v8::Ob
ject>::Cast(transferrable)); | 3021 RefPtrWillBeRawPtr<MessagePort> port = V8MessagePort::toNative(v8::H
andle<v8::Object>::Cast(transferrable)); |
| 3022 // Check for duplicate MessagePorts. | 3022 // Check for duplicate MessagePorts. |
| 3023 if (ports.contains(port)) { | 3023 if (ports.contains(port)) { |
| 3024 exceptionState.throwDOMException(DataCloneError, "Message port a
t index " + String::number(i) + " is a duplicate of an earlier port."); | 3024 exceptionState.throwDOMException(DataCloneError, "Message port a
t index " + String::number(i) + " is a duplicate of an earlier port."); |
| 3025 return false; | 3025 return false; |
| 3026 } | 3026 } |
| 3027 ports.append(port.release()); | 3027 ports.append(port.release()); |
| 3028 } else if (V8ArrayBuffer::hasInstance(transferrable, isolate)) { | 3028 } else if (V8ArrayBuffer::hasInstance(transferrable, isolate)) { |
| 3029 RefPtr<ArrayBuffer> arrayBuffer = V8ArrayBuffer::toNative(v8::Handle
<v8::Object>::Cast(transferrable)); | 3029 RefPtr<ArrayBuffer> arrayBuffer = V8ArrayBuffer::toNative(v8::Handle
<v8::Object>::Cast(transferrable)); |
| 3030 if (arrayBuffers.contains(arrayBuffer)) { | 3030 if (arrayBuffers.contains(arrayBuffer)) { |
| 3031 exceptionState.throwDOMException(DataCloneError, "ArrayBuffer at
index " + String::number(i) + " is a duplicate of an earlier ArrayBuffer."); | 3031 exceptionState.throwDOMException(DataCloneError, "ArrayBuffer at
index " + String::number(i) + " is a duplicate of an earlier ArrayBuffer."); |
| (...skipping 21 matching lines...) Expand all Loading... |
| 3053 // If the allocated memory was not registered before, then this class is lik
ely | 3053 // If the allocated memory was not registered before, then this class is lik
ely |
| 3054 // used in a context other then Worker's onmessage environment and the prese
nce of | 3054 // used in a context other then Worker's onmessage environment and the prese
nce of |
| 3055 // current v8 context is not guaranteed. Avoid calling v8 then. | 3055 // current v8 context is not guaranteed. Avoid calling v8 then. |
| 3056 if (m_externallyAllocatedMemory) { | 3056 if (m_externallyAllocatedMemory) { |
| 3057 ASSERT(v8::Isolate::GetCurrent()); | 3057 ASSERT(v8::Isolate::GetCurrent()); |
| 3058 v8::Isolate::GetCurrent()->AdjustAmountOfExternalAllocatedMemory(-m_exte
rnallyAllocatedMemory); | 3058 v8::Isolate::GetCurrent()->AdjustAmountOfExternalAllocatedMemory(-m_exte
rnallyAllocatedMemory); |
| 3059 } | 3059 } |
| 3060 } | 3060 } |
| 3061 | 3061 |
| 3062 } // namespace WebCore | 3062 } // namespace WebCore |
| OLD | NEW |