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

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

Issue 9694045: Change lookup path for Dart native extensions shared libraries. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Add comments, remove printf statement. 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 #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 233 matching lines...) Expand 10 before | Expand all | Expand 10 after
244 const char* url_string = NULL; 244 const char* url_string = NULL;
245 Dart_Handle result = Dart_StringToCString(url, &url_string); 245 Dart_Handle result = Dart_StringToCString(url, &url_string);
246 if (Dart_IsError(result)) { 246 if (Dart_IsError(result)) {
247 return result; 247 return result;
248 } 248 }
249 bool is_dart_scheme_url = DartUtils::IsDartSchemeURL(url_string); 249 bool is_dart_scheme_url = DartUtils::IsDartSchemeURL(url_string);
250 bool is_dart_extension_url = DartUtils::IsDartExtensionSchemeURL(url_string); 250 bool is_dart_extension_url = DartUtils::IsDartExtensionSchemeURL(url_string);
251 if (tag == kCanonicalizeUrl) { 251 if (tag == kCanonicalizeUrl) {
252 // If this is a Dart Scheme URL then it is not modified as it will be 252 // If this is a Dart Scheme URL then it is not modified as it will be
253 // handled by the VM internally. 253 // handled by the VM internally.
254 if (is_dart_scheme_url || is_dart_extension_url) { 254 if (is_dart_scheme_url) {
255 return url; 255 return url;
256 } 256 }
257 // Resolve the url within the context of the library's URL. 257 // Resolve the url within the context of the library's URL.
258 Dart_Handle builtin_lib = Builtin::LoadLibrary(Builtin::kBuiltinLibrary); 258 Dart_Handle builtin_lib = Builtin::LoadLibrary(Builtin::kBuiltinLibrary);
259 Dart_Handle library_url = Dart_LibraryUrl(library); 259 Dart_Handle library_url = Dart_LibraryUrl(library);
260 if (Dart_IsError(library_url)) { 260 if (Dart_IsError(library_url)) {
261 return library_url; 261 return library_url;
262 } 262 }
263 Dart_Handle dart_args[2]; 263 Dart_Handle dart_args[2];
264 dart_args[0] = library_url; 264 dart_args[0] = library_url;
265 dart_args[1] = url; 265 dart_args[1] = url;
266 return Dart_InvokeStatic(builtin_lib, 266 if (is_dart_extension_url) {
267 Dart_NewString(""), Dart_NewString("resolveUri"), 267 return Dart_InvokeStatic(builtin_lib,
268 2, dart_args); 268 Dart_NewString(""),
269 Dart_NewString("resolveExtensionUri"),
270 2, dart_args);
271 } else {
272 return Dart_InvokeStatic(builtin_lib,
273 Dart_NewString(""), Dart_NewString("resolveUri"),
274 2, dart_args);
275 }
269 } 276 }
270 if (is_dart_scheme_url) { 277 if (is_dart_scheme_url) {
271 ASSERT(tag == kImportTag); 278 ASSERT(tag == kImportTag);
272 // Handle imports of other built-in libraries present in the SDK. 279 // Handle imports of other built-in libraries present in the SDK.
273 if (DartUtils::IsDartIOLibURL(url_string)) { 280 if (DartUtils::IsDartIOLibURL(url_string)) {
274 return Builtin::LoadLibrary(Builtin::kIOLibrary); 281 return Builtin::LoadLibrary(Builtin::kIOLibrary);
275 } else if (DartUtils::IsDartJsonLibURL(url_string)) { 282 } else if (DartUtils::IsDartJsonLibURL(url_string)) {
276 return Builtin::LoadLibrary(Builtin::kJsonLibrary); 283 return Builtin::LoadLibrary(Builtin::kJsonLibrary);
277 } else if (DartUtils::IsDartUriLibURL(url_string)) { 284 } else if (DartUtils::IsDartUriLibURL(url_string)) {
278 return Builtin::LoadLibrary(Builtin::kUriLibrary); 285 return Builtin::LoadLibrary(Builtin::kUriLibrary);
(...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after
614 EventHandler::Terminate(); 621 EventHandler::Terminate();
615 // Terminate process exit-code handler. 622 // Terminate process exit-code handler.
616 Process::TerminateExitCodeHandler(); 623 Process::TerminateExitCodeHandler();
617 624
618 free(const_cast<char*>(original_script_name)); 625 free(const_cast<char*>(original_script_name));
619 free(const_cast<char*>(original_working_directory)); 626 free(const_cast<char*>(original_working_directory));
620 free(const_cast<char*>(original_script_url)); 627 free(const_cast<char*>(original_script_url));
621 628
622 return 0; 629 return 0;
623 } 630 }
OLDNEW
« runtime/bin/extensions_linux.cc ('K') | « runtime/bin/extensions_win.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698