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

Side by Side Diff: runtime/vm/dart_api_impl.cc

Issue 9422019: isolates refactor: this change introduces 'dart:isolate' as a library. This is a (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: '' Created 8 years, 10 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 "include/dart_api.h" 5 #include "include/dart_api.h"
6 6
7 #include "vm/bigint_operations.h" 7 #include "vm/bigint_operations.h"
8 #include "vm/class_finalizer.h" 8 #include "vm/class_finalizer.h"
9 #include "vm/compiler.h" 9 #include "vm/compiler.h"
10 #include "vm/dart.h" 10 #include "vm/dart.h"
(...skipping 748 matching lines...) Expand 10 before | Expand all | Expand 10 after
759 DART_EXPORT Dart_Handle Dart_NewSendPort(Dart_Port port_id) { 759 DART_EXPORT Dart_Handle Dart_NewSendPort(Dart_Port port_id) {
760 Isolate* isolate = Isolate::Current(); 760 Isolate* isolate = Isolate::Current();
761 DARTSCOPE(isolate); 761 DARTSCOPE(isolate);
762 const String& class_name = String::Handle(String::NewSymbol("SendPortImpl")); 762 const String& class_name = String::Handle(String::NewSymbol("SendPortImpl"));
763 const String& function_name = String::Handle(String::NewSymbol("_create")); 763 const String& function_name = String::Handle(String::NewSymbol("_create"));
764 const int kNumArguments = 1; 764 const int kNumArguments = 1;
765 const Array& kNoArgumentNames = Array::Handle(); 765 const Array& kNoArgumentNames = Array::Handle();
766 // TODO(turnidge): Consider adding a helper function to make 766 // TODO(turnidge): Consider adding a helper function to make
767 // function resolution by class name and function name more concise. 767 // function resolution by class name and function name more concise.
768 const Function& function = Function::Handle( 768 const Function& function = Function::Handle(
769 Resolver::ResolveStatic(Library::Handle(Library::CoreLibrary()), 769 Resolver::ResolveStatic(Library::Handle(Library::IsolateLibrary()),
770 class_name, 770 class_name,
771 function_name, 771 function_name,
772 kNumArguments, 772 kNumArguments,
773 kNoArgumentNames, 773 kNoArgumentNames,
774 Resolver::kIsQualified)); 774 Resolver::kIsQualified));
775 GrowableArray<const Object*> arguments(kNumArguments); 775 GrowableArray<const Object*> arguments(kNumArguments);
776 arguments.Add(&Integer::Handle(Integer::New(port_id))); 776 arguments.Add(&Integer::Handle(Integer::New(port_id)));
777 const Object& result = Object::Handle( 777 const Object& result = Object::Handle(
778 DartEntry::InvokeStatic(function, arguments, kNoArgumentNames)); 778 DartEntry::InvokeStatic(function, arguments, kNoArgumentNames));
779 return Api::NewLocalHandle(result); 779 return Api::NewLocalHandle(result);
780 } 780 }
781 781
782 782
783 DART_EXPORT Dart_Handle Dart_GetReceivePort(Dart_Port port_id) { 783 DART_EXPORT Dart_Handle Dart_GetReceivePort(Dart_Port port_id) {
784 Isolate* isolate = Isolate::Current(); 784 Isolate* isolate = Isolate::Current();
785 DARTSCOPE(isolate); 785 DARTSCOPE(isolate);
786 const String& class_name = 786 const String& class_name =
787 String::Handle(String::NewSymbol("ReceivePortImpl")); 787 String::Handle(String::NewSymbol("ReceivePortImpl"));
788 const String& function_name = 788 const String& function_name =
789 String::Handle(String::NewSymbol("_get_or_create")); 789 String::Handle(String::NewSymbol("_get_or_create"));
790 const int kNumArguments = 1; 790 const int kNumArguments = 1;
791 const Array& kNoArgumentNames = Array::Handle(); 791 const Array& kNoArgumentNames = Array::Handle();
792 const Function& function = Function::Handle( 792 const Function& function = Function::Handle(
793 Resolver::ResolveStatic(Library::Handle(Library::CoreLibrary()), 793 Resolver::ResolveStatic(Library::Handle(Library::IsolateLibrary()),
794 class_name, 794 class_name,
795 function_name, 795 function_name,
796 kNumArguments, 796 kNumArguments,
797 kNoArgumentNames, 797 kNoArgumentNames,
798 Resolver::kIsQualified)); 798 Resolver::kIsQualified));
799 GrowableArray<const Object*> arguments(kNumArguments); 799 GrowableArray<const Object*> arguments(kNumArguments);
800 arguments.Add(&Integer::Handle(Integer::New(port_id))); 800 arguments.Add(&Integer::Handle(Integer::New(port_id)));
801 const Object& result = Object::Handle( 801 const Object& result = Object::Handle(
802 DartEntry::InvokeStatic(function, arguments, kNoArgumentNames)); 802 DartEntry::InvokeStatic(function, arguments, kNoArgumentNames));
803 return Api::NewLocalHandle(result); 803 return Api::NewLocalHandle(result);
(...skipping 1901 matching lines...) Expand 10 before | Expand all | Expand 10 after
2705 *buffer = NULL; 2705 *buffer = NULL;
2706 } 2706 }
2707 delete debug_region; 2707 delete debug_region;
2708 } else { 2708 } else {
2709 *buffer = NULL; 2709 *buffer = NULL;
2710 *buffer_size = 0; 2710 *buffer_size = 0;
2711 } 2711 }
2712 } 2712 }
2713 2713
2714 } // namespace dart 2714 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698