Chromium Code Reviews| Index: runtime/bin/dartutils.cc |
| diff --git a/runtime/bin/dartutils.cc b/runtime/bin/dartutils.cc |
| index 657a4579b609634f10d06a5f4b84111567a276d6..94dbf4b06be6b6c040da2258c6ad600b31dea81f 100644 |
| --- a/runtime/bin/dartutils.cc |
| +++ b/runtime/bin/dartutils.cc |
| @@ -29,6 +29,7 @@ const char* DartUtils::kCoreLibURL = "dart:core"; |
| const char* DartUtils::kIOLibURL = "dart:io"; |
| const char* DartUtils::kIOLibPatchURL = "dart:io-patch"; |
| const char* DartUtils::kUriLibURL = "dart:uri"; |
| +const char* DartUtils::kPlatformLibURL = "dart:platform"; |
| const char* DartUtils::kHttpScheme = "http:"; |
| const char* DartUtils::kIdFieldName = "_id"; |
| @@ -711,17 +712,29 @@ Dart_Handle DartUtils::PrepareForScriptLoading(const char* package_root, |
| // Set up package root if specified. |
| if (package_root != NULL) { |
| - result = NewString(package_root); |
| - if (!Dart_IsError(result)) { |
| - const int kNumArgs = 1; |
| - Dart_Handle dart_args[kNumArgs]; |
| - dart_args[0] = result; |
| - return Dart_Invoke(builtin_lib, |
| + Dart_Handle package_root_string = NewString(package_root); |
|
Anders Johnsen
2013/10/24 17:21:01
Why not reuse result here?
Bill Hesse
2013/10/25 11:06:34
It's just a matter of style. In the rest of the f
|
| + if (Dart_IsError(package_root_string)) { |
| + return package_root_string; |
| + } |
| + const int kNumArgs = 1; |
| + Dart_Handle dart_args[kNumArgs]; |
| + dart_args[0] = package_root_string; |
| + result = Dart_Invoke(builtin_lib, |
| NewString("_setPackageRoot"), |
| kNumArgs, |
| dart_args); |
| + if (Dart_IsError(result)) { |
| + return result; |
| } |
| } |
| + |
| + // Setup the platform library's _platformHook object. |
| + internal_lib = Dart_LookupLibrary(NewString(kPlatformLibURL)); |
| + DART_CHECK_VALID(internal_lib); |
| + Dart_Handle platform = |
| + Dart_Invoke(builtin_lib, NewString("_getPlatform"), 0, NULL); |
| + result = Dart_SetField(internal_lib, NewString("_platformHook"), platform); |
| + DART_CHECK_VALID(result); |
| return result; |
| } |