| 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 2015 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2026 } | 2026 } |
| 2027 | 2027 |
| 2028 SerializedScriptValue::SerializedScriptValue() | 2028 SerializedScriptValue::SerializedScriptValue() |
| 2029 : m_externallyAllocatedMemory(0) | 2029 : m_externallyAllocatedMemory(0) |
| 2030 { | 2030 { |
| 2031 } | 2031 } |
| 2032 | 2032 |
| 2033 static void neuterArrayBufferInAllWorlds(ArrayBuffer* object) | 2033 static void neuterArrayBufferInAllWorlds(ArrayBuffer* object) |
| 2034 { | 2034 { |
| 2035 v8::Isolate* isolate = v8::Isolate::GetCurrent(); | 2035 v8::Isolate* isolate = v8::Isolate::GetCurrent(); |
| 2036 if (isMainThread()) { | 2036 v8::Handle<v8::Object> wrapper = DOMWrapperWorld::current(isolate).domDataSt
ore().get<V8ArrayBuffer>(object, isolate); |
| 2037 Vector<RefPtr<DOMWrapperWorld> > worlds; | 2037 if (!wrapper.IsEmpty()) { |
| 2038 DOMWrapperWorld::allWorldsInMainThread(worlds); | 2038 ASSERT(wrapper->IsArrayBuffer()); |
| 2039 for (size_t i = 0; i < worlds.size(); i++) { | 2039 v8::Handle<v8::ArrayBuffer>::Cast(wrapper)->Neuter(); |
| 2040 v8::Handle<v8::Object> wrapper = worlds[i]->domDataStore().get<V8Arr
ayBuffer>(object, isolate); | |
| 2041 if (!wrapper.IsEmpty()) { | |
| 2042 ASSERT(wrapper->IsArrayBuffer()); | |
| 2043 v8::Handle<v8::ArrayBuffer>::Cast(wrapper)->Neuter(); | |
| 2044 } | |
| 2045 } | |
| 2046 } else { | |
| 2047 v8::Handle<v8::Object> wrapper = DOMWrapperWorld::current(isolate).domDa
taStore().get<V8ArrayBuffer>(object, isolate); | |
| 2048 if (!wrapper.IsEmpty()) { | |
| 2049 ASSERT(wrapper->IsArrayBuffer()); | |
| 2050 v8::Handle<v8::ArrayBuffer>::Cast(wrapper)->Neuter(); | |
| 2051 } | |
| 2052 } | 2040 } |
| 2053 } | 2041 } |
| 2054 | 2042 |
| 2055 PassOwnPtr<SerializedScriptValue::ArrayBufferContentsArray> SerializedScriptValu
e::transferArrayBuffers(ArrayBufferArray& arrayBuffers, ExceptionState& exceptio
nState, v8::Isolate* isolate) | 2043 PassOwnPtr<SerializedScriptValue::ArrayBufferContentsArray> SerializedScriptValu
e::transferArrayBuffers(ArrayBufferArray& arrayBuffers, ExceptionState& exceptio
nState, v8::Isolate* isolate) |
| 2056 { | 2044 { |
| 2057 ASSERT(arrayBuffers.size()); | 2045 ASSERT(arrayBuffers.size()); |
| 2058 | 2046 |
| 2059 for (size_t i = 0; i < arrayBuffers.size(); i++) { | 2047 for (size_t i = 0; i < arrayBuffers.size(); i++) { |
| 2060 if (arrayBuffers[i]->isNeutered()) { | 2048 if (arrayBuffers[i]->isNeutered()) { |
| 2061 exceptionState.throwDOMException(DataCloneError, "ArrayBuffer at ind
ex " + String::number(i) + " is already neutered."); | 2049 exceptionState.throwDOMException(DataCloneError, "ArrayBuffer at ind
ex " + String::number(i) + " is already neutered."); |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2152 // If the allocated memory was not registered before, then this class is lik
ely | 2140 // If the allocated memory was not registered before, then this class is lik
ely |
| 2153 // used in a context other then Worker's onmessage environment and the prese
nce of | 2141 // used in a context other then Worker's onmessage environment and the prese
nce of |
| 2154 // current v8 context is not guaranteed. Avoid calling v8 then. | 2142 // current v8 context is not guaranteed. Avoid calling v8 then. |
| 2155 if (m_externallyAllocatedMemory) { | 2143 if (m_externallyAllocatedMemory) { |
| 2156 ASSERT(v8::Isolate::GetCurrent()); | 2144 ASSERT(v8::Isolate::GetCurrent()); |
| 2157 v8::Isolate::GetCurrent()->AdjustAmountOfExternalAllocatedMemory(-m_exte
rnallyAllocatedMemory); | 2145 v8::Isolate::GetCurrent()->AdjustAmountOfExternalAllocatedMemory(-m_exte
rnallyAllocatedMemory); |
| 2158 } | 2146 } |
| 2159 } | 2147 } |
| 2160 | 2148 |
| 2161 } // namespace blink | 2149 } // namespace blink |
| OLD | NEW |