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

Side by Side Diff: runtime/lib/isolate.cc

Issue 9169063: Add support for native ports in the vm. (Closed) Base URL: http://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
« no previous file with comments | « runtime/include/dart_api.h ('k') | runtime/vm/allocation.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 "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"
11 #include "vm/exceptions.h" 11 #include "vm/exceptions.h"
12 #include "vm/longjump.h" 12 #include "vm/longjump.h"
13 #include "vm/message_queue.h" 13 #include "vm/message.h"
14 #include "vm/object.h" 14 #include "vm/object.h"
15 #include "vm/object_store.h" 15 #include "vm/object_store.h"
16 #include "vm/port.h" 16 #include "vm/port.h"
17 #include "vm/resolver.h" 17 #include "vm/resolver.h"
18 #include "vm/snapshot.h" 18 #include "vm/snapshot.h"
19 #include "vm/thread.h" 19 #include "vm/thread.h"
20 20
21 namespace dart { 21 namespace dart {
22 22
23 class IsolateStartData { 23 class IsolateStartData {
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after
337 } else { 337 } else {
338 ProcessError(port); 338 ProcessError(port);
339 } 339 }
340 } 340 }
341 arguments->SetReturn(port); 341 arguments->SetReturn(port);
342 } 342 }
343 343
344 344
345 DEFINE_NATIVE_ENTRY(ReceivePortImpl_factory, 1) { 345 DEFINE_NATIVE_ENTRY(ReceivePortImpl_factory, 1) {
346 ASSERT(AbstractTypeArguments::CheckedHandle(arguments->At(0)).IsNull()); 346 ASSERT(AbstractTypeArguments::CheckedHandle(arguments->At(0)).IsNull());
347 intptr_t port_id = PortMap::CreatePort(); 347 intptr_t port_id =
348 PortMap::CreatePort(arguments->isolate()->message_handler());
348 const Instance& port = Instance::Handle(ReceivePortCreate(port_id)); 349 const Instance& port = Instance::Handle(ReceivePortCreate(port_id));
349 arguments->SetReturn(port); 350 arguments->SetReturn(port);
350 } 351 }
351 352
352 353
353 DEFINE_NATIVE_ENTRY(ReceivePortImpl_closeInternal, 1) { 354 DEFINE_NATIVE_ENTRY(ReceivePortImpl_closeInternal, 1) {
354 intptr_t id = Smi::CheckedHandle(arguments->At(0)).Value(); 355 intptr_t id = Smi::CheckedHandle(arguments->At(0)).Value();
355 PortMap::ClosePort(id); 356 PortMap::ClosePort(id);
356 } 357 }
357 358
358 359
359 DEFINE_NATIVE_ENTRY(SendPortImpl_sendInternal_, 3) { 360 DEFINE_NATIVE_ENTRY(SendPortImpl_sendInternal_, 3) {
360 intptr_t send_id = Smi::CheckedHandle(arguments->At(0)).Value(); 361 intptr_t send_id = Smi::CheckedHandle(arguments->At(0)).Value();
361 intptr_t reply_id = Smi::CheckedHandle(arguments->At(1)).Value(); 362 intptr_t reply_id = Smi::CheckedHandle(arguments->At(1)).Value();
362 // TODO(iposva): Allow for arbitrary messages to be sent. 363 // TODO(iposva): Allow for arbitrary messages to be sent.
363 uint8_t* data = SerializeObject(Instance::CheckedHandle(arguments->At(2))); 364 uint8_t* data = SerializeObject(Instance::CheckedHandle(arguments->At(2)));
364 365
365 // TODO(turnidge): Throw an exception when the return value is false? 366 // TODO(turnidge): Throw an exception when the return value is false?
366 PortMap::PostMessage(new Message( 367 PortMap::PostMessage(new Message(
367 send_id, reply_id, data, Message::kNormalPriority)); 368 send_id, reply_id, data, Message::kNormalPriority));
368 } 369 }
369 370
370 } // namespace dart 371 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/include/dart_api.h ('k') | runtime/vm/allocation.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698