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

Side by Side Diff: runtime/bin/gen_snapshot.cc

Issue 10574037: Add dart:web to VM. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 6 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
« no previous file with comments | « runtime/bin/dartutils.cc ('k') | runtime/bin/main.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 <stdlib.h> 8 #include <stdlib.h>
9 #include <string.h> 9 #include <string.h>
10 #include <stdio.h> 10 #include <stdio.h>
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 if (DartUtils::IsDartCryptoLibURL(url_string)) { 181 if (DartUtils::IsDartCryptoLibURL(url_string)) {
182 id = Builtin::kCryptoLibrary; 182 id = Builtin::kCryptoLibrary;
183 } else if (DartUtils::IsDartIOLibURL(url_string)) { 183 } else if (DartUtils::IsDartIOLibURL(url_string)) {
184 id = Builtin::kIOLibrary; 184 id = Builtin::kIOLibrary;
185 } else if (DartUtils::IsDartJsonLibURL(url_string)) { 185 } else if (DartUtils::IsDartJsonLibURL(url_string)) {
186 id = Builtin::kJsonLibrary; 186 id = Builtin::kJsonLibrary;
187 } else if (DartUtils::IsDartUriLibURL(url_string)) { 187 } else if (DartUtils::IsDartUriLibURL(url_string)) {
188 id = Builtin::kUriLibrary; 188 id = Builtin::kUriLibrary;
189 } else if (DartUtils::IsDartUtfLibURL(url_string)) { 189 } else if (DartUtils::IsDartUtfLibURL(url_string)) {
190 id = Builtin::kUtfLibrary; 190 id = Builtin::kUtfLibrary;
191 } else if (DartUtils::IsDartWebLibURL(url_string)) {
192 id = Builtin::kWebLibrary;
191 } else { 193 } else {
siva 2012/06/20 02:07:39 As more and more of these libraries get added to t
192 return Dart_Error("Do not know how to load '%s'", url_string); 194 return Dart_Error("Do not know how to load '%s'", url_string);
193 } 195 }
194 return Builtin::LoadLibrary(id); 196 return Builtin::LoadLibrary(id);
195 } 197 }
196 return Dart_Error("unexpected tag encountered %d", tag); 198 return Dart_Error("unexpected tag encountered %d", tag);
197 } 199 }
198 200
199 201
200 static Dart_Handle LoadGenericSnapshotCreationScript( 202 static Dart_Handle LoadGenericSnapshotCreationScript(
201 Builtin::BuiltinLibraryId id) { 203 Builtin::BuiltinLibraryId id) {
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
303 library = LoadGenericSnapshotCreationScript(Builtin::kCryptoLibrary); 305 library = LoadGenericSnapshotCreationScript(Builtin::kCryptoLibrary);
304 VerifyLoaded(library); 306 VerifyLoaded(library);
305 library = LoadGenericSnapshotCreationScript(Builtin::kIOLibrary); 307 library = LoadGenericSnapshotCreationScript(Builtin::kIOLibrary);
306 VerifyLoaded(library); 308 VerifyLoaded(library);
307 library = LoadGenericSnapshotCreationScript(Builtin::kJsonLibrary); 309 library = LoadGenericSnapshotCreationScript(Builtin::kJsonLibrary);
308 VerifyLoaded(library); 310 VerifyLoaded(library);
309 library = LoadGenericSnapshotCreationScript(Builtin::kUriLibrary); 311 library = LoadGenericSnapshotCreationScript(Builtin::kUriLibrary);
310 VerifyLoaded(library); 312 VerifyLoaded(library);
311 library = LoadGenericSnapshotCreationScript(Builtin::kUtfLibrary); 313 library = LoadGenericSnapshotCreationScript(Builtin::kUtfLibrary);
312 VerifyLoaded(library); 314 VerifyLoaded(library);
315 library = LoadGenericSnapshotCreationScript(Builtin::kWebLibrary);
316 VerifyLoaded(library);
313 } 317 }
314 318
315 uint8_t* buffer = NULL; 319 uint8_t* buffer = NULL;
316 intptr_t size = 0; 320 intptr_t size = 0;
317 // First create the snapshot. 321 // First create the snapshot.
318 result = Dart_CreateSnapshot(&buffer, &size); 322 result = Dart_CreateSnapshot(&buffer, &size);
319 if (Dart_IsError(result)) { 323 if (Dart_IsError(result)) {
320 const char* err_msg = Dart_GetError(result); 324 const char* err_msg = Dart_GetError(result);
321 fprintf(stderr, "Error while creating snapshot: %s\n", err_msg); 325 fprintf(stderr, "Error while creating snapshot: %s\n", err_msg);
322 Dart_ExitScope(); 326 Dart_ExitScope();
323 Dart_ShutdownIsolate(); 327 Dart_ShutdownIsolate();
324 exit(255); 328 exit(255);
325 } 329 }
326 // Now write the snapshot out to specified file and exit. 330 // Now write the snapshot out to specified file and exit.
327 WriteSnapshotFile(buffer, size); 331 WriteSnapshotFile(buffer, size);
328 Dart_ExitScope(); 332 Dart_ExitScope();
329 333
330 // Shutdown the isolate. 334 // Shutdown the isolate.
331 Dart_ShutdownIsolate(); 335 Dart_ShutdownIsolate();
332 return 0; 336 return 0;
333 } 337 }
OLDNEW
« no previous file with comments | « runtime/bin/dartutils.cc ('k') | runtime/bin/main.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698