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 2891 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2902 } | 2902 } |
2903 } else { | 2903 } else { |
2904 v8::Handle<v8::Object> wrapper = DOMWrapperWorld::current(isolate).domDa
taStore().get<V8ArrayBuffer>(object, isolate); | 2904 v8::Handle<v8::Object> wrapper = DOMWrapperWorld::current(isolate).domDa
taStore().get<V8ArrayBuffer>(object, isolate); |
2905 if (!wrapper.IsEmpty()) { | 2905 if (!wrapper.IsEmpty()) { |
2906 ASSERT(wrapper->IsArrayBuffer()); | 2906 ASSERT(wrapper->IsArrayBuffer()); |
2907 v8::Handle<v8::ArrayBuffer>::Cast(wrapper)->Neuter(); | 2907 v8::Handle<v8::ArrayBuffer>::Cast(wrapper)->Neuter(); |
2908 } | 2908 } |
2909 } | 2909 } |
2910 } | 2910 } |
2911 | 2911 |
2912 PassOwnPtr<SerializedScriptValue::ArrayBufferContentsArray> SerializedScriptValu
e::transferArrayBuffers(ArrayBufferArray& arrayBuffers, ExceptionState& exceptio
nState, v8::Isolate* isolate) | 2912 PassOwnPtr<SerializedScriptValue::ArrayBufferContentsArray> SerializedScriptValu
e::transferArrayBuffers(v8::Isolate* isolate, ArrayBufferArray& arrayBuffers, Ex
ceptionState& exceptionState) |
2913 { | 2913 { |
2914 ASSERT(arrayBuffers.size()); | 2914 ASSERT(arrayBuffers.size()); |
2915 | 2915 |
2916 for (size_t i = 0; i < arrayBuffers.size(); i++) { | 2916 for (size_t i = 0; i < arrayBuffers.size(); i++) { |
2917 if (arrayBuffers[i]->isNeutered()) { | 2917 if (arrayBuffers[i]->isNeutered()) { |
2918 exceptionState.throwDOMException(DataCloneError, "ArrayBuffer at ind
ex " + String::number(i) + " is already neutered."); | 2918 exceptionState.throwDOMException(DataCloneError, "ArrayBuffer at ind
ex " + String::number(i) + " is already neutered."); |
2919 return nullptr; | 2919 return nullptr; |
2920 } | 2920 } |
2921 } | 2921 } |
2922 | 2922 |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2958 } | 2958 } |
2959 switch (status) { | 2959 switch (status) { |
2960 case Serializer::InputError: | 2960 case Serializer::InputError: |
2961 case Serializer::DataCloneError: | 2961 case Serializer::DataCloneError: |
2962 exceptionState.throwDOMException(DataCloneError, errorMessage); | 2962 exceptionState.throwDOMException(DataCloneError, errorMessage); |
2963 return; | 2963 return; |
2964 case Serializer::Success: | 2964 case Serializer::Success: |
2965 m_data = writer.takeWireString(); | 2965 m_data = writer.takeWireString(); |
2966 ASSERT(m_data.impl()->hasOneRef()); | 2966 ASSERT(m_data.impl()->hasOneRef()); |
2967 if (arrayBuffers && arrayBuffers->size()) | 2967 if (arrayBuffers && arrayBuffers->size()) |
2968 m_arrayBufferContentsArray = transferArrayBuffers(*arrayBuffers, exc
eptionState, isolate); | 2968 m_arrayBufferContentsArray = transferArrayBuffers(isolate, *arrayBuf
fers, exceptionState); |
2969 return; | 2969 return; |
2970 case Serializer::JSException: | 2970 case Serializer::JSException: |
2971 ASSERT_NOT_REACHED(); | 2971 ASSERT_NOT_REACHED(); |
2972 break; | 2972 break; |
2973 } | 2973 } |
2974 ASSERT_NOT_REACHED(); | 2974 ASSERT_NOT_REACHED(); |
2975 } | 2975 } |
2976 | 2976 |
2977 SerializedScriptValue::SerializedScriptValue(const String& wireData) | 2977 SerializedScriptValue::SerializedScriptValue(const String& wireData) |
2978 : m_externallyAllocatedMemory(0) | 2978 : m_externallyAllocatedMemory(0) |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3069 // If the allocated memory was not registered before, then this class is lik
ely | 3069 // If the allocated memory was not registered before, then this class is lik
ely |
3070 // used in a context other then Worker's onmessage environment and the prese
nce of | 3070 // used in a context other then Worker's onmessage environment and the prese
nce of |
3071 // current v8 context is not guaranteed. Avoid calling v8 then. | 3071 // current v8 context is not guaranteed. Avoid calling v8 then. |
3072 if (m_externallyAllocatedMemory) { | 3072 if (m_externallyAllocatedMemory) { |
3073 ASSERT(v8::Isolate::GetCurrent()); | 3073 ASSERT(v8::Isolate::GetCurrent()); |
3074 v8::Isolate::GetCurrent()->AdjustAmountOfExternalAllocatedMemory(-m_exte
rnallyAllocatedMemory); | 3074 v8::Isolate::GetCurrent()->AdjustAmountOfExternalAllocatedMemory(-m_exte
rnallyAllocatedMemory); |
3075 } | 3075 } |
3076 } | 3076 } |
3077 | 3077 |
3078 } // namespace blink | 3078 } // namespace blink |
OLD | NEW |