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

Side by Side Diff: bin/gen_snapshot.cc

Issue 10388242: Minor restructure some of the builtin library processing code (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/runtime/
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 | « bin/builtin_nolib.cc ('k') | 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 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
170 if (Dart_IsError(result)) { 170 if (Dart_IsError(result)) {
171 return result; 171 return result;
172 } 172 }
173 // We only support canonicalization of "dart:". 173 // We only support canonicalization of "dart:".
174 if (DartUtils::IsDartSchemeURL(url_string)) { 174 if (DartUtils::IsDartSchemeURL(url_string)) {
175 if (tag == kCanonicalizeUrl) { 175 if (tag == kCanonicalizeUrl) {
176 return url; 176 return url;
177 } 177 }
178 ASSERT(tag == kImportTag); 178 ASSERT(tag == kImportTag);
179 // Handle imports of other built-in libraries present in the SDK. 179 // Handle imports of other built-in libraries present in the SDK.
180 Builtin::BuiltinLibraryId id;
180 if (DartUtils::IsDartCryptoLibURL(url_string)) { 181 if (DartUtils::IsDartCryptoLibURL(url_string)) {
181 return Builtin::LoadLibrary(Builtin::kCryptoLibrary); 182 id = Builtin::kCryptoLibrary;
182 } else if (DartUtils::IsDartIOLibURL(url_string)) { 183 } else if (DartUtils::IsDartIOLibURL(url_string)) {
183 return Builtin::LoadLibrary(Builtin::kIOLibrary); 184 id = Builtin::kIOLibrary;
184 } else if (DartUtils::IsDartJsonLibURL(url_string)) { 185 } else if (DartUtils::IsDartJsonLibURL(url_string)) {
185 return Builtin::LoadLibrary(Builtin::kJsonLibrary); 186 id = Builtin::kJsonLibrary;
186 } else if (DartUtils::IsDartUriLibURL(url_string)) { 187 } else if (DartUtils::IsDartUriLibURL(url_string)) {
187 return Builtin::LoadLibrary(Builtin::kUriLibrary); 188 id = Builtin::kUriLibrary;
188 } else if (DartUtils::IsDartUtfLibURL(url_string)) { 189 } else if (DartUtils::IsDartUtfLibURL(url_string)) {
189 return Builtin::LoadLibrary(Builtin::kUtfLibrary); 190 id = Builtin::kUtfLibrary;
191 } else {
192 return Dart_Error("Do not know how to load '%s'", url_string);
190 } 193 }
194 return Builtin::LoadLibrary(id);
191 } 195 }
192 return Dart_Error("unexpected tag encountered %d", tag); 196 return Dart_Error("unexpected tag encountered %d", tag);
193 } 197 }
194 198
195 199
196 static Dart_Handle LoadGenericSnapshotCreationScript( 200 static Dart_Handle LoadGenericSnapshotCreationScript(
197 Builtin::BuiltinLibraryId id) { 201 Builtin::BuiltinLibraryId id) {
198 Dart_Handle source = Builtin::Source(id); 202 Dart_Handle source = Builtin::Source(id);
199 if (Dart_IsError(source)) { 203 if (Dart_IsError(source)) {
200 return source; // source contains the error string. 204 return source; // source contains the error string.
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
320 exit(255); 324 exit(255);
321 } 325 }
322 // Now write the snapshot out to specified file and exit. 326 // Now write the snapshot out to specified file and exit.
323 WriteSnapshotFile(buffer, size); 327 WriteSnapshotFile(buffer, size);
324 Dart_ExitScope(); 328 Dart_ExitScope();
325 329
326 // Shutdown the isolate. 330 // Shutdown the isolate.
327 Dart_ShutdownIsolate(); 331 Dart_ShutdownIsolate();
328 return 0; 332 return 0;
329 } 333 }
OLDNEW
« no previous file with comments | « bin/builtin_nolib.cc ('k') | bin/main.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698