| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 | 5 |
| 6 // Defined when linking against shared lib on Windows. | 6 // Defined when linking against shared lib on Windows. |
| 7 #if defined(USING_V8_SHARED) && !defined(V8_SHARED) | 7 #if defined(USING_V8_SHARED) && !defined(V8_SHARED) |
| 8 #define V8_SHARED | 8 #define V8_SHARED |
| 9 #endif | 9 #endif |
| 10 | 10 |
| (...skipping 2006 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2017 seen_objects->Add(array); | 2017 seen_objects->Add(array); |
| 2018 out_data->WriteTag(kSerializationTagArray); | 2018 out_data->WriteTag(kSerializationTagArray); |
| 2019 uint32_t length = array->Length(); | 2019 uint32_t length = array->Length(); |
| 2020 out_data->Write(length); | 2020 out_data->Write(length); |
| 2021 for (uint32_t i = 0; i < length; ++i) { | 2021 for (uint32_t i = 0; i < length; ++i) { |
| 2022 Local<Value> element_value; | 2022 Local<Value> element_value; |
| 2023 if (array->Get(context, i).ToLocal(&element_value)) { | 2023 if (array->Get(context, i).ToLocal(&element_value)) { |
| 2024 if (!SerializeValue(isolate, element_value, to_transfer, seen_objects, | 2024 if (!SerializeValue(isolate, element_value, to_transfer, seen_objects, |
| 2025 out_data)) | 2025 out_data)) |
| 2026 return false; | 2026 return false; |
| 2027 } else { |
| 2028 Throw(isolate, "Failed to serialize array element."); |
| 2029 return false; |
| 2027 } | 2030 } |
| 2028 } | 2031 } |
| 2029 } else if (value->IsArrayBuffer()) { | 2032 } else if (value->IsArrayBuffer()) { |
| 2030 Handle<ArrayBuffer> array_buffer = Handle<ArrayBuffer>::Cast(value); | 2033 Handle<ArrayBuffer> array_buffer = Handle<ArrayBuffer>::Cast(value); |
| 2031 if (FindInObjectList(array_buffer, *seen_objects)) { | 2034 if (FindInObjectList(array_buffer, *seen_objects)) { |
| 2032 Throw(isolate, "Duplicated array buffers not supported"); | 2035 Throw(isolate, "Duplicated array buffers not supported"); |
| 2033 return false; | 2036 return false; |
| 2034 } | 2037 } |
| 2035 seen_objects->Add(array_buffer); | 2038 seen_objects->Add(array_buffer); |
| 2036 if (FindInObjectList(array_buffer, to_transfer)) { | 2039 if (FindInObjectList(array_buffer, to_transfer)) { |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2091 for (uint32_t i = 0; i < length; ++i) { | 2094 for (uint32_t i = 0; i < length; ++i) { |
| 2092 Handle<Value> name; | 2095 Handle<Value> name; |
| 2093 Handle<Value> property_value; | 2096 Handle<Value> property_value; |
| 2094 if (property_names->Get(context, i).ToLocal(&name) && | 2097 if (property_names->Get(context, i).ToLocal(&name) && |
| 2095 object->Get(context, name).ToLocal(&property_value)) { | 2098 object->Get(context, name).ToLocal(&property_value)) { |
| 2096 if (!SerializeValue(isolate, name, to_transfer, seen_objects, out_data)) | 2099 if (!SerializeValue(isolate, name, to_transfer, seen_objects, out_data)) |
| 2097 return false; | 2100 return false; |
| 2098 if (!SerializeValue(isolate, property_value, to_transfer, seen_objects, | 2101 if (!SerializeValue(isolate, property_value, to_transfer, seen_objects, |
| 2099 out_data)) | 2102 out_data)) |
| 2100 return false; | 2103 return false; |
| 2104 } else { |
| 2105 Throw(isolate, "Failed to serialize property."); |
| 2106 return false; |
| 2101 } | 2107 } |
| 2102 } | 2108 } |
| 2103 } else { | 2109 } else { |
| 2104 Throw(isolate, "Don't know how to serialize object"); | 2110 Throw(isolate, "Don't know how to serialize object"); |
| 2105 return false; | 2111 return false; |
| 2106 } | 2112 } |
| 2107 | 2113 |
| 2108 return true; | 2114 return true; |
| 2109 } | 2115 } |
| 2110 | 2116 |
| (...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2430 } | 2436 } |
| 2431 | 2437 |
| 2432 } // namespace v8 | 2438 } // namespace v8 |
| 2433 | 2439 |
| 2434 | 2440 |
| 2435 #ifndef GOOGLE3 | 2441 #ifndef GOOGLE3 |
| 2436 int main(int argc, char* argv[]) { | 2442 int main(int argc, char* argv[]) { |
| 2437 return v8::Shell::Main(argc, argv); | 2443 return v8::Shell::Main(argc, argv); |
| 2438 } | 2444 } |
| 2439 #endif | 2445 #endif |
| OLD | NEW |