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

Side by Side Diff: bin/main.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/gen_snapshot.cc ('k') | no next file » | 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 #include <stdlib.h> 5 #include <stdlib.h>
6 #include <string.h> 6 #include <string.h>
7 #include <stdio.h> 7 #include <stdio.h>
8 8
9 #include "include/dart_api.h" 9 #include "include/dart_api.h"
10 #include "include/dart_debugger_api.h" 10 #include "include/dart_debugger_api.h"
(...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after
360 const int kNumArgs = 2; 360 const int kNumArgs = 2;
361 Dart_Handle dart_args[kNumArgs]; 361 Dart_Handle dart_args[kNumArgs];
362 dart_args[0] = library_url; 362 dart_args[0] = library_url;
363 dart_args[1] = url; 363 dart_args[1] = url;
364 return Dart_Invoke( 364 return Dart_Invoke(
365 builtin_lib, Dart_NewString("_resolveUri"), kNumArgs, dart_args); 365 builtin_lib, Dart_NewString("_resolveUri"), kNumArgs, dart_args);
366 } 366 }
367 if (is_dart_scheme_url) { 367 if (is_dart_scheme_url) {
368 ASSERT(tag == kImportTag); 368 ASSERT(tag == kImportTag);
369 // Handle imports of other built-in libraries present in the SDK. 369 // Handle imports of other built-in libraries present in the SDK.
370 Builtin::BuiltinLibraryId id;
370 if (DartUtils::IsDartCryptoLibURL(url_string)) { 371 if (DartUtils::IsDartCryptoLibURL(url_string)) {
371 return Builtin::LoadLibrary(Builtin::kCryptoLibrary); 372 id = Builtin::kCryptoLibrary;
372 } else if (DartUtils::IsDartIOLibURL(url_string)) { 373 } else if (DartUtils::IsDartIOLibURL(url_string)) {
373 return Builtin::LoadLibrary(Builtin::kIOLibrary); 374 id = Builtin::kIOLibrary;
374 } else if (DartUtils::IsDartJsonLibURL(url_string)) { 375 } else if (DartUtils::IsDartJsonLibURL(url_string)) {
375 return Builtin::LoadLibrary(Builtin::kJsonLibrary); 376 id = Builtin::kJsonLibrary;
376 } else if (DartUtils::IsDartUriLibURL(url_string)) { 377 } else if (DartUtils::IsDartUriLibURL(url_string)) {
377 return Builtin::LoadLibrary(Builtin::kUriLibrary); 378 id = Builtin::kUriLibrary;
378 } else if (DartUtils::IsDartUtfLibURL(url_string)) { 379 } else if (DartUtils::IsDartUtfLibURL(url_string)) {
379 return Builtin::LoadLibrary(Builtin::kUtfLibrary); 380 id = Builtin::kUtfLibrary;
380 } else { 381 } else {
381 return Dart_Error("Do not know how to load '%s'", url_string); 382 return Dart_Error("Do not know how to load '%s'", url_string);
382 } 383 }
384 return Builtin::LoadLibrary(id);
383 } else { 385 } else {
384 // Get the file path out of the url. 386 // Get the file path out of the url.
385 Dart_Handle builtin_lib = Builtin::LoadLibrary(Builtin::kBuiltinLibrary); 387 Dart_Handle builtin_lib = Builtin::LoadLibrary(Builtin::kBuiltinLibrary);
386 Dart_Handle file_path = FilePathFromUri(url, builtin_lib); 388 Dart_Handle file_path = FilePathFromUri(url, builtin_lib);
387 if (Dart_IsError(file_path)) { 389 if (Dart_IsError(file_path)) {
388 return file_path; 390 return file_path;
389 } 391 }
390 Dart_StringToCString(file_path, &url_string); 392 Dart_StringToCString(file_path, &url_string);
391 } 393 }
392 if (is_dart_extension_url) { 394 if (is_dart_extension_url) {
(...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after
758 DumpPprofSymbolInfo(); 760 DumpPprofSymbolInfo();
759 // Shutdown the isolate. 761 // Shutdown the isolate.
760 Dart_ShutdownIsolate(); 762 Dart_ShutdownIsolate();
761 // Terminate process exit-code handler. 763 // Terminate process exit-code handler.
762 Process::TerminateExitCodeHandler(); 764 Process::TerminateExitCodeHandler();
763 765
764 free(const_cast<char*>(original_working_directory)); 766 free(const_cast<char*>(original_working_directory));
765 767
766 return 0; 768 return 0;
767 } 769 }
OLDNEW
« no previous file with comments | « bin/gen_snapshot.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698