| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 1108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1119 return; | 1119 return; |
| 1120 } | 1120 } |
| 1121 | 1121 |
| 1122 Isolate* isolate = args.GetIsolate(); | 1122 Isolate* isolate = args.GetIsolate(); |
| 1123 uint8_t* data = reinterpret_cast<uint8_t*>( | 1123 uint8_t* data = reinterpret_cast<uint8_t*>( |
| 1124 ReadChars(args.GetIsolate(), *filename, &length)); | 1124 ReadChars(args.GetIsolate(), *filename, &length)); |
| 1125 if (data == NULL) { | 1125 if (data == NULL) { |
| 1126 Throw(args.GetIsolate(), "Error reading file"); | 1126 Throw(args.GetIsolate(), "Error reading file"); |
| 1127 return; | 1127 return; |
| 1128 } | 1128 } |
| 1129 Handle<v8::ArrayBuffer> buffer = ArrayBuffer::New(data, length); | 1129 Handle<v8::ArrayBuffer> buffer = ArrayBuffer::New(isolate, data, length); |
| 1130 v8::Persistent<v8::ArrayBuffer> weak_handle(isolate, buffer); | 1130 v8::Persistent<v8::ArrayBuffer> weak_handle(isolate, buffer); |
| 1131 weak_handle.MakeWeak(data, ReadBufferWeakCallback); | 1131 weak_handle.MakeWeak(data, ReadBufferWeakCallback); |
| 1132 weak_handle.MarkIndependent(); | 1132 weak_handle.MarkIndependent(); |
| 1133 isolate->AdjustAmountOfExternalAllocatedMemory(length); | 1133 isolate->AdjustAmountOfExternalAllocatedMemory(length); |
| 1134 | 1134 |
| 1135 args.GetReturnValue().Set(buffer); | 1135 args.GetReturnValue().Set(buffer); |
| 1136 } | 1136 } |
| 1137 | 1137 |
| 1138 | 1138 |
| 1139 #ifndef V8_SHARED | 1139 #ifndef V8_SHARED |
| (...skipping 615 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1755 } | 1755 } |
| 1756 | 1756 |
| 1757 } // namespace v8 | 1757 } // namespace v8 |
| 1758 | 1758 |
| 1759 | 1759 |
| 1760 #ifndef GOOGLE3 | 1760 #ifndef GOOGLE3 |
| 1761 int main(int argc, char* argv[]) { | 1761 int main(int argc, char* argv[]) { |
| 1762 return v8::Shell::Main(argc, argv); | 1762 return v8::Shell::Main(argc, argv); |
| 1763 } | 1763 } |
| 1764 #endif | 1764 #endif |
| OLD | NEW |