OLD | NEW |
---|---|
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 481 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
492 DART_EXPORT Dart_Port Dart_GetMainPortId(); | 492 DART_EXPORT Dart_Port Dart_GetMainPortId(); |
493 | 493 |
494 /** | 494 /** |
495 * Does the current isolate have live ReceivePorts? | 495 * Does the current isolate have live ReceivePorts? |
496 * | 496 * |
497 * A ReceivePort is live when it has not been closed. | 497 * A ReceivePort is live when it has not been closed. |
498 */ | 498 */ |
499 DART_EXPORT bool Dart_HasLivePorts(); | 499 DART_EXPORT bool Dart_HasLivePorts(); |
500 | 500 |
501 /** | 501 /** |
502 * Posts a message for some isolate. The message is built from a raw | |
503 * array. | |
504 * | |
505 * \param port The destination port. | |
506 * \param length The length of the data array. | |
507 * \param data A data array to be sent in the message. | |
508 * | |
509 * \return True if the message was posted. | |
510 */ | |
511 DART_EXPORT bool Dart_PostIntArray(Dart_Port port_id, | |
512 intptr_t length, | |
513 intptr_t* data); | |
514 // TODO(turnidge): Should this be intptr_t or some fixed length type? | |
515 // TODO(turnidge): Reverse length/data for consistency. | |
516 | |
517 /** | |
518 * Posts a message for some isolate. The message is a serialized | 502 * Posts a message for some isolate. The message is a serialized |
519 * object. | 503 * object. |
520 * | 504 * |
521 * Requires there to be a current isolate. | 505 * Requires there to be a current isolate. |
522 * | 506 * |
523 * \param port The destination port. | 507 * \param port The destination port. |
524 * \param object An object from the current isolate. | 508 * \param object An object from the current isolate. |
525 * | 509 * |
526 * \return True if the message was posted. | 510 * \return True if the message was posted. |
527 */ | 511 */ |
(...skipping 903 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1431 double as_double; | 1415 double as_double; |
1432 char* as_string; | 1416 char* as_string; |
1433 struct { | 1417 struct { |
1434 int length; | 1418 int length; |
1435 Dart_CObject** values; | 1419 Dart_CObject** values; |
1436 } as_array; | 1420 } as_array; |
1437 } value; | 1421 } value; |
1438 }; | 1422 }; |
1439 | 1423 |
1440 /** | 1424 /** |
1441 * A Dart_CMessage is used for receiving and sending messages from | 1425 * Posts a message on some port. The message will contain the |
1442 * native code not running in an isolate. A message contains an object | 1426 * Dart_CObject object graph rooted in the provided Dart_CObject. |
1443 * graph represented as Dart_CObject structures rooted as the provided | |
1444 * root. | |
1445 * | 1427 * |
1446 * For information on the lifetime of this data, when provided in | 1428 * While the message is being sent the state of the graph of |
1447 * callbacks, see the documentation for the individual callbacks. | 1429 * Dart_CObject structures rooted in message should not be accessed, |
siva
2012/02/06 18:55:12
rooted in 'message' or rooted in 'root', we could
| |
1430 * as the message generation will make temporaly modification to the | |
siva
2012/02/06 18:55:12
'temporary modifications to the'
| |
1431 * data. When the message has been sent the graph will be fully | |
1432 * restored. | |
1433 * | |
1434 * \param port_id The destination port. | |
1435 * \param message The message to send. | |
1436 * | |
1437 * \return True if the message was posted. | |
1448 */ | 1438 */ |
1449 struct Dart_CMessage { | 1439 DART_EXPORT bool Dart_PostCObject(Dart_Port port_id, Dart_CObject* root); |
1450 Dart_CObject* root; | |
1451 }; | |
1452 | |
1453 | 1440 |
1454 #endif // INCLUDE_DART_API_H_ | 1441 #endif // INCLUDE_DART_API_H_ |
OLD | NEW |