mozilla

Compare Revisions

IPDL Tutorial

Change Revisions

Revision 69591:

Revision 69591 by jdm on

Revision 69592:

Revision 69592 by jdm on

Title:
IPDL Tutorial
IPDL Tutorial
Slug:
IPDL/Tutorial
IPDL/Tutorial
Content:

Revision 69591
Revision 69592
n65protocol PPluginn65<strong>async protocol</strong> PPlugin
n67child:n67<strong>child: </strong>  Init(nsCString pluginPath);
68  Init(nsCString pluginPath);
n71parent:n70<strong>parent:</strong>
n173protocol PDirectionn172<strong>async protocol</strong> PDirection
n175child:n
176  Foo();  // can be sent from-parent-to-child174<strong>child: </strong>  Foo();  // can be sent from-parent-to-c
 >hild
177parent:175<strong>parent:</strong>
n179both:n177<strong>both: </strong>  Baz();  // can be sent both ways
180  Baz();  // can be sent both ways
n232using mozilla::plugins::NPRemoteEvent;n229<strong>using</strong> mozilla::plugins::NPRemoteEvent;
n234protocol PPluginInstancen231<strong>sync protocol</strong> PPluginInstance
n236child:n233<strong>child: </strong>  HandleEvent(NPRemoteEvent);
237  HandleEvent(NPRemoteEvent);
n297protocol PPluginInstancen293<strong>sync</strong> <strong>protocol</strong> PPluginInstance
n299child:n295<strong>child:</strong>
300  sync Init() returns (bool windowless, bool ok);296  <strong>sync</strong> Init() <strong>returns</strong> (bool win
 >dowless, bool ok);
n355sync protocol PPluginInstancen351<strong>sync protocol</strong> PPluginInstance
n357child:n353<strong>child: </strong>  <strong>sync</strong> Init() <strong>re
 >turns</strong> (bool windowless, bool ok);
358  sync Init() returns (bool windowless, bool ok);
n429<code>// ----- file PPlugin.ipdl  include protocol PPluginInstancn424<code>// ----- file PPlugin.ipdl  <strong>include protocol</stron
>e;  rpc protocol PPlugin {   manages PPluginInstance;  child:   r>g> PPluginInstance;  <strong>rpc protocol</strong> PPlugin {   <s
>pc Init(nsCString pluginPath) returns (bool ok);    <span style=">trong>manages</strong> PPluginInstance;  <strong>child:</strong> 
>font-weight: bold;">rpc </span>PPluginInstance(nsCString type, ns>  <strong>rpc</strong> Init(nsCString pluginPath) <strong>returns
>CString[] args) returns (int rv); </code>};></strong> (bool ok);   <span style="font-weight: bold;">rpc </spa
 >n>PPluginInstance(nsCString type, nsCString[] args) <strong>retur
 >ns</strong> (int rv); </code>};
n432<code>// ----- file PPluginInstance.ipdl  include protocol PPlugin427<code>// ----- file PPluginInstance.ipdl  <strong>include protoco
>n;  rpc protocol PPluginInstance {   manager PPlugin;  child:   r>l</strong> PPlugin;  <strong>rpc protocol</strong> PPluginInstanc
>pc __delete__();    SetSize(int width, int height); };</code>>e {   <strong>manager</strong> PPlugin;  <strong>child:</strong> 
 > <strong>rpc</strong> __delete__();  SetSize(int width, int heigh
 >t); };</code>
n539      It is worth understanding the protocol deletion process. &nn534      It is worth understanding the protocol deletion process. &n
>bsp;Given the simple protocol:>bsp;Given the simple protocols:
540    </p>
541    <pre>535    </p>
542async protocol PExample536    <pre>
543{537// --- PExample.ipdl
544parent:538<strong><br>include protocol</strong> PSubExample;
545  PChild();
546};
nn540<strong>async protocol</strong> PExample
541{
542<strong>  manages</strong> PSubExample;
543 
544<strong>parent: </strong>  PChild();
545};
546 
547// --- PSubExample.ipdl
548 
549<strong>include protocol</strong> PExample;
550 
548async protocol PSubExample551<strong>async protocol</strong> PSubExample
n550child:n553  <strong>manager </strong>PExample;
551  __delete__();554<strong>child: </strong>  __delete__();
552};<br>555};
n557    <p>n560    <pre>
558      <code>aPSubExampleParent-&gt;Send__delete__();</code>561<code><code>aPSubExampleParent-&gt;Send__delete__();</code></code
 >>
562</pre>
563    <p>
564      &nbsp;
n579      &nbsp;n
580    </p>&lt;meta http-equiv="content-type" content="text/html; ch
>arset=utf-8"/&gt; 
581    <p>
nn630    <div class="warning">
631      Note:&nbsp;The following example uses the old ~Destructor s
 >yntax, and needs significant reworking to make use of the new __d
 >elete__ syntax instead.&nbsp; This is no longer a good example.
632    </div>
n628<strong>include</strong> <strong>protocol</strong> "PluginInstancn634<strong>include</strong> <strong>protocol</strong> PPluginInstanc
>e.ipdl";>e;
n630<strong>sync</strong> <strong>protocol</strong> Plugin {n636<strong>sync</strong> <strong>protocol</strong> PPlugin {
631  <strong>manages</strong> PluginInstance;637  <strong>manages</strong> PPluginInstance;
n637  <strong>sync</strong> PluginInstance(String type, StringArray an643  <strong>sync</strong> PPluginInstance(String type, StringArray 
>rgs) <strong>returns</strong> (int rv);>args) <strong>returns</strong> (int rv); 
638  ~PluginInstance();
n645  <strong>send</strong> PluginInstance <strong>goto</strong> ACTIn650  <strong>send</strong> PPluginInstance <strong>goto</strong> ACT
>VE;>IVE;
n648  <strong>send</strong> PluginInstance <strong>goto</strong> ACTIn653  <strong>send</strong> PPluginInstance <strong>goto</strong> ACT
>VE;>IVE;
649  <strong>send</strong> ~PluginInstance <strong>goto</strong> ACT654  <strong>send</strong> ~PPluginInstance <strong>goto</strong> AC
>IVE;>TIVE;
t653  <strong>send</strong> ~PluginInstance <strong>goto</strong> DYIt658  <strong>send</strong> ~PPluginInstance <strong>goto</strong> DY
>NG;>ING;

Back to History