Confirmed users
699
edits
No edit summary |
|||
Line 29: | Line 29: | ||
This code defines a <code>Plugin</code> protocol. On the next three lines, the code declares two messages, <code>Init()</code> and <code>Deinit()</code>. We will describe the messages in more detail in the next section. To finish the introduction of protocols and actors, note the <code>'''child'''</code> keyword used on the 2nd line. This keyword says that ''child'' "accepts", or "implements", the messages declared under that "child" label. That is, the parent actor can send those messages to the child, but the child cannot send those messages to the parent. | This code defines a <code>Plugin</code> protocol. On the next three lines, the code declares two messages, <code>Init()</code> and <code>Deinit()</code>. We will describe the messages in more detail in the next section. To finish the introduction of protocols and actors, note the <code>'''child'''</code> keyword used on the 2nd line. This keyword says that ''child'' "accepts", or "implements", the messages declared under that "child" label. That is, the parent actor can send those messages to the child, but the child cannot send those messages to the parent. | ||
== | == Basic messages == | ||
It is very important to understand message semantics. It's tempting to think of protocol messages as C++ function calls, but that's not very useful. We'll delve into gory details of the above example to illustrate these semantics. To keep the example as concrete as possible, we first need to take a detour into how the above example is translated into something that C++ code can utilize. | It is very important to understand message semantics. It's tempting to think of protocol messages as C++ function calls, but that's not very useful. We'll delve into gory details of the above example to illustrate these semantics. To keep the example as concrete as possible, we first need to take a detour into how the above example is translated into something that C++ code can utilize. | ||
Line 270: | Line 270: | ||
Please don't use RPC semantics. RPC inherits (nearly) all the problems of sync messages, while adding more of its own. Every time your code makes an RPC call, it must ensure that its state is "consistent" enough to handle every re-entrant (nested) call allowed by the IPDL state machine. This is hard to get right. (Why was RPC semantics added? Basically for NPAPI plugins, for which we can't change any existing plugin code.) | Please don't use RPC semantics. RPC inherits (nearly) all the problems of sync messages, while adding more of its own. Every time your code makes an RPC call, it must ensure that its state is "consistent" enough to handle every re-entrant (nested) call allowed by the IPDL state machine. This is hard to get right. (Why was RPC semantics added? Basically for NPAPI plugins, for which we can't change any existing plugin code.) | ||
== Checkpoint 1 == | |||
By this point in the guide, you should understand | |||
* basically what an IPDL protocol is | |||
* what an IPDL actor is, basically | |||
* what an IPDL message is, basically | |||
* message directions | |||
* message semantics | |||
* the relationship between IPDL and its generated interface; i.e., what your C++ code must implement |