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

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, 9 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/vm/custom_isolate_test.cc ('k') | runtime/vm/dart_api_impl_test.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 "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 741 matching lines...) Expand 10 before | Expand all | Expand 10 after
752 Isolate::SetCurrent(NULL); 752 Isolate::SetCurrent(NULL);
753 753
754 // TODO(turnidge): Check that the port is native before trying to close. 754 // TODO(turnidge): Check that the port is native before trying to close.
755 return PortMap::ClosePort(native_port_id); 755 return PortMap::ClosePort(native_port_id);
756 } 756 }
757 757
758 758
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 Library& isolate_lib = Library::Handle(Library::IsolateLibrary());
763 ASSERT(!isolate_lib.IsNull());
764 const String& class_name =
765 String::Handle(isolate_lib.PrivateName("_SendPortImpl"));
763 const String& function_name = String::Handle(String::NewSymbol("_create")); 766 const String& function_name = String::Handle(String::NewSymbol("_create"));
764 const int kNumArguments = 1; 767 const int kNumArguments = 1;
765 const Array& kNoArgumentNames = Array::Handle(); 768 const Array& kNoArgumentNames = Array::Handle();
766 // TODO(turnidge): Consider adding a helper function to make 769 // TODO(turnidge): Consider adding a helper function to make
767 // function resolution by class name and function name more concise. 770 // function resolution by class name and function name more concise.
768 const Function& function = Function::Handle( 771 const Function& function = Function::Handle(
769 Resolver::ResolveStatic(Library::Handle(Library::CoreLibrary()), 772 Resolver::ResolveStatic(isolate_lib,
770 class_name, 773 class_name,
771 function_name, 774 function_name,
772 kNumArguments, 775 kNumArguments,
773 kNoArgumentNames, 776 kNoArgumentNames,
774 Resolver::kIsQualified)); 777 Resolver::kIsQualified));
775 GrowableArray<const Object*> arguments(kNumArguments); 778 GrowableArray<const Object*> arguments(kNumArguments);
776 arguments.Add(&Integer::Handle(Integer::New(port_id))); 779 arguments.Add(&Integer::Handle(Integer::New(port_id)));
777 const Object& result = Object::Handle( 780 const Object& result = Object::Handle(
778 DartEntry::InvokeStatic(function, arguments, kNoArgumentNames)); 781 DartEntry::InvokeStatic(function, arguments, kNoArgumentNames));
779 return Api::NewLocalHandle(result); 782 return Api::NewLocalHandle(result);
780 } 783 }
781 784
782 785
783 DART_EXPORT Dart_Handle Dart_GetReceivePort(Dart_Port port_id) { 786 DART_EXPORT Dart_Handle Dart_GetReceivePort(Dart_Port port_id) {
784 Isolate* isolate = Isolate::Current(); 787 Isolate* isolate = Isolate::Current();
785 DARTSCOPE(isolate); 788 DARTSCOPE(isolate);
789 Library& isolate_lib = Library::Handle(Library::IsolateLibrary());
790 ASSERT(!isolate_lib.IsNull());
786 const String& class_name = 791 const String& class_name =
787 String::Handle(String::NewSymbol("ReceivePortImpl")); 792 String::Handle(isolate_lib.PrivateName("_ReceivePortImpl"));
788 const String& function_name = 793 const String& function_name =
789 String::Handle(String::NewSymbol("_get_or_create")); 794 String::Handle(String::NewSymbol("_get_or_create"));
790 const int kNumArguments = 1; 795 const int kNumArguments = 1;
791 const Array& kNoArgumentNames = Array::Handle(); 796 const Array& kNoArgumentNames = Array::Handle();
792 const Function& function = Function::Handle( 797 const Function& function = Function::Handle(
793 Resolver::ResolveStatic(Library::Handle(Library::CoreLibrary()), 798 Resolver::ResolveStatic(isolate_lib,
794 class_name, 799 class_name,
795 function_name, 800 function_name,
796 kNumArguments, 801 kNumArguments,
797 kNoArgumentNames, 802 kNoArgumentNames,
798 Resolver::kIsQualified)); 803 Resolver::kIsQualified));
799 GrowableArray<const Object*> arguments(kNumArguments); 804 GrowableArray<const Object*> arguments(kNumArguments);
800 arguments.Add(&Integer::Handle(Integer::New(port_id))); 805 arguments.Add(&Integer::Handle(Integer::New(port_id)));
801 const Object& result = Object::Handle( 806 const Object& result = Object::Handle(
802 DartEntry::InvokeStatic(function, arguments, kNoArgumentNames)); 807 DartEntry::InvokeStatic(function, arguments, kNoArgumentNames));
803 return Api::NewLocalHandle(result); 808 return Api::NewLocalHandle(result);
(...skipping 1901 matching lines...) Expand 10 before | Expand all | Expand 10 after
2705 *buffer = NULL; 2710 *buffer = NULL;
2706 } 2711 }
2707 delete debug_region; 2712 delete debug_region;
2708 } else { 2713 } else {
2709 *buffer = NULL; 2714 *buffer = NULL;
2710 *buffer_size = 0; 2715 *buffer_size = 0;
2711 } 2716 }
2712 } 2717 }
2713 2718
2714 } // namespace dart 2719 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/custom_isolate_test.cc ('k') | runtime/vm/dart_api_impl_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698