IPDL/Getting started: Difference between revisions

Jump to navigation Jump to search
Line 180: Line 180:
     '''virtual''' '''void''' RecvFoo('''const''' '''int'''& paramter) = 0;
     '''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 (bool, char, int, ..., int8_t, uint16_t, ...), a string type (<code>nsString</code> in IPDL), and some array types (<code>nsTArray<nsString></code>, for example).  These builtin types are in flux and will certainly be expanded.   
IPDL has two categories of built-in types.  The first is C++ types that IPDL "imports" (described in more detail below) automatically, on behalf of the IPDL author.  These builtin types include the C/C++ integer types (bool, char, int, ..., int8_t, uint16_t, ...) and string types (<code>nsString</code>, <code>nsCString</code>).  IPDL does this because these types are common, and library code already exists to serialize and deserialize parameters of those types.  These builtin types are in flux and will certainly changeSee <code>ipc/ipdl/ipdl/builtins.py</code> for the most up-to-date reference.


The builtin types are insufficient for all protocols.  When you need to send data of type other than one built into IPDL, you can add a <code>'''using'''</code> declaration of the type in an IPDL specification, and in C++ define your own data serializer and deserializer.  The details of this are beyond the scope of this document; see <code>dom/plugins/NPAPI.ipdl</code> and <code>dom/plugins/PluginMessageUtils.h</code> for examples of how this is done.
The second category of built-ins are types that are native to IPDL.  These are IPDL unions and arrays and are described below.  These native IPDL types translate into C++ types.
 
The builtin types are insufficient for all protocols.  When you need to send data of type other than one built into IPDL, you can add a <code>'''using'''</code> declaration of the type in an IPDL specification, and in C++ define your own data serializer and deserializer.  The details of this are beyond the scope of this document; see <code>dom/plugins/PPluginInstance.ipdl</code> and <code>dom/plugins/PluginMessageUtils.h</code> for examples of how this is done.


=== Semantics ===
=== Semantics ===
Confirmed users
699

edits

Navigation menu