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

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

Issue 878323002: - Move timer implementation closer to the rest of message handling. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 5 years, 11 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/common_patch.dart ('k') | runtime/lib/async_patch.dart » ('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 579 matching lines...) Expand 10 before | Expand all | Expand 10 after
590 } 590 }
591 591
592 592
593 Dart_Handle DartUtils::PrepareForScriptLoading(const char* package_root, 593 Dart_Handle DartUtils::PrepareForScriptLoading(const char* package_root,
594 Dart_Handle builtin_lib) { 594 Dart_Handle builtin_lib) {
595 // First ensure all required libraries are available. 595 // First ensure all required libraries are available.
596 Dart_Handle url = NewString(kAsyncLibURL); 596 Dart_Handle url = NewString(kAsyncLibURL);
597 DART_CHECK_VALID(url); 597 DART_CHECK_VALID(url);
598 Dart_Handle async_lib = Dart_LookupLibrary(url); 598 Dart_Handle async_lib = Dart_LookupLibrary(url);
599 DART_CHECK_VALID(async_lib); 599 DART_CHECK_VALID(async_lib);
600 url = NewString(kIsolateLibURL);
601 DART_CHECK_VALID(url);
602 Dart_Handle isolate_lib = Dart_LookupLibrary(url);
603 DART_CHECK_VALID(isolate_lib);
604 url = NewString(kInternalLibURL);
605 DART_CHECK_VALID(url);
606 Dart_Handle internal_lib = Dart_LookupLibrary(url);
607 DART_CHECK_VALID(internal_lib);
608
600 Dart_Handle io_lib = Builtin::LoadAndCheckLibrary(Builtin::kIOLibrary); 609 Dart_Handle io_lib = Builtin::LoadAndCheckLibrary(Builtin::kIOLibrary);
610 DART_CHECK_VALID(io_lib);
601 611
602 // We need to ensure that all the scripts loaded so far are finalized 612 // We need to ensure that all the scripts loaded so far are finalized
603 // as we are about to invoke some Dart code below to setup closures. 613 // as we are about to invoke some Dart code below to setup closures.
604 Dart_Handle result = Dart_FinalizeLoading(false); 614 Dart_Handle result = Dart_FinalizeLoading(false);
605 DART_CHECK_VALID(result); 615 DART_CHECK_VALID(result);
606 616
607 // Setup the internal library's 'internalPrint' function. 617 // Setup the internal library's 'internalPrint' function.
608 Dart_Handle print = Dart_Invoke( 618 Dart_Handle print = Dart_Invoke(
609 builtin_lib, NewString("_getPrintClosure"), 0, NULL); 619 builtin_lib, NewString("_getPrintClosure"), 0, NULL);
610 url = NewString(kInternalLibURL);
611 DART_CHECK_VALID(url);
612 Dart_Handle internal_lib = Dart_LookupLibrary(url);
613 DART_CHECK_VALID(internal_lib);
614 result = Dart_SetField(internal_lib, 620 result = Dart_SetField(internal_lib,
615 NewString("_printClosure"), 621 NewString("_printClosure"),
616 print); 622 print);
617 DART_CHECK_VALID(result); 623 DART_CHECK_VALID(result);
618 624
619 // Setup the 'timer' factory. 625 DART_CHECK_VALID(Dart_Invoke(isolate_lib, NewString("_setupHooks"), 0, NULL));
620 Dart_Handle timer_closure = 626 DART_CHECK_VALID(Dart_Invoke(io_lib, NewString("_setupHooks"), 0, NULL));
621 Dart_Invoke(io_lib, NewString("_getTimerFactoryClosure"), 0, NULL); 627
622 Dart_Handle args[1];
623 args[0] = timer_closure;
624 DART_CHECK_VALID(Dart_Invoke(
625 async_lib, NewString("_setTimerFactoryClosure"), 1, args));
626 628
627 // Setup the 'scheduleImmediate' closure. 629 // Setup the 'scheduleImmediate' closure.
628 url = NewString(kIsolateLibURL);
629 DART_CHECK_VALID(url);
630 Dart_Handle isolate_lib = Dart_LookupLibrary(url);
631 DART_CHECK_VALID(isolate_lib);
632 Dart_Handle schedule_immediate_closure = 630 Dart_Handle schedule_immediate_closure =
633 Dart_Invoke(isolate_lib, NewString("_getIsolateScheduleImmediateClosure"), 631 Dart_Invoke(isolate_lib, NewString("_getIsolateScheduleImmediateClosure"),
634 0, NULL); 632 0, NULL);
633 Dart_Handle args[1];
635 args[0] = schedule_immediate_closure; 634 args[0] = schedule_immediate_closure;
636 DART_CHECK_VALID(Dart_Invoke( 635 DART_CHECK_VALID(Dart_Invoke(
637 async_lib, NewString("_setScheduleImmediateClosure"), 1, args)); 636 async_lib, NewString("_setScheduleImmediateClosure"), 1, args));
638 637
639 // Setup the corelib 'Uri.base' getter. 638 // Setup the corelib 'Uri.base' getter.
640 url = NewString(kCoreLibURL); 639 url = NewString(kCoreLibURL);
641 DART_CHECK_VALID(url); 640 DART_CHECK_VALID(url);
642 Dart_Handle corelib = Dart_LookupLibrary(url); 641 Dart_Handle corelib = Dart_LookupLibrary(url);
643 DART_CHECK_VALID(corelib); 642 DART_CHECK_VALID(corelib);
644 Dart_Handle uri_base = Dart_Invoke( 643 Dart_Handle uri_base = Dart_Invoke(
(...skipping 466 matching lines...) Expand 10 before | Expand all | Expand 10 after
1111 new CObjectString(CObject::NewString(os_error->message())); 1110 new CObjectString(CObject::NewString(os_error->message()));
1112 CObjectArray* result = new CObjectArray(CObject::NewArray(3)); 1111 CObjectArray* result = new CObjectArray(CObject::NewArray(3));
1113 result->SetAt(0, new CObjectInt32(CObject::NewInt32(kOSError))); 1112 result->SetAt(0, new CObjectInt32(CObject::NewInt32(kOSError)));
1114 result->SetAt(1, new CObjectInt32(CObject::NewInt32(os_error->code()))); 1113 result->SetAt(1, new CObjectInt32(CObject::NewInt32(os_error->code())));
1115 result->SetAt(2, error_message); 1114 result->SetAt(2, error_message);
1116 return result; 1115 return result;
1117 } 1116 }
1118 1117
1119 } // namespace bin 1118 } // namespace bin
1120 } // namespace dart 1119 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/bin/common_patch.dart ('k') | runtime/lib/async_patch.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698