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

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

Issue 9657001: Start using Dart_PropagateError in the runtime/bin directory. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 9 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
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 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 Dart_Handle import_map) { 120 Dart_Handle import_map) {
121 if (!Dart_IsLibrary(library)) { 121 if (!Dart_IsLibrary(library)) {
122 return Dart_Error("not a library"); 122 return Dart_Error("not a library");
123 } 123 }
124 if (!Dart_IsString8(url)) { 124 if (!Dart_IsString8(url)) {
125 return Dart_Error("url is not a string"); 125 return Dart_Error("url is not a string");
126 } 126 }
127 const char* url_string = NULL; 127 const char* url_string = NULL;
128 Dart_Handle result = Dart_StringToCString(url, &url_string); 128 Dart_Handle result = Dart_StringToCString(url, &url_string);
129 if (Dart_IsError(result)) { 129 if (Dart_IsError(result)) {
130 return Dart_Error("accessing url characters failed"); 130 return result;
131 } 131 }
132 132
133 // If the URL starts with "dart:" then it is handled specially. 133 // If the URL starts with "dart:" then it is handled specially.
134 bool is_dart_scheme_url = DartUtils::IsDartSchemeURL(url_string); 134 bool is_dart_scheme_url = DartUtils::IsDartSchemeURL(url_string);
135 if (tag == kCanonicalizeUrl) { 135 if (tag == kCanonicalizeUrl) {
136 if (is_dart_scheme_url) { 136 if (is_dart_scheme_url) {
137 return url; 137 return url;
138 } 138 }
139 return DartUtils::CanonicalizeURL(url_mapping, library, url_string); 139 return DartUtils::CanonicalizeURL(url_mapping, library, url_string);
140 } 140 }
(...skipping 27 matching lines...) Expand all
168 Dart_Handle import_map) { 168 Dart_Handle import_map) {
169 if (!Dart_IsLibrary(library)) { 169 if (!Dart_IsLibrary(library)) {
170 return Dart_Error("not a library"); 170 return Dart_Error("not a library");
171 } 171 }
172 if (!Dart_IsString8(url)) { 172 if (!Dart_IsString8(url)) {
173 return Dart_Error("url is not a string"); 173 return Dart_Error("url is not a string");
174 } 174 }
175 const char* url_string = NULL; 175 const char* url_string = NULL;
176 Dart_Handle result = Dart_StringToCString(url, &url_string); 176 Dart_Handle result = Dart_StringToCString(url, &url_string);
177 if (Dart_IsError(result)) { 177 if (Dart_IsError(result)) {
178 return Dart_Error("accessing url characters failed"); 178 return result;
179 } 179 }
180 // We only support canonicalization of "dart:". 180 // We only support canonicalization of "dart:".
181 if (DartUtils::IsDartSchemeURL(url_string)) { 181 if (DartUtils::IsDartSchemeURL(url_string)) {
182 if (tag == kCanonicalizeUrl) { 182 if (tag == kCanonicalizeUrl) {
183 return url; 183 return url;
184 } 184 }
185 // TODO(iposva): Make sure only the known libraries are being added. 185 // TODO(iposva): Make sure only the known libraries are being added.
186 return Dart_True(); 186 return Dart_True();
187 } 187 }
188 return Dart_Error("unexpected tag encountered %d", tag); 188 return Dart_Error("unexpected tag encountered %d", tag);
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
304 exit(255); 304 exit(255);
305 } 305 }
306 // Now write the snapshot out to specified file and exit. 306 // Now write the snapshot out to specified file and exit.
307 WriteSnapshotFile(buffer, size); 307 WriteSnapshotFile(buffer, size);
308 Dart_ExitScope(); 308 Dart_ExitScope();
309 309
310 // Shutdown the isolate. 310 // Shutdown the isolate.
311 Dart_ShutdownIsolate(); 311 Dart_ShutdownIsolate();
312 return 0; 312 return 0;
313 } 313 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698