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

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

Issue 9325022: Decode the Dart message into a Dart_CMessage structure before calling the native port callback (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
« no previous file with comments | « no previous file | runtime/vm/dart_api_impl_test.cc » ('j') | runtime/vm/growable_array.h » ('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 538 matching lines...) Expand 10 before | Expand all | Expand 10 after
549 * 549 *
550 * \return True if the message was posted. 550 * \return True if the message was posted.
551 */ 551 */
552 DART_EXPORT bool Dart_Post(Dart_Port port_id, Dart_Handle object); 552 DART_EXPORT bool Dart_Post(Dart_Port port_id, Dart_Handle object);
553 553
554 /** 554 /**
555 * A native message handler. 555 * A native message handler.
556 * 556 *
557 * This handler is associated with a native port by calling 557 * This handler is associated with a native port by calling
558 * Dart_NewNativePort. 558 * Dart_NewNativePort.
559 *
560 * The message received is decoded into the message structure. The
561 * lifetime of the message data is controlled by the caller. All the
562 * data references from the message are allocated by the caller and
563 * will be reclaimed when returning to it.
559 */ 564 */
565 struct Dart_CMessage;
siva 2012/02/04 01:55:43 Why not move the section /** Message sending/recei
Søren Gjesse 2012/02/06 16:25:52 Done.
560 typedef void (*Dart_NativeMessageHandler)(Dart_Port dest_port_id, 566 typedef void (*Dart_NativeMessageHandler)(Dart_Port dest_port_id,
561 Dart_Port reply_port_id, 567 Dart_Port reply_port_id,
562 uint8_t* data); 568 Dart_CMessage* message);
563 // TODO(turnidge): Make this function take more appropriate arguments.
564 569
565 /** 570 /**
566 * Creates a new native port. When messages are received on this 571 * Creates a new native port. When messages are received on this
567 * native port, then they will be dispatched to the provided native 572 * native port, then they will be dispatched to the provided native
568 * message handler. 573 * message handler.
569 * 574 *
570 * \param name The name of this port in debugging messages. 575 * \param name The name of this port in debugging messages.
571 * \param handler The C handler to run when messages arrive on the port. 576 * \param handler The C handler to run when messages arrive on the port.
572 * \param handle_concurrently Is it okay to process requests on this 577 * \param handle_concurrently Is it okay to process requests on this
573 * native port concurrently? 578 * native port concurrently?
(...skipping 890 matching lines...) Expand 10 before | Expand all | Expand 10 after
1464 /** 1469 /**
1465 * A Dart_CMessage is used for receiving and sending messages from 1470 * A Dart_CMessage is used for receiving and sending messages from
1466 * native code not running in an isolate. A message contains an object 1471 * native code not running in an isolate. A message contains an object
1467 * graph represented as Dart_CObject structures rooted as the provided 1472 * graph represented as Dart_CObject structures rooted as the provided
1468 * root. 1473 * root.
1469 * 1474 *
1470 * For information on the lifetime of this data, when provided in 1475 * For information on the lifetime of this data, when provided in
1471 * callbacks, see the documentation for the individual callbacks. 1476 * callbacks, see the documentation for the individual callbacks.
1472 */ 1477 */
1473 struct Dart_CMessage { 1478 struct Dart_CMessage {
1474 Dart_CObject* root; 1479 Dart_CObject* root;
siva 2012/02/04 01:55:43 I am beginning to wonder if we need "struct Dart_C
Søren Gjesse 2012/02/06 16:25:52 Mads and I also discussed this Friday. And as it d
1475 }; 1480 };
1476 1481
1477 1482
1478 #endif // INCLUDE_DART_API_H_ 1483 #endif // INCLUDE_DART_API_H_
OLDNEW
« no previous file with comments | « no previous file | runtime/vm/dart_api_impl_test.cc » ('j') | runtime/vm/growable_array.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698