Confirmed users
699
edits
| Line 159: | Line 159: | ||
=== Parameters === | === Parameters === | ||
Message declarations allow any number of ''parameters'', which are data serialized by the sender and deserialized by the receiver. The following snippet of IPDL and generated code shows how parameters can be used in message declarations | |||
// protocol Blah { ... | |||
out Foo(int parameter); | |||
// class BlahProtocolParent { ... | |||
void SendFoo(const int& parameter) { // boilerplate } | |||
// class BlahProtocolChild { ... | |||
virtual void RecvFoo(const int& paramter) = 0; | |||
The IPDL compiler has a set of "builtin" types for which library code exists to serialize and deserialize parameters of that type. These builtin types include the C/C++ integer types (char, int, ..., int8_t, uint16_t, ...), a string type (<code>String</code> in IPDL), and some array types (<code>StringArray</code>, for example). These builtin types are in flux and will certainly be expanded. The most up-to-date reference for builtins is the file <code>ipc/glue/MessageTypes.h</code>. | |||
The builtin types are insufficient for all protocols. When you need to send data of type other than one built into IPDL, you can "import" the type into an IPDL specification, and in C++ define your own data serializer and deserializer. This is beyond the scope of this document at the moment; see <code>dom/plugins/NPAPI.ipdl</code> and <code>dom/plugins/PluginMessageUtils.h</code> for examples of how this can be done. | |||
=== Semantics === | === Semantics === | ||
=== Return values === | === Return values === | ||