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

Side by Side Diff: runtime/include/dart_api.h

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 | « no previous file | runtime/lib/isolate.cc » ('j') | runtime/vm/allocation.cc » ('J')
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 #ifndef INCLUDE_DART_API_H_ 5 #ifndef INCLUDE_DART_API_H_
6 #define INCLUDE_DART_API_H_ 6 #define INCLUDE_DART_API_H_
7 7
8 /** \mainpage Dart Embedding API Reference 8 /** \mainpage Dart Embedding API Reference
9 * 9 *
10 * Dart is a class-based programming language for creating structured 10 * Dart is a class-based programming language for creating structured
(...skipping 504 matching lines...) Expand 10 before | Expand all | Expand 10 after
515 * Requires there to be a current isolate. 515 * Requires there to be a current isolate.
516 * 516 *
517 * \param port The destination port. 517 * \param port The destination port.
518 * \param object An object from the current isolate. 518 * \param object An object from the current isolate.
519 * 519 *
520 * \return True if the message was posted. 520 * \return True if the message was posted.
521 */ 521 */
522 DART_EXPORT bool Dart_Post(Dart_Port port_id, Dart_Handle object); 522 DART_EXPORT bool Dart_Post(Dart_Port port_id, Dart_Handle object);
523 523
524 /** 524 /**
525 * A native message handler.
526 *
527 * This handler is associated with a native port by calling
528 * Dart_NewNativePort.
529 */
530 typedef void (*Dart_NativeMessageHandler)(Dart_Port dest_port_id,
531 Dart_Port reply_port_id,
532 uint8_t* data);
533 // TODO(turnidge): Make this function take more appropriate arguments.
534
535 /**
536 * Creates a new native port. When messages are received on this
537 * native port, then they will be dispatched to the provided native
538 * message handler.
539 *
540 * \param name The name of this port in debugging messages.
541 * \param handler The C handler to run when messages arrive on the port.
542 * \param handle_concurrently Is it okay to process requests on this
543 * native port concurrently?
544 *
545 * \return A port id for the native port.
546 */
547 DART_EXPORT Dart_Port Dart_NewNativePort(const char* name,
548 Dart_NativeMessageHandler handler,
549 bool handle_concurrently);
550 // TODO(turnidge): Currently allow_concurrent is ignored.
siva 2012/02/01 00:38:56 Currently handle_concurrently is ignored.
turnidge 2012/02/01 18:51:27 Done.
551
552 /**
553 * Closes the native port with the given id.
554 *
555 * The port must have been allocated by a call to Dart_NewNativePort.
556 *
557 * \param native_port_id The id of the native port to close.
558 *
559 * \return Returns true if the port was closed successfully.
560 */
561 DART_EXPORT bool Dart_CloseNativePort(Dart_Port native_port_id);
562
563 /**
525 * Returns a new SendPort with the provided port id. 564 * Returns a new SendPort with the provided port id.
526 */ 565 */
527 DART_EXPORT Dart_Handle Dart_NewSendPort(Dart_Port port_id); 566 DART_EXPORT Dart_Handle Dart_NewSendPort(Dart_Port port_id);
528 567
529 /** 568 /**
530 * Gets the ReceivePort for the provided port id, creating it if necessary. 569 * Gets the ReceivePort for the provided port id, creating it if necessary.
531 * 570 *
532 * Note that there is at most one ReceivePort for a given port id. 571 * Note that there is at most one ReceivePort for a given port id.
533 */ 572 */
534 DART_EXPORT Dart_Handle Dart_GetReceivePort(Dart_Port port_id); 573 DART_EXPORT Dart_Handle Dart_GetReceivePort(Dart_Port port_id);
(...skipping 856 matching lines...) Expand 10 before | Expand all | Expand 10 after
1391 }; 1430 };
1392 1431
1393 /** 1432 /**
1394 * A Dart_CMessage is used for encoding and decoding messages from native code. 1433 * A Dart_CMessage is used for encoding and decoding messages from native code.
1395 */ 1434 */
1396 struct Dart_CMessage { 1435 struct Dart_CMessage {
1397 Dart_CObject** message; 1436 Dart_CObject** message;
1398 }; 1437 };
1399 1438
1400 #endif // INCLUDE_DART_API_H_ 1439 #endif // INCLUDE_DART_API_H_
OLDNEW
« no previous file with comments | « no previous file | runtime/lib/isolate.cc » ('j') | runtime/vm/allocation.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698