| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 // Generate a snapshot file after loading all the scripts specified on the | 5 // Generate a snapshot file after loading all the scripts specified on the |
| 6 // command line. | 6 // command line. |
| 7 | 7 |
| 8 #include <stdio.h> | 8 #include <stdio.h> |
| 9 #include <stdlib.h> | 9 #include <stdlib.h> |
| 10 #include <string.h> | 10 #include <string.h> |
| (...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 207 | 207 |
| 208 | 208 |
| 209 static void WriteSnapshotFile(const char* filename, | 209 static void WriteSnapshotFile(const char* filename, |
| 210 const uint8_t* buffer, | 210 const uint8_t* buffer, |
| 211 const intptr_t size) { | 211 const intptr_t size) { |
| 212 File* file = File::Open(filename, File::kWriteTruncate); | 212 File* file = File::Open(filename, File::kWriteTruncate); |
| 213 ASSERT(file != NULL); | 213 ASSERT(file != NULL); |
| 214 if (!file->WriteFully(buffer, size)) { | 214 if (!file->WriteFully(buffer, size)) { |
| 215 Log::PrintErr("Error: Failed to write snapshot file.\n\n"); | 215 Log::PrintErr("Error: Failed to write snapshot file.\n\n"); |
| 216 } | 216 } |
| 217 delete file; | 217 file->Release(); |
| 218 } | 218 } |
| 219 | 219 |
| 220 | 220 |
| 221 class UriResolverIsolateScope { | 221 class UriResolverIsolateScope { |
| 222 public: | 222 public: |
| 223 UriResolverIsolateScope() { | 223 UriResolverIsolateScope() { |
| 224 ASSERT(isolate != NULL); | 224 ASSERT(isolate != NULL); |
| 225 snapshotted_isolate_ = Dart_CurrentIsolate(); | 225 snapshotted_isolate_ = Dart_CurrentIsolate(); |
| 226 Dart_ExitIsolate(); | 226 Dart_ExitIsolate(); |
| 227 Dart_EnterIsolate(isolate); | 227 Dart_EnterIsolate(isolate); |
| (...skipping 924 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1152 EventHandler::Stop(); | 1152 EventHandler::Stop(); |
| 1153 return 0; | 1153 return 0; |
| 1154 } | 1154 } |
| 1155 | 1155 |
| 1156 } // namespace bin | 1156 } // namespace bin |
| 1157 } // namespace dart | 1157 } // namespace dart |
| 1158 | 1158 |
| 1159 int main(int argc, char** argv) { | 1159 int main(int argc, char** argv) { |
| 1160 return dart::bin::main(argc, argv); | 1160 return dart::bin::main(argc, argv); |
| 1161 } | 1161 } |
| OLD | NEW |