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

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

Issue 1127343004: Reland r45669: (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 5 years, 7 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 | « runtime/bin/dartutils.h ('k') | runtime/bin/gen_snapshot.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 #include "bin/dartutils.h" 5 #include "bin/dartutils.h"
6 6
7 #include "include/dart_api.h" 7 #include "include/dart_api.h"
8 #include "include/dart_native_api.h" 8 #include "include/dart_native_api.h"
9 9
10 #include "platform/assert.h" 10 #include "platform/assert.h"
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after
276 return str; 276 return str;
277 } 277 }
278 278
279 279
280 Dart_Handle DartUtils::SetWorkingDirectory(Dart_Handle builtin_lib) { 280 Dart_Handle DartUtils::SetWorkingDirectory(Dart_Handle builtin_lib) {
281 Dart_Handle directory = NewString(original_working_directory); 281 Dart_Handle directory = NewString(original_working_directory);
282 return SingleArgDart_Invoke(builtin_lib, "_setWorkingDirectory", directory); 282 return SingleArgDart_Invoke(builtin_lib, "_setWorkingDirectory", directory);
283 } 283 }
284 284
285 285
286 Dart_Handle DartUtils::ResolveScriptUri(Dart_Handle script_uri, 286 Dart_Handle DartUtils::ResolveUriInWorkingDirectory(Dart_Handle script_uri,
287 Dart_Handle builtin_lib) { 287 Dart_Handle builtin_lib) {
288 const int kNumArgs = 1; 288 const int kNumArgs = 1;
289 Dart_Handle dart_args[kNumArgs]; 289 Dart_Handle dart_args[kNumArgs];
290 dart_args[0] = script_uri; 290 dart_args[0] = script_uri;
291 return Dart_Invoke(builtin_lib, 291 return Dart_Invoke(builtin_lib,
292 NewString("_resolveScriptUri"), 292 NewString("_resolveInWorkingDirectory"),
293 kNumArgs, 293 kNumArgs,
294 dart_args); 294 dart_args);
295 } 295 }
296 296
297 297
298 Dart_Handle DartUtils::FilePathFromUri(Dart_Handle script_uri, 298 Dart_Handle DartUtils::FilePathFromUri(Dart_Handle script_uri,
299 Dart_Handle builtin_lib) { 299 Dart_Handle builtin_lib) {
300 const int kNumArgs = 1; 300 const int kNumArgs = 1;
301 Dart_Handle dart_args[kNumArgs]; 301 Dart_Handle dart_args[kNumArgs];
302 dart_args[0] = script_uri; 302 dart_args[0] = script_uri;
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after
508 } 508 }
509 } 509 }
510 // The error was not handled above. Propagate an unhandled exception. 510 // The error was not handled above. Propagate an unhandled exception.
511 error = Dart_NewUnhandledExceptionError(error); 511 error = Dart_NewUnhandledExceptionError(error);
512 Dart_PropagateError(error); 512 Dart_PropagateError(error);
513 } 513 }
514 514
515 515
516 // Callback function that gets called from dartutils when the library 516 // Callback function that gets called from dartutils when the library
517 // source has been read. Loads the library or part into the VM. 517 // source has been read. Loads the library or part into the VM.
518 void FUNCTION_NAME(Builtin_LoadScript)(Dart_NativeArguments args) { 518 void FUNCTION_NAME(Builtin_LoadSource)(Dart_NativeArguments args) {
519 Dart_Handle tag_in = Dart_GetNativeArgument(args, 0); 519 Dart_Handle tag_in = Dart_GetNativeArgument(args, 0);
520 Dart_Handle resolved_script_uri = Dart_GetNativeArgument(args, 1); 520 Dart_Handle resolved_script_uri = Dart_GetNativeArgument(args, 1);
521 Dart_Handle library_uri = Dart_GetNativeArgument(args, 2); 521 Dart_Handle library_uri = Dart_GetNativeArgument(args, 2);
522 Dart_Handle source_data = Dart_GetNativeArgument(args, 3); 522 Dart_Handle source_data = Dart_GetNativeArgument(args, 3);
523 523
524 Dart_TypedData_Type type = Dart_GetTypeOfExternalTypedData(source_data); 524 Dart_TypedData_Type type = Dart_GetTypeOfExternalTypedData(source_data);
525 bool external = type == Dart_TypedData_kUint8; 525 bool external = type == Dart_TypedData_kUint8;
526 uint8_t* data = NULL; 526 uint8_t* data = NULL;
527 intptr_t num_bytes; 527 intptr_t num_bytes;
528 Dart_Handle result = Dart_TypedDataAcquireData( 528 Dart_Handle result = Dart_TypedDataAcquireData(
(...skipping 666 matching lines...) Expand 10 before | Expand all | Expand 10 after
1195 new CObjectString(CObject::NewString(os_error->message())); 1195 new CObjectString(CObject::NewString(os_error->message()));
1196 CObjectArray* result = new CObjectArray(CObject::NewArray(3)); 1196 CObjectArray* result = new CObjectArray(CObject::NewArray(3));
1197 result->SetAt(0, new CObjectInt32(CObject::NewInt32(kOSError))); 1197 result->SetAt(0, new CObjectInt32(CObject::NewInt32(kOSError)));
1198 result->SetAt(1, new CObjectInt32(CObject::NewInt32(os_error->code()))); 1198 result->SetAt(1, new CObjectInt32(CObject::NewInt32(os_error->code())));
1199 result->SetAt(2, error_message); 1199 result->SetAt(2, error_message);
1200 return result; 1200 return result;
1201 } 1201 }
1202 1202
1203 } // namespace bin 1203 } // namespace bin
1204 } // namespace dart 1204 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/bin/dartutils.h ('k') | runtime/bin/gen_snapshot.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698