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 787 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
798 , m_next(next) | 798 , m_next(next) |
799 { | 799 { |
800 } | 800 } |
801 | 801 |
802 private: | 802 private: |
803 v8::Handle<v8::Value> m_composite; | 803 v8::Handle<v8::Value> m_composite; |
804 StateBase* m_next; | 804 StateBase* m_next; |
805 }; | 805 }; |
806 | 806 |
807 // Dummy state that is used to signal serialization errors. | 807 // Dummy state that is used to signal serialization errors. |
808 class ErrorState : public StateBase { | 808 class ErrorState FINAL : public StateBase { |
809 public: | 809 public: |
810 ErrorState() | 810 ErrorState() |
811 : StateBase(v8Undefined(), 0) | 811 : StateBase(v8Undefined(), 0) |
812 { | 812 { |
813 } | 813 } |
814 | 814 |
815 virtual StateBase* advance(Serializer&) | 815 virtual StateBase* advance(Serializer&) OVERRIDE |
816 { | 816 { |
817 delete this; | 817 delete this; |
818 return 0; | 818 return 0; |
819 } | 819 } |
820 }; | 820 }; |
821 | 821 |
822 template <typename T> | 822 template <typename T> |
823 class State : public StateBase { | 823 class State : public StateBase { |
824 public: | 824 public: |
825 v8::Handle<T> composite() { return v8::Handle<T>::Cast(StateBase::compos
ite()); } | 825 v8::Handle<T> composite() { return v8::Handle<T>::Cast(StateBase::compos
ite()); } |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
890 | 890 |
891 v8::Local<v8::Array> m_propertyNames; | 891 v8::Local<v8::Array> m_propertyNames; |
892 | 892 |
893 private: | 893 private: |
894 v8::Local<v8::Value> m_propertyName; | 894 v8::Local<v8::Value> m_propertyName; |
895 unsigned m_index; | 895 unsigned m_index; |
896 unsigned m_numSerializedProperties; | 896 unsigned m_numSerializedProperties; |
897 bool m_nameDone; | 897 bool m_nameDone; |
898 }; | 898 }; |
899 | 899 |
900 class ObjectState : public AbstractObjectState { | 900 class ObjectState FINAL : public AbstractObjectState { |
901 public: | 901 public: |
902 ObjectState(v8::Handle<v8::Object> object, StateBase* next) | 902 ObjectState(v8::Handle<v8::Object> object, StateBase* next) |
903 : AbstractObjectState(object, next) | 903 : AbstractObjectState(object, next) |
904 { | 904 { |
905 } | 905 } |
906 | 906 |
907 virtual StateBase* advance(Serializer& serializer) | 907 virtual StateBase* advance(Serializer& serializer) OVERRIDE |
908 { | 908 { |
909 if (m_propertyNames.IsEmpty()) { | 909 if (m_propertyNames.IsEmpty()) { |
910 m_propertyNames = composite()->GetPropertyNames(); | 910 m_propertyNames = composite()->GetPropertyNames(); |
911 if (StateBase* newState = serializer.checkException(this)) | 911 if (StateBase* newState = serializer.checkException(this)) |
912 return newState; | 912 return newState; |
913 if (m_propertyNames.IsEmpty()) | 913 if (m_propertyNames.IsEmpty()) |
914 return serializer.handleError(InputError, "Empty property na
mes cannot be cloned.", nextState()); | 914 return serializer.handleError(InputError, "Empty property na
mes cannot be cloned.", nextState()); |
915 } | 915 } |
916 return serializeProperties(false, serializer); | 916 return serializeProperties(false, serializer); |
917 } | 917 } |
918 | 918 |
919 protected: | 919 protected: |
920 virtual StateBase* objectDone(unsigned numProperties, Serializer& serial
izer) | 920 virtual StateBase* objectDone(unsigned numProperties, Serializer& serial
izer) OVERRIDE |
921 { | 921 { |
922 return serializer.writeObject(numProperties, this); | 922 return serializer.writeObject(numProperties, this); |
923 } | 923 } |
924 }; | 924 }; |
925 | 925 |
926 class DenseArrayState : public AbstractObjectState { | 926 class DenseArrayState FINAL : public AbstractObjectState { |
927 public: | 927 public: |
928 DenseArrayState(v8::Handle<v8::Array> array, v8::Handle<v8::Array> prope
rtyNames, StateBase* next, v8::Isolate* isolate) | 928 DenseArrayState(v8::Handle<v8::Array> array, v8::Handle<v8::Array> prope
rtyNames, StateBase* next, v8::Isolate* isolate) |
929 : AbstractObjectState(array, next) | 929 : AbstractObjectState(array, next) |
930 , m_arrayIndex(0) | 930 , m_arrayIndex(0) |
931 , m_arrayLength(array->Length()) | 931 , m_arrayLength(array->Length()) |
932 { | 932 { |
933 m_propertyNames = v8::Local<v8::Array>::New(isolate, propertyNames); | 933 m_propertyNames = v8::Local<v8::Array>::New(isolate, propertyNames); |
934 } | 934 } |
935 | 935 |
936 virtual StateBase* advance(Serializer& serializer) | 936 virtual StateBase* advance(Serializer& serializer) OVERRIDE |
937 { | 937 { |
938 while (m_arrayIndex < m_arrayLength) { | 938 while (m_arrayIndex < m_arrayLength) { |
939 v8::Handle<v8::Value> value = composite().As<v8::Array>()->Get(m
_arrayIndex); | 939 v8::Handle<v8::Value> value = composite().As<v8::Array>()->Get(m
_arrayIndex); |
940 m_arrayIndex++; | 940 m_arrayIndex++; |
941 if (StateBase* newState = serializer.checkException(this)) | 941 if (StateBase* newState = serializer.checkException(this)) |
942 return newState; | 942 return newState; |
943 if (StateBase* newState = serializer.doSerialize(value, this)) | 943 if (StateBase* newState = serializer.doSerialize(value, this)) |
944 return newState; | 944 return newState; |
945 } | 945 } |
946 return serializeProperties(true, serializer); | 946 return serializeProperties(true, serializer); |
947 } | 947 } |
948 | 948 |
949 protected: | 949 protected: |
950 virtual StateBase* objectDone(unsigned numProperties, Serializer& serial
izer) | 950 virtual StateBase* objectDone(unsigned numProperties, Serializer& serial
izer) OVERRIDE |
951 { | 951 { |
952 return serializer.writeDenseArray(numProperties, m_arrayLength, this
); | 952 return serializer.writeDenseArray(numProperties, m_arrayLength, this
); |
953 } | 953 } |
954 | 954 |
955 private: | 955 private: |
956 uint32_t m_arrayIndex; | 956 uint32_t m_arrayIndex; |
957 uint32_t m_arrayLength; | 957 uint32_t m_arrayLength; |
958 }; | 958 }; |
959 | 959 |
960 class SparseArrayState : public AbstractObjectState { | 960 class SparseArrayState FINAL : public AbstractObjectState { |
961 public: | 961 public: |
962 SparseArrayState(v8::Handle<v8::Array> array, v8::Handle<v8::Array> prop
ertyNames, StateBase* next, v8::Isolate* isolate) | 962 SparseArrayState(v8::Handle<v8::Array> array, v8::Handle<v8::Array> prop
ertyNames, StateBase* next, v8::Isolate* isolate) |
963 : AbstractObjectState(array, next) | 963 : AbstractObjectState(array, next) |
964 { | 964 { |
965 m_propertyNames = v8::Local<v8::Array>::New(isolate, propertyNames); | 965 m_propertyNames = v8::Local<v8::Array>::New(isolate, propertyNames); |
966 } | 966 } |
967 | 967 |
968 virtual StateBase* advance(Serializer& serializer) | 968 virtual StateBase* advance(Serializer& serializer) OVERRIDE |
969 { | 969 { |
970 return serializeProperties(false, serializer); | 970 return serializeProperties(false, serializer); |
971 } | 971 } |
972 | 972 |
973 protected: | 973 protected: |
974 virtual StateBase* objectDone(unsigned numProperties, Serializer& serial
izer) | 974 virtual StateBase* objectDone(unsigned numProperties, Serializer& serial
izer) OVERRIDE |
975 { | 975 { |
976 return serializer.writeSparseArray(numProperties, composite().As<v8:
:Array>()->Length(), this); | 976 return serializer.writeSparseArray(numProperties, composite().As<v8:
:Array>()->Length(), this); |
977 } | 977 } |
978 }; | 978 }; |
979 | 979 |
980 StateBase* push(StateBase* state) | 980 StateBase* push(StateBase* state) |
981 { | 981 { |
982 ASSERT(state); | 982 ASSERT(state); |
983 ++m_depth; | 983 ++m_depth; |
984 return checkComposite(state) ? state : handleError(InputError, "Value be
ing cloned is either cyclic or too deeply nested.", state); | 984 return checkComposite(state) ? state : handleError(InputError, "Value be
ing cloned is either cyclic or too deeply nested.", state); |
(...skipping 998 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1983 const unsigned m_length; | 1983 const unsigned m_length; |
1984 unsigned m_position; | 1984 unsigned m_position; |
1985 uint32_t m_version; | 1985 uint32_t m_version; |
1986 v8::Isolate* m_isolate; | 1986 v8::Isolate* m_isolate; |
1987 const BlobDataHandleMap& m_blobDataHandles; | 1987 const BlobDataHandleMap& m_blobDataHandles; |
1988 }; | 1988 }; |
1989 | 1989 |
1990 | 1990 |
1991 typedef Vector<WTF::ArrayBufferContents, 1> ArrayBufferContentsArray; | 1991 typedef Vector<WTF::ArrayBufferContents, 1> ArrayBufferContentsArray; |
1992 | 1992 |
1993 class Deserializer : public CompositeCreator { | 1993 class Deserializer FINAL : public CompositeCreator { |
1994 public: | 1994 public: |
1995 Deserializer(Reader& reader, MessagePortArray* messagePorts, ArrayBufferCont
entsArray* arrayBufferContents) | 1995 Deserializer(Reader& reader, MessagePortArray* messagePorts, ArrayBufferCont
entsArray* arrayBufferContents) |
1996 : m_reader(reader) | 1996 : m_reader(reader) |
1997 , m_transferredMessagePorts(messagePorts) | 1997 , m_transferredMessagePorts(messagePorts) |
1998 , m_arrayBufferContents(arrayBufferContents) | 1998 , m_arrayBufferContents(arrayBufferContents) |
1999 , m_arrayBuffers(arrayBufferContents ? arrayBufferContents->size() : 0) | 1999 , m_arrayBuffers(arrayBufferContents ? arrayBufferContents->size() : 0) |
2000 , m_version(0) | 2000 , m_version(0) |
2001 { | 2001 { |
2002 } | 2002 } |
2003 | 2003 |
2004 v8::Handle<v8::Value> deserialize() | 2004 v8::Handle<v8::Value> deserialize() |
2005 { | 2005 { |
2006 if (!m_reader.readVersion(m_version) || m_version > SerializedScriptValu
e::wireFormatVersion) | 2006 if (!m_reader.readVersion(m_version) || m_version > SerializedScriptValu
e::wireFormatVersion) |
2007 return v8::Null(m_reader.getIsolate()); | 2007 return v8::Null(m_reader.getIsolate()); |
2008 m_reader.setVersion(m_version); | 2008 m_reader.setVersion(m_version); |
2009 v8::EscapableHandleScope scope(m_reader.getIsolate()); | 2009 v8::EscapableHandleScope scope(m_reader.getIsolate()); |
2010 while (!m_reader.isEof()) { | 2010 while (!m_reader.isEof()) { |
2011 if (!doDeserialize()) | 2011 if (!doDeserialize()) |
2012 return v8::Null(m_reader.getIsolate()); | 2012 return v8::Null(m_reader.getIsolate()); |
2013 } | 2013 } |
2014 if (stackDepth() != 1 || m_openCompositeReferenceStack.size()) | 2014 if (stackDepth() != 1 || m_openCompositeReferenceStack.size()) |
2015 return v8::Null(m_reader.getIsolate()); | 2015 return v8::Null(m_reader.getIsolate()); |
2016 v8::Handle<v8::Value> result = scope.Escape(element(0)); | 2016 v8::Handle<v8::Value> result = scope.Escape(element(0)); |
2017 return result; | 2017 return result; |
2018 } | 2018 } |
2019 | 2019 |
2020 virtual bool newSparseArray(uint32_t) | 2020 virtual bool newSparseArray(uint32_t) OVERRIDE |
2021 { | 2021 { |
2022 v8::Local<v8::Array> array = v8::Array::New(m_reader.isolate(), 0); | 2022 v8::Local<v8::Array> array = v8::Array::New(m_reader.isolate(), 0); |
2023 openComposite(array); | 2023 openComposite(array); |
2024 return true; | 2024 return true; |
2025 } | 2025 } |
2026 | 2026 |
2027 virtual bool newDenseArray(uint32_t length) | 2027 virtual bool newDenseArray(uint32_t length) OVERRIDE |
2028 { | 2028 { |
2029 v8::Local<v8::Array> array = v8::Array::New(m_reader.isolate(), length); | 2029 v8::Local<v8::Array> array = v8::Array::New(m_reader.isolate(), length); |
2030 openComposite(array); | 2030 openComposite(array); |
2031 return true; | 2031 return true; |
2032 } | 2032 } |
2033 | 2033 |
2034 virtual bool consumeTopOfStack(v8::Handle<v8::Value>* object) | 2034 virtual bool consumeTopOfStack(v8::Handle<v8::Value>* object) OVERRIDE |
2035 { | 2035 { |
2036 if (stackDepth() < 1) | 2036 if (stackDepth() < 1) |
2037 return false; | 2037 return false; |
2038 *object = element(stackDepth() - 1); | 2038 *object = element(stackDepth() - 1); |
2039 pop(1); | 2039 pop(1); |
2040 return true; | 2040 return true; |
2041 } | 2041 } |
2042 | 2042 |
2043 virtual bool newObject() | 2043 virtual bool newObject() OVERRIDE |
2044 { | 2044 { |
2045 v8::Local<v8::Object> object = v8::Object::New(m_reader.isolate()); | 2045 v8::Local<v8::Object> object = v8::Object::New(m_reader.isolate()); |
2046 if (object.IsEmpty()) | 2046 if (object.IsEmpty()) |
2047 return false; | 2047 return false; |
2048 openComposite(object); | 2048 openComposite(object); |
2049 return true; | 2049 return true; |
2050 } | 2050 } |
2051 | 2051 |
2052 virtual bool completeObject(uint32_t numProperties, v8::Handle<v8::Value>* v
alue) | 2052 virtual bool completeObject(uint32_t numProperties, v8::Handle<v8::Value>* v
alue) OVERRIDE |
2053 { | 2053 { |
2054 v8::Local<v8::Object> object; | 2054 v8::Local<v8::Object> object; |
2055 if (m_version > 0) { | 2055 if (m_version > 0) { |
2056 v8::Local<v8::Value> composite; | 2056 v8::Local<v8::Value> composite; |
2057 if (!closeComposite(&composite)) | 2057 if (!closeComposite(&composite)) |
2058 return false; | 2058 return false; |
2059 object = composite.As<v8::Object>(); | 2059 object = composite.As<v8::Object>(); |
2060 } else { | 2060 } else { |
2061 object = v8::Object::New(m_reader.isolate()); | 2061 object = v8::Object::New(m_reader.isolate()); |
2062 } | 2062 } |
2063 if (object.IsEmpty()) | 2063 if (object.IsEmpty()) |
2064 return false; | 2064 return false; |
2065 return initializeObject(object, numProperties, value); | 2065 return initializeObject(object, numProperties, value); |
2066 } | 2066 } |
2067 | 2067 |
2068 virtual bool completeSparseArray(uint32_t numProperties, uint32_t length, v8
::Handle<v8::Value>* value) | 2068 virtual bool completeSparseArray(uint32_t numProperties, uint32_t length, v8
::Handle<v8::Value>* value) OVERRIDE |
2069 { | 2069 { |
2070 v8::Local<v8::Array> array; | 2070 v8::Local<v8::Array> array; |
2071 if (m_version > 0) { | 2071 if (m_version > 0) { |
2072 v8::Local<v8::Value> composite; | 2072 v8::Local<v8::Value> composite; |
2073 if (!closeComposite(&composite)) | 2073 if (!closeComposite(&composite)) |
2074 return false; | 2074 return false; |
2075 array = composite.As<v8::Array>(); | 2075 array = composite.As<v8::Array>(); |
2076 } else { | 2076 } else { |
2077 array = v8::Array::New(m_reader.isolate()); | 2077 array = v8::Array::New(m_reader.isolate()); |
2078 } | 2078 } |
2079 if (array.IsEmpty()) | 2079 if (array.IsEmpty()) |
2080 return false; | 2080 return false; |
2081 return initializeObject(array, numProperties, value); | 2081 return initializeObject(array, numProperties, value); |
2082 } | 2082 } |
2083 | 2083 |
2084 virtual bool completeDenseArray(uint32_t numProperties, uint32_t length, v8:
:Handle<v8::Value>* value) | 2084 virtual bool completeDenseArray(uint32_t numProperties, uint32_t length, v8:
:Handle<v8::Value>* value) OVERRIDE |
2085 { | 2085 { |
2086 v8::Local<v8::Array> array; | 2086 v8::Local<v8::Array> array; |
2087 if (m_version > 0) { | 2087 if (m_version > 0) { |
2088 v8::Local<v8::Value> composite; | 2088 v8::Local<v8::Value> composite; |
2089 if (!closeComposite(&composite)) | 2089 if (!closeComposite(&composite)) |
2090 return false; | 2090 return false; |
2091 array = composite.As<v8::Array>(); | 2091 array = composite.As<v8::Array>(); |
2092 } | 2092 } |
2093 if (array.IsEmpty()) | 2093 if (array.IsEmpty()) |
2094 return false; | 2094 return false; |
2095 if (!initializeObject(array, numProperties, value)) | 2095 if (!initializeObject(array, numProperties, value)) |
2096 return false; | 2096 return false; |
2097 if (length > stackDepth()) | 2097 if (length > stackDepth()) |
2098 return false; | 2098 return false; |
2099 for (unsigned i = 0, stackPos = stackDepth() - length; i < length; i++,
stackPos++) { | 2099 for (unsigned i = 0, stackPos = stackDepth() - length; i < length; i++,
stackPos++) { |
2100 v8::Local<v8::Value> elem = element(stackPos); | 2100 v8::Local<v8::Value> elem = element(stackPos); |
2101 if (!elem->IsUndefined()) | 2101 if (!elem->IsUndefined()) |
2102 array->Set(i, elem); | 2102 array->Set(i, elem); |
2103 } | 2103 } |
2104 pop(length); | 2104 pop(length); |
2105 return true; | 2105 return true; |
2106 } | 2106 } |
2107 | 2107 |
2108 virtual void pushObjectReference(const v8::Handle<v8::Value>& object) | 2108 virtual void pushObjectReference(const v8::Handle<v8::Value>& object) OVERRI
DE |
2109 { | 2109 { |
2110 m_objectPool.append(object); | 2110 m_objectPool.append(object); |
2111 } | 2111 } |
2112 | 2112 |
2113 virtual bool tryGetTransferredMessagePort(uint32_t index, v8::Handle<v8::Val
ue>* object) | 2113 virtual bool tryGetTransferredMessagePort(uint32_t index, v8::Handle<v8::Val
ue>* object) OVERRIDE |
2114 { | 2114 { |
2115 if (!m_transferredMessagePorts) | 2115 if (!m_transferredMessagePorts) |
2116 return false; | 2116 return false; |
2117 if (index >= m_transferredMessagePorts->size()) | 2117 if (index >= m_transferredMessagePorts->size()) |
2118 return false; | 2118 return false; |
2119 *object = toV8(m_transferredMessagePorts->at(index).get(), v8::Handle<v8
::Object>(), m_reader.getIsolate()); | 2119 *object = toV8(m_transferredMessagePorts->at(index).get(), v8::Handle<v8
::Object>(), m_reader.getIsolate()); |
2120 return true; | 2120 return true; |
2121 } | 2121 } |
2122 | 2122 |
2123 virtual bool tryGetTransferredArrayBuffer(uint32_t index, v8::Handle<v8::Val
ue>* object) | 2123 virtual bool tryGetTransferredArrayBuffer(uint32_t index, v8::Handle<v8::Val
ue>* object) OVERRIDE |
2124 { | 2124 { |
2125 if (!m_arrayBufferContents) | 2125 if (!m_arrayBufferContents) |
2126 return false; | 2126 return false; |
2127 if (index >= m_arrayBuffers.size()) | 2127 if (index >= m_arrayBuffers.size()) |
2128 return false; | 2128 return false; |
2129 v8::Handle<v8::Object> result = m_arrayBuffers.at(index); | 2129 v8::Handle<v8::Object> result = m_arrayBuffers.at(index); |
2130 if (result.IsEmpty()) { | 2130 if (result.IsEmpty()) { |
2131 RefPtr<ArrayBuffer> buffer = ArrayBuffer::create(m_arrayBufferConten
ts->at(index)); | 2131 RefPtr<ArrayBuffer> buffer = ArrayBuffer::create(m_arrayBufferConten
ts->at(index)); |
2132 buffer->setDeallocationObserver(V8ArrayBufferDeallocationObserver::i
nstanceTemplate()); | 2132 buffer->setDeallocationObserver(V8ArrayBufferDeallocationObserver::i
nstanceTemplate()); |
2133 m_reader.isolate()->AdjustAmountOfExternalAllocatedMemory(buffer->by
teLength()); | 2133 m_reader.isolate()->AdjustAmountOfExternalAllocatedMemory(buffer->by
teLength()); |
2134 result = toV8Object(buffer.get(), m_reader.getIsolate()); | 2134 result = toV8Object(buffer.get(), m_reader.getIsolate()); |
2135 m_arrayBuffers[index] = result; | 2135 m_arrayBuffers[index] = result; |
2136 } | 2136 } |
2137 *object = result; | 2137 *object = result; |
2138 return true; | 2138 return true; |
2139 } | 2139 } |
2140 | 2140 |
2141 virtual bool tryGetObjectFromObjectReference(uint32_t reference, v8::Handle<
v8::Value>* object) | 2141 virtual bool tryGetObjectFromObjectReference(uint32_t reference, v8::Handle<
v8::Value>* object) OVERRIDE |
2142 { | 2142 { |
2143 if (reference >= m_objectPool.size()) | 2143 if (reference >= m_objectPool.size()) |
2144 return false; | 2144 return false; |
2145 *object = m_objectPool[reference]; | 2145 *object = m_objectPool[reference]; |
2146 return object; | 2146 return object; |
2147 } | 2147 } |
2148 | 2148 |
2149 virtual uint32_t objectReferenceCount() | 2149 virtual uint32_t objectReferenceCount() OVERRIDE |
2150 { | 2150 { |
2151 return m_objectPool.size(); | 2151 return m_objectPool.size(); |
2152 } | 2152 } |
2153 | 2153 |
2154 private: | 2154 private: |
2155 bool initializeObject(v8::Handle<v8::Object> object, uint32_t numProperties,
v8::Handle<v8::Value>* value) | 2155 bool initializeObject(v8::Handle<v8::Object> object, uint32_t numProperties,
v8::Handle<v8::Value>* value) |
2156 { | 2156 { |
2157 unsigned length = 2 * numProperties; | 2157 unsigned length = 2 * numProperties; |
2158 if (length > stackDepth()) | 2158 if (length > stackDepth()) |
2159 return false; | 2159 return false; |
(...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2451 // If the allocated memory was not registered before, then this class is lik
ely | 2451 // If the allocated memory was not registered before, then this class is lik
ely |
2452 // used in a context other then Worker's onmessage environment and the prese
nce of | 2452 // used in a context other then Worker's onmessage environment and the prese
nce of |
2453 // current v8 context is not guaranteed. Avoid calling v8 then. | 2453 // current v8 context is not guaranteed. Avoid calling v8 then. |
2454 if (m_externallyAllocatedMemory) { | 2454 if (m_externallyAllocatedMemory) { |
2455 ASSERT(v8::Isolate::GetCurrent()); | 2455 ASSERT(v8::Isolate::GetCurrent()); |
2456 v8::Isolate::GetCurrent()->AdjustAmountOfExternalAllocatedMemory(-m_exte
rnallyAllocatedMemory); | 2456 v8::Isolate::GetCurrent()->AdjustAmountOfExternalAllocatedMemory(-m_exte
rnallyAllocatedMemory); |
2457 } | 2457 } |
2458 } | 2458 } |
2459 | 2459 |
2460 } // namespace WebCore | 2460 } // namespace WebCore |
OLD | NEW |