Bug 578809 - Jetpack .callMessage should be RPC, not sync, so that handles created during the reply are available correctly, r=bent
authorBenjamin Smedberg <benjamin@smedbergs.us>
Fri, 23 Jul 2010 17:11:33 -0400
changeset 48151 07b96641ab93e6139e281933911a83a2bfb90b27
parent 48150 bc0bb5908a7fb995e83ead7d2a256eb698e6f2ff
child 48152 9318b1fd574e99c2a9ba61791fbbf1f1410f47f6
push id14593
push userbsmedberg@mozilla.com
push dateFri, 23 Jul 2010 21:11:49 +0000
treeherdermozilla-central@07b96641ab93 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbent
bugs578809
milestone2.0b3pre
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 578809 - Jetpack .callMessage should be RPC, not sync, so that handles created during the reply are available correctly, r=bent
js/jetpack/JetpackChild.cpp
js/jetpack/JetpackParent.cpp
js/jetpack/JetpackParent.h
js/jetpack/PJetpack.ipdl
--- a/js/jetpack/JetpackChild.cpp
+++ b/js/jetpack/JetpackChild.cpp
@@ -236,17 +236,17 @@ JetpackChild::SendMessage(JSContext* cx,
 JSBool
 JetpackChild::CallMessage(JSContext* cx, uintN argc, jsval* vp)
 {
   MessageResult smr;
   if (!MessageCommon(cx, argc, vp, &smr))
     return JS_FALSE;
 
   nsTArray<Variant> results;
-  if (!GetThis(cx)->SendCallMessage(smr.msgName, smr.data, &results)) {
+  if (!GetThis(cx)->CallCallMessage(smr.msgName, smr.data, &results)) {
     JS_ReportError(cx, "Failed to callMessage");
     return JS_FALSE;
   }
 
   nsAutoTArray<jsval, 4> jsvals;
   jsval* rvals = jsvals.AppendElements(results.Length());
   if (!rvals) {
     JS_ReportOutOfMemory(cx);
--- a/js/jetpack/JetpackParent.cpp
+++ b/js/jetpack/JetpackParent.cpp
@@ -161,19 +161,19 @@ JetpackParent::RecvSendMessage(const nsS
                                const nsTArray<Variant>& data)
 {
   AutoCXPusher cxp(mContext);
   JSAutoRequest request(mContext);
   return JetpackActorCommon::RecvMessage(mContext, messageName, data, NULL);
 }
 
 bool
-JetpackParent::RecvCallMessage(const nsString& messageName,
-                               const nsTArray<Variant>& data,
-                               nsTArray<Variant>* results)
+JetpackParent::AnswerCallMessage(const nsString& messageName,
+                                 const nsTArray<Variant>& data,
+                                 nsTArray<Variant>* results)
 {
   AutoCXPusher cxp(mContext);
   JSAutoRequest request(mContext);
   return JetpackActorCommon::RecvMessage(mContext, messageName, data, results);
 }
 
 NS_IMETHODIMP
 JetpackParent::CreateHandle(nsIVariant** aResult)
--- a/js/jetpack/JetpackParent.h
+++ b/js/jetpack/JetpackParent.h
@@ -63,19 +63,19 @@ public:
   NS_DECL_NSIJETPACK
 
   JetpackParent(JSContext* cx);
   ~JetpackParent();
 
 protected:
   NS_OVERRIDE virtual bool RecvSendMessage(const nsString& messageName,
                                            const nsTArray<Variant>& data);
-  NS_OVERRIDE virtual bool RecvCallMessage(const nsString& messageName,
-                                           const nsTArray<Variant>& data,
-                                           nsTArray<Variant>* results);
+  NS_OVERRIDE virtual bool AnswerCallMessage(const nsString& messageName,
+                                             const nsTArray<Variant>& data,
+                                             nsTArray<Variant>* results);
 
   NS_OVERRIDE virtual PHandleParent* AllocPHandle();
   NS_OVERRIDE virtual bool DeallocPHandle(PHandleParent* actor);
 
 private:
   JetpackProcessParent* mSubprocess;
   JSContext* mContext;
 
--- a/js/jetpack/PJetpack.ipdl
+++ b/js/jetpack/PJetpack.ipdl
@@ -64,28 +64,28 @@ union CompVariant {
   size_t; // reference
 };
   
 union Variant {
   PrimVariant;
   CompVariant;
 };
 
-sync protocol PJetpack
+rpc protocol PJetpack
 {
   manages PHandle;
 both:
   async SendMessage(nsString messageName,
                     Variant[] data);
   async PHandle();
 
 child:
   async EvalScript(nsString code);
 
 parent:
-  sync CallMessage(nsString messageName,
-                   Variant[] data)
+  rpc CallMessage(nsString messageName,
+                  Variant[] data)
     returns (Variant[] results);
 
 };
 
 } // namespace jetpack
 } // namespace mozilla