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 2986 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2997 // unicode characters are encoded as UTF-8 with two code units per UChar. | 2997 // unicode characters are encoded as UTF-8 with two code units per UChar. |
2998 Reader reader(reinterpret_cast<const uint8_t*>(m_data.impl()->characters16()
), 2 * m_data.length(), blobInfo, m_blobDataHandles, ScriptState::current(isolat
e)); | 2998 Reader reader(reinterpret_cast<const uint8_t*>(m_data.impl()->characters16()
), 2 * m_data.length(), blobInfo, m_blobDataHandles, ScriptState::current(isolat
e)); |
2999 Deserializer deserializer(reader, messagePorts, m_arrayBufferContentsArray.g
et()); | 2999 Deserializer deserializer(reader, messagePorts, m_arrayBufferContentsArray.g
et()); |
3000 | 3000 |
3001 // deserialize() can run arbitrary script (e.g., setters), which could resul
t in |this| being destroyed. | 3001 // deserialize() can run arbitrary script (e.g., setters), which could resul
t in |this| being destroyed. |
3002 // Holding a RefPtr ensures we are alive (along with our internal data) thro
ughout the operation. | 3002 // Holding a RefPtr ensures we are alive (along with our internal data) thro
ughout the operation. |
3003 RefPtr<SerializedScriptValue> protect(this); | 3003 RefPtr<SerializedScriptValue> protect(this); |
3004 return deserializer.deserialize(); | 3004 return deserializer.deserialize(); |
3005 } | 3005 } |
3006 | 3006 |
3007 bool SerializedScriptValue::extractTransferables(v8::Local<v8::Value> value, int
argumentIndex, MessagePortArray& ports, ArrayBufferArray& arrayBuffers, Excepti
onState& exceptionState, v8::Isolate* isolate) | 3007 bool SerializedScriptValue::extractTransferables(v8::Isolate* isolate, v8::Local
<v8::Value> value, int argumentIndex, MessagePortArray& ports, ArrayBufferArray&
arrayBuffers, ExceptionState& exceptionState) |
3008 { | 3008 { |
3009 if (isUndefinedOrNull(value)) { | 3009 if (isUndefinedOrNull(value)) { |
3010 ports.resize(0); | 3010 ports.resize(0); |
3011 arrayBuffers.resize(0); | 3011 arrayBuffers.resize(0); |
3012 return true; | 3012 return true; |
3013 } | 3013 } |
3014 | 3014 |
3015 uint32_t length = 0; | 3015 uint32_t length = 0; |
3016 if (value->IsArray()) { | 3016 if (value->IsArray()) { |
3017 v8::Local<v8::Array> array = v8::Local<v8::Array>::Cast(value); | 3017 v8::Local<v8::Array> array = v8::Local<v8::Array>::Cast(value); |
(...skipping 51 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 |