Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(722)

Side by Side Diff: Source/bindings/v8/SerializedScriptValue.cpp

Issue 23876015: Pass isolate to v8::Local<>::New() factory function (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Use isolateForFrame() Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 924 matching lines...) Expand 10 before | Expand all | Expand 10 after
935 935
936 protected: 936 protected:
937 virtual StateBase* objectDone(unsigned numProperties, Serializer& serial izer) 937 virtual StateBase* objectDone(unsigned numProperties, Serializer& serial izer)
938 { 938 {
939 return serializer.writeObject(numProperties, this); 939 return serializer.writeObject(numProperties, this);
940 } 940 }
941 }; 941 };
942 942
943 class DenseArrayState : public AbstractObjectState { 943 class DenseArrayState : public AbstractObjectState {
944 public: 944 public:
945 DenseArrayState(v8::Handle<v8::Array> array, v8::Handle<v8::Array> prope rtyNames, StateBase* next) 945 DenseArrayState(v8::Handle<v8::Array> array, v8::Handle<v8::Array> prope rtyNames, StateBase* next, v8::Isolate* isolate)
946 : AbstractObjectState(array, next) 946 : AbstractObjectState(array, next)
947 , m_arrayIndex(0) 947 , m_arrayIndex(0)
948 , m_arrayLength(array->Length()) 948 , m_arrayLength(array->Length())
949 { 949 {
950 m_propertyNames = v8::Local<v8::Array>::New(propertyNames); 950 m_propertyNames = v8::Local<v8::Array>::New(isolate, propertyNames);
951 } 951 }
952 952
953 virtual StateBase* advance(Serializer& serializer) 953 virtual StateBase* advance(Serializer& serializer)
954 { 954 {
955 while (m_arrayIndex < m_arrayLength) { 955 while (m_arrayIndex < m_arrayLength) {
956 v8::Handle<v8::Value> value = composite().As<v8::Array>()->Get(m _arrayIndex); 956 v8::Handle<v8::Value> value = composite().As<v8::Array>()->Get(m _arrayIndex);
957 m_arrayIndex++; 957 m_arrayIndex++;
958 if (StateBase* newState = serializer.checkException(this)) 958 if (StateBase* newState = serializer.checkException(this))
959 return newState; 959 return newState;
960 if (StateBase* newState = serializer.doSerialize(value, this)) 960 if (StateBase* newState = serializer.doSerialize(value, this))
961 return newState; 961 return newState;
962 } 962 }
963 return serializeProperties(true, serializer); 963 return serializeProperties(true, serializer);
964 } 964 }
965 965
966 protected: 966 protected:
967 virtual StateBase* objectDone(unsigned numProperties, Serializer& serial izer) 967 virtual StateBase* objectDone(unsigned numProperties, Serializer& serial izer)
968 { 968 {
969 return serializer.writeDenseArray(numProperties, m_arrayLength, this ); 969 return serializer.writeDenseArray(numProperties, m_arrayLength, this );
970 } 970 }
971 971
972 private: 972 private:
973 uint32_t m_arrayIndex; 973 uint32_t m_arrayIndex;
974 uint32_t m_arrayLength; 974 uint32_t m_arrayLength;
975 }; 975 };
976 976
977 class SparseArrayState : public AbstractObjectState { 977 class SparseArrayState : public AbstractObjectState {
978 public: 978 public:
979 SparseArrayState(v8::Handle<v8::Array> array, v8::Handle<v8::Array> prop ertyNames, StateBase* next) 979 SparseArrayState(v8::Handle<v8::Array> array, v8::Handle<v8::Array> prop ertyNames, StateBase* next, v8::Isolate* isolate)
980 : AbstractObjectState(array, next) 980 : AbstractObjectState(array, next)
981 { 981 {
982 m_propertyNames = v8::Local<v8::Array>::New(propertyNames); 982 m_propertyNames = v8::Local<v8::Array>::New(isolate, propertyNames);
983 } 983 }
984 984
985 virtual StateBase* advance(Serializer& serializer) 985 virtual StateBase* advance(Serializer& serializer)
986 { 986 {
987 return serializeProperties(false, serializer); 987 return serializeProperties(false, serializer);
988 } 988 }
989 989
990 protected: 990 protected:
991 virtual StateBase* objectDone(unsigned numProperties, Serializer& serial izer) 991 virtual StateBase* objectDone(unsigned numProperties, Serializer& serial izer)
992 { 992 {
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
1192 1192
1193 StateBase* startArrayState(v8::Handle<v8::Array> array, StateBase* next) 1193 StateBase* startArrayState(v8::Handle<v8::Array> array, StateBase* next)
1194 { 1194 {
1195 v8::Handle<v8::Array> propertyNames = array->GetPropertyNames(); 1195 v8::Handle<v8::Array> propertyNames = array->GetPropertyNames();
1196 if (StateBase* newState = checkException(next)) 1196 if (StateBase* newState = checkException(next))
1197 return newState; 1197 return newState;
1198 uint32_t length = array->Length(); 1198 uint32_t length = array->Length();
1199 1199
1200 if (shouldSerializeDensely(length, propertyNames->Length())) { 1200 if (shouldSerializeDensely(length, propertyNames->Length())) {
1201 m_writer.writeGenerateFreshDenseArray(length); 1201 m_writer.writeGenerateFreshDenseArray(length);
1202 return push(new DenseArrayState(array, propertyNames, next)); 1202 return push(new DenseArrayState(array, propertyNames, next, m_isolat e));
1203 } 1203 }
1204 1204
1205 m_writer.writeGenerateFreshSparseArray(length); 1205 m_writer.writeGenerateFreshSparseArray(length);
1206 return push(new SparseArrayState(array, propertyNames, next)); 1206 return push(new SparseArrayState(array, propertyNames, next, m_isolate)) ;
1207 } 1207 }
1208 1208
1209 StateBase* startObjectState(v8::Handle<v8::Object> object, StateBase* next) 1209 StateBase* startObjectState(v8::Handle<v8::Object> object, StateBase* next)
1210 { 1210 {
1211 m_writer.writeGenerateFreshObject(); 1211 m_writer.writeGenerateFreshObject();
1212 // FIXME: check not a wrapper 1212 // FIXME: check not a wrapper
1213 return push(new ObjectState(object, next)); 1213 return push(new ObjectState(object, next));
1214 } 1214 }
1215 1215
1216 // Marks object as having been visited by the serializer and assigns it a un ique object reference ID. 1216 // Marks object as having been visited by the serializer and assigns it a un ique object reference ID.
(...skipping 1317 matching lines...) Expand 10 before | Expand all | Expand 10 after
2534 v8::V8::AdjustAmountOfExternalAllocatedMemory(-m_externallyAllocatedMemo ry); 2534 v8::V8::AdjustAmountOfExternalAllocatedMemory(-m_externallyAllocatedMemo ry);
2535 } 2535 }
2536 } 2536 }
2537 2537
2538 uint32_t SerializedScriptValue::wireFormatVersion() 2538 uint32_t SerializedScriptValue::wireFormatVersion()
2539 { 2539 {
2540 return WebCore::wireFormatVersion; 2540 return WebCore::wireFormatVersion;
2541 } 2541 }
2542 2542
2543 } // namespace WebCore 2543 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698