| 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 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 231 } | 231 } |
| 232 | 232 |
| 233 void SerializedScriptValue::registerMemoryAllocatedWithCurrentScriptContext() | 233 void SerializedScriptValue::registerMemoryAllocatedWithCurrentScriptContext() |
| 234 { | 234 { |
| 235 if (m_externallyAllocatedMemory) | 235 if (m_externallyAllocatedMemory) |
| 236 return; | 236 return; |
| 237 m_externallyAllocatedMemory = static_cast<intptr_t>(m_data.length()); | 237 m_externallyAllocatedMemory = static_cast<intptr_t>(m_data.length()); |
| 238 v8::Isolate::GetCurrent()->AdjustAmountOfExternalAllocatedMemory(m_externall
yAllocatedMemory); | 238 v8::Isolate::GetCurrent()->AdjustAmountOfExternalAllocatedMemory(m_externall
yAllocatedMemory); |
| 239 } | 239 } |
| 240 | 240 |
| 241 bool SerializedScriptValue::containsTransferableArrayBuffer() |
| 242 { |
| 243 return m_arrayBufferContentsArray && !m_arrayBufferContentsArray->isEmpty(); |
| 244 } |
| 245 |
| 241 SerializedScriptValue::~SerializedScriptValue() | 246 SerializedScriptValue::~SerializedScriptValue() |
| 242 { | 247 { |
| 243 // If the allocated memory was not registered before, then this class is lik
ely | 248 // If the allocated memory was not registered before, then this class is lik
ely |
| 244 // used in a context other then Worker's onmessage environment and the prese
nce of | 249 // used in a context other then Worker's onmessage environment and the prese
nce of |
| 245 // current v8 context is not guaranteed. Avoid calling v8 then. | 250 // current v8 context is not guaranteed. Avoid calling v8 then. |
| 246 if (m_externallyAllocatedMemory) { | 251 if (m_externallyAllocatedMemory) { |
| 247 ASSERT(v8::Isolate::GetCurrent()); | 252 ASSERT(v8::Isolate::GetCurrent()); |
| 248 v8::Isolate::GetCurrent()->AdjustAmountOfExternalAllocatedMemory(-m_exte
rnallyAllocatedMemory); | 253 v8::Isolate::GetCurrent()->AdjustAmountOfExternalAllocatedMemory(-m_exte
rnallyAllocatedMemory); |
| 249 } | 254 } |
| 250 } | 255 } |
| 251 | 256 |
| 252 void SerializedScriptValue::transferArrayBuffers(v8::Isolate* isolate, ArrayBuff
erArray& arrayBuffers, ExceptionState& exceptionState) | 257 void SerializedScriptValue::transferArrayBuffers(v8::Isolate* isolate, ArrayBuff
erArray& arrayBuffers, ExceptionState& exceptionState) |
| 253 { | 258 { |
| 254 m_arrayBufferContentsArray = createArrayBuffers(isolate, arrayBuffers, excep
tionState); | 259 m_arrayBufferContentsArray = createArrayBuffers(isolate, arrayBuffers, excep
tionState); |
| 255 } | 260 } |
| 256 | 261 |
| 257 } // namespace blink | 262 } // namespace blink |
| OLD | NEW |