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

Side by Side Diff: bin/dartutils.cc

Issue 10911135: Simplify the builtin functions and get rid of unused code. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/runtime/
Patch Set: Created 8 years, 3 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/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 "bin/extensions.h" 7 #include "bin/extensions.h"
8 #include "bin/directory.h" 8 #include "bin/directory.h"
9 #include "bin/file.h" 9 #include "bin/file.h"
10 #include "include/dart_api.h" 10 #include "include/dart_api.h"
(...skipping 394 matching lines...) Expand 10 before | Expand all | Expand 10 after
405 Dart_Handle builtin_lib) { 405 Dart_Handle builtin_lib) {
406 // Setup the corelib 'print' function. 406 // Setup the corelib 'print' function.
407 Dart_Handle print = 407 Dart_Handle print =
408 Dart_Invoke(builtin_lib, Dart_NewString("_getPrintClosure"), 0, 0); 408 Dart_Invoke(builtin_lib, Dart_NewString("_getPrintClosure"), 0, 0);
409 Dart_Handle coreimpl = Dart_LookupLibrary(Dart_NewString("dart:coreimpl")); 409 Dart_Handle coreimpl = Dart_LookupLibrary(Dart_NewString("dart:coreimpl"));
410 Dart_Handle print_impl = 410 Dart_Handle print_impl =
411 Dart_GetClass(coreimpl, Dart_NewString("PrintImplementation")); 411 Dart_GetClass(coreimpl, Dart_NewString("PrintImplementation"));
412 Dart_Handle result = Dart_SetField(print_impl, 412 Dart_Handle result = Dart_SetField(print_impl,
413 Dart_NewString("_printClosure"), print); 413 Dart_NewString("_printClosure"), print);
414 414
415 // Setup the IO library. 415 // Setup the 'timer' factory.
416 Dart_Handle url = Dart_NewString(kIsolateLibURL);
417 DART_CHECK_VALID(url);
418 Dart_Handle isolate_lib = Dart_LookupLibrary(url);
419 DART_CHECK_VALID(isolate_lib);
416 Dart_Handle io_lib = Builtin::LoadAndCheckLibrary(Builtin::kIOLibrary); 420 Dart_Handle io_lib = Builtin::LoadAndCheckLibrary(Builtin::kIOLibrary);
417 Builtin::SetupIOLibrary(io_lib); 421 Dart_Handle timer_closure =
422 Dart_Invoke(io_lib, Dart_NewString("_getTimerFactoryClosure"), 0, NULL);
423 Dart_Handle args[1];
424 args[0] = timer_closure;
425 DART_CHECK_VALID(Dart_Invoke(isolate_lib,
426 Dart_NewString("_setTimerFactoryClosure"),
427 1, args));
418 428
419 // Set up package root if specified. 429 // Set up package root if specified.
420 if (package_root != NULL) { 430 if (package_root != NULL) {
421 result = Dart_NewString(package_root); 431 result = Dart_NewString(package_root);
422 if (!Dart_IsError(result)) { 432 if (!Dart_IsError(result)) {
423 const int kNumArgs = 1; 433 const int kNumArgs = 1;
424 Dart_Handle dart_args[kNumArgs]; 434 Dart_Handle dart_args[kNumArgs];
425 dart_args[0] = result; 435 dart_args[0] = result;
426 return Dart_Invoke(builtin_lib, 436 return Dart_Invoke(builtin_lib,
427 Dart_NewString("_setPackageRoot"), 437 Dart_NewString("_setPackageRoot"),
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after
660 670
661 CObject* CObject::NewOSError(OSError* os_error) { 671 CObject* CObject::NewOSError(OSError* os_error) {
662 CObject* error_message = 672 CObject* error_message =
663 new CObjectString(CObject::NewString(os_error->message())); 673 new CObjectString(CObject::NewString(os_error->message()));
664 CObjectArray* result = new CObjectArray(CObject::NewArray(3)); 674 CObjectArray* result = new CObjectArray(CObject::NewArray(3));
665 result->SetAt(0, new CObjectInt32(CObject::NewInt32(kOSError))); 675 result->SetAt(0, new CObjectInt32(CObject::NewInt32(kOSError)));
666 result->SetAt(1, new CObjectInt32(CObject::NewInt32(os_error->code()))); 676 result->SetAt(1, new CObjectInt32(CObject::NewInt32(os_error->code())));
667 result->SetAt(2, error_message); 677 result->SetAt(2, error_message);
668 return result; 678 return result;
669 } 679 }
OLDNEW
« no previous file with comments | « bin/builtin_nolib.cc ('k') | bin/gen_snapshot.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698