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

Unified Diff: bin/gen_snapshot.cc

Issue 8537023: Implement automatic loading of dart:core_native_fields library (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/runtime/
Patch Set: '' Created 9 years, 1 month 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 side-by-side diff with in-line comments
Download patch
Index: bin/gen_snapshot.cc
===================================================================
--- bin/gen_snapshot.cc (revision 1545)
+++ bin/gen_snapshot.cc (working copy)
@@ -93,36 +93,26 @@
static void* SnapshotCreateCallback(void* data) {
const char* script_name = reinterpret_cast<const char*>(data);
Dart_Handle result;
+ Dart_Handle library;
Dart_EnterScope();
ASSERT(snapshot_filename != NULL);
- // If a file is specified on the command line, load it up before a snapshot
- // is created.
+ // Load up the script before a snapshot is created.
if (script_name != NULL) {
// Load the specified script.
- Dart_Handle library = LoadSnapshotCreationScript(script_name);
- if (Dart_IsError(library)) {
- const char* err_msg = Dart_GetError(library);
- fprintf(stderr, "Errors encountered while loading script: %s\n", err_msg);
- Dart_ExitScope();
- exit(255);
- }
-
- if (!Dart_IsLibrary(library)) {
- fprintf(stderr,
- "Expected a library when loading script: %s",
- script_name);
- Dart_ExitScope();
- exit(255);
- }
+ library = LoadSnapshotCreationScript(script_name);
} else {
- // Implicitly load builtin library.
- Builtin_LoadLibrary();
- // Setup the native resolver for built in library functions.
- Builtin_SetNativeResolver();
+ // This is a generic dart snapshot which needs builtin library setup.
+ library = Builtin_LoadLibrary();
}
-
+ if (Dart_IsError(library)) {
+ const char* err_msg = Dart_GetError(library);
+ fprintf(stderr, "Errors encountered while loading script: %s\n", err_msg);
+ Dart_ExitScope();
+ exit(255);
+ }
+ ASSERT(Dart_IsLibrary(library));
uint8_t* buffer = NULL;
intptr_t size = 0;
// First create the snapshot.

Powered by Google App Engine
This is Rietveld 408576698