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

Side by Side Diff: runtime/lib/isolate.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 "platform/assert.h" 5 #include "platform/assert.h"
6 #include "vm/bootstrap_natives.h" 6 #include "vm/bootstrap_natives.h"
7 #include "vm/class_finalizer.h" 7 #include "vm/class_finalizer.h"
8 #include "vm/dart.h" 8 #include "vm/dart.h"
9 #include "vm/dart_api_impl.h" 9 #include "vm/dart_api_impl.h"
10 #include "vm/dart_entry.h" 10 #include "vm/dart_entry.h"
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 83
84 // TODO(turnidge): Move to DartLibraryCalls. 84 // TODO(turnidge): Move to DartLibraryCalls.
85 RawObject* ReceivePortCreate(intptr_t port_id) { 85 RawObject* ReceivePortCreate(intptr_t port_id) {
86 const String& class_name = 86 const String& class_name =
87 String::Handle(String::NewSymbol("ReceivePortImpl")); 87 String::Handle(String::NewSymbol("ReceivePortImpl"));
88 const String& function_name = 88 const String& function_name =
89 String::Handle(String::NewSymbol("_get_or_create")); 89 String::Handle(String::NewSymbol("_get_or_create"));
90 const int kNumArguments = 1; 90 const int kNumArguments = 1;
91 const Array& kNoArgumentNames = Array::Handle(); 91 const Array& kNoArgumentNames = Array::Handle();
92 const Function& function = Function::Handle( 92 const Function& function = Function::Handle(
93 Resolver::ResolveStatic(Library::Handle(Library::CoreLibrary()), 93 Resolver::ResolveStatic(Library::Handle(Library::IsolateLibrary()),
94 class_name, 94 class_name,
95 function_name, 95 function_name,
96 kNumArguments, 96 kNumArguments,
97 kNoArgumentNames, 97 kNoArgumentNames,
98 Resolver::kIsQualified)); 98 Resolver::kIsQualified));
99 GrowableArray<const Object*> arguments(kNumArguments); 99 GrowableArray<const Object*> arguments(kNumArguments);
100 arguments.Add(&Integer::Handle(Integer::New(port_id))); 100 arguments.Add(&Integer::Handle(Integer::New(port_id)));
101 const Object& result = Object::Handle( 101 const Object& result = Object::Handle(
102 DartEntry::InvokeStatic(function, arguments, kNoArgumentNames)); 102 DartEntry::InvokeStatic(function, arguments, kNoArgumentNames));
103 if (!result.IsError()) { 103 if (!result.IsError()) {
104 PortMap::SetLive(port_id); 104 PortMap::SetLive(port_id);
105 } 105 }
106 return result.raw(); 106 return result.raw();
107 } 107 }
108 108
109 109
110 // TODO(turnidge): Move to DartLibraryCalls. 110 // TODO(turnidge): Move to DartLibraryCalls.
111 static RawObject* SendPortCreate(intptr_t port_id) { 111 static RawObject* SendPortCreate(intptr_t port_id) {
112 const String& class_name = String::Handle(String::NewSymbol("SendPortImpl")); 112 const String& class_name = String::Handle(String::NewSymbol("SendPortImpl"));
113 const String& function_name = String::Handle(String::NewSymbol("_create")); 113 const String& function_name = String::Handle(String::NewSymbol("_create"));
114 const int kNumArguments = 1; 114 const int kNumArguments = 1;
115 const Array& kNoArgumentNames = Array::Handle(); 115 const Array& kNoArgumentNames = Array::Handle();
116 const Function& function = Function::Handle( 116 const Function& function = Function::Handle(
117 Resolver::ResolveStatic(Library::Handle(Library::CoreLibrary()), 117 Resolver::ResolveStatic(Library::Handle(Library::IsolateLibrary()),
118 class_name, 118 class_name,
119 function_name, 119 function_name,
120 kNumArguments, 120 kNumArguments,
121 kNoArgumentNames, 121 kNoArgumentNames,
122 Resolver::kIsQualified)); 122 Resolver::kIsQualified));
123 GrowableArray<const Object*> arguments(kNumArguments); 123 GrowableArray<const Object*> arguments(kNumArguments);
124 arguments.Add(&Integer::Handle(Integer::New(port_id))); 124 arguments.Add(&Integer::Handle(Integer::New(port_id)));
125 const Object& result = Object::Handle( 125 const Object& result = Object::Handle(
126 DartEntry::InvokeStatic(function, arguments, kNoArgumentNames)); 126 DartEntry::InvokeStatic(function, arguments, kNoArgumentNames));
127 return result.raw(); 127 return result.raw();
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after
368 intptr_t reply_id = Smi::CheckedHandle(arguments->At(1)).Value(); 368 intptr_t reply_id = Smi::CheckedHandle(arguments->At(1)).Value();
369 // TODO(iposva): Allow for arbitrary messages to be sent. 369 // TODO(iposva): Allow for arbitrary messages to be sent.
370 uint8_t* data = SerializeObject(Instance::CheckedHandle(arguments->At(2))); 370 uint8_t* data = SerializeObject(Instance::CheckedHandle(arguments->At(2)));
371 371
372 // TODO(turnidge): Throw an exception when the return value is false? 372 // TODO(turnidge): Throw an exception when the return value is false?
373 PortMap::PostMessage(new Message( 373 PortMap::PostMessage(new Message(
374 send_id, reply_id, data, Message::kNormalPriority)); 374 send_id, reply_id, data, Message::kNormalPriority));
375 } 375 }
376 376
377 } // namespace dart 377 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698