Bug 1486547 - renamed the mState field on generated protocol classes; r=froydnj
authorAlex Gaynor <agaynor@mozilla.com>
Mon, 27 Aug 2018 18:20:17 +0000
changeset 488679 8a38246f1a708ef0495415b1543d360f07d1ccd9
parent 488678 70767540914776745f09d26af6a4d20dfd15f855
child 488680 683aadc6686ec5fcfb6dadc5c7a831323e06be85
push id9734
push usershindli@mozilla.com
push dateThu, 30 Aug 2018 12:18:07 +0000
treeherdermozilla-beta@71c71ab3afae [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersfroydnj
bugs1486547
milestone63.0a1
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 1486547 - renamed the mState field on generated protocol classes; r=froydnj There's also a field named mState on IProtocol, and this reduces confusion. Differential Revision: https://phabricator.services.mozilla.com/D4356
ipc/glue/ProtocolUtils.cpp
ipc/glue/ProtocolUtils.h
ipc/ipdl/ipdl/lower.py
ipc/ipdl/test/cxx/PTestSyncHang.ipdl
--- a/ipc/glue/ProtocolUtils.cpp
+++ b/ipc/glue/ProtocolUtils.cpp
@@ -353,48 +353,48 @@ ArrayLengthReadError(const char* aElemen
 
 void
 SentinelReadError(const char* aClassName)
 {
   MOZ_CRASH_UNSAFE_PRINTF("incorrect sentinel when reading %s", aClassName);
 }
 
 bool
-StateTransition(bool aIsDelete, State* aNext)
+StateTransition(bool aIsDelete, LivenessState* aNext)
 {
   switch (*aNext) {
-    case State::Null:
+    case LivenessState::Null:
       if (aIsDelete) {
-        *aNext = State::Dead;
+        *aNext = LivenessState::Dead;
       }
       break;
-    case State::Dead:
+    case LivenessState::Dead:
       return false;
     default:
       return false;
   }
   return true;
 }
 
 bool
 ReEntrantDeleteStateTransition(bool aIsDelete,
                                bool aIsDeleteReply,
-                               ReEntrantDeleteState* aNext)
+                               ReEntrantDeleteLivenessState* aNext)
 {
   switch (*aNext) {
-    case ReEntrantDeleteState::Null:
+    case ReEntrantDeleteLivenessState::Null:
       if (aIsDelete) {
-        *aNext = ReEntrantDeleteState::Dying;
+        *aNext = ReEntrantDeleteLivenessState::Dying;
       }
       break;
-    case ReEntrantDeleteState::Dead:
+    case ReEntrantDeleteLivenessState::Dead:
       return false;
-    case ReEntrantDeleteState::Dying:
+    case ReEntrantDeleteLivenessState::Dying:
       if (aIsDeleteReply) {
-        *aNext = ReEntrantDeleteState::Dead;
+        *aNext = ReEntrantDeleteLivenessState::Dead;
       }
       break;
     default:
       return false;
   }
   return true;
 }
 
--- a/ipc/glue/ProtocolUtils.h
+++ b/ipc/glue/ProtocolUtils.h
@@ -768,38 +768,38 @@ DuplicateHandle(HANDLE aSourceHandle,
 #endif
 
 /**
  * Annotate the crash reporter with the error code from the most recent system
  * call. Returns the system error.
  */
 void AnnotateSystemError();
 
-enum class State
+enum class LivenessState
 {
   Dead,
   Null,
   Start = Null
 };
 
 bool
-StateTransition(bool aIsDelete, State* aNext);
+StateTransition(bool aIsDelete, LivenessState* aNext);
 
-enum class ReEntrantDeleteState
+enum class ReEntrantDeleteLivenessState
 {
   Dead,
   Null,
   Dying,
   Start = Null,
 };
 
 bool
 ReEntrantDeleteStateTransition(bool aIsDelete,
                                bool aIsDeleteReply,
-                               ReEntrantDeleteState* aNext);
+                               ReEntrantDeleteLivenessState* aNext);
 
 /**
  * An endpoint represents one end of a partially initialized IPDL channel. To
  * set up a new top-level protocol:
  *
  * Endpoint<PFooParent> parentEp;
  * Endpoint<PFooChild> childEp;
  * nsresult rv;
--- a/ipc/ipdl/ipdl/lower.py
+++ b/ipc/ipdl/ipdl/lower.py
@@ -148,17 +148,17 @@ def _actorHId(actorhandle):
     return ExprSelect(actorhandle, '.', 'mId')
 
 
 def _actorManager(actor):
     return ExprCall(ExprSelect(actor, '->', 'Manager'), args=[])
 
 
 def _actorState(actor):
-    return ExprSelect(actor, '->', 'mState')
+    return ExprSelect(actor, '->', 'mLivenessState')
 
 
 def _backstagePass():
     return ExprCall(ExprVar('mozilla::ipc::PrivateIPDLInterface'))
 
 
 def _iterType(ptr):
     return Type('PickleIterator', ptr=ptr)
@@ -1177,19 +1177,19 @@ def _subtreeUsesShmem(p):
         if ptype is not mgd:
             if _subtreeUsesShmem(mgd._ast):
                 return True
     return False
 
 
 def _stateType(hasReentrantDelete):
     if hasReentrantDelete:
-        return Type('mozilla::ipc::ReEntrantDeleteState')
+        return Type('mozilla::ipc::ReEntrantDeleteLivenessState')
     else:
-        return Type('mozilla::ipc::State')
+        return Type('mozilla::ipc::LivenessState')
 
 
 def _startState(hasReentrantDelete):
     pfx = _stateType(hasReentrantDelete).name + '::'
     return ExprVar(pfx + 'Start')
 
 
 class Protocol(ipdl.ast.Protocol):
@@ -1305,18 +1305,18 @@ class Protocol(ipdl.ast.Protocol):
         if self.decl.type.isToplevel():
             return ExprVar('MSG_ROUTING_CONTROL')
         if actorThis is not None:
             return ExprCall(ExprSelect(actorThis, '->', 'Id'))
         return ExprCall(ExprVar('Id'))
 
     def stateVar(self, actorThis=None):
         if actorThis is not None:
-            return ExprSelect(actorThis, '->', 'mState')
-        return ExprVar('mState')
+            return ExprSelect(actorThis, '->', 'mLivenessState')
+        return ExprVar('mLivenessState')
 
     def fqStateType(self):
         return _stateType(self.decl.type.hasReentrantDelete)
 
     def startState(self):
         return _startState(self.decl.type.hasReentrantDelete)
 
     def nullState(self):
@@ -3459,17 +3459,17 @@ class _GenerateProtocolActorCode(ipdl.as
 
                 method.addstmts([routedecl, routeif, Whitespace.NL])
 
             # in the event of an Interrupt delete message, we want to loudly complain about
             # messages that are received that are not a reply to the original message
             if ptype.hasReentrantDelete:
                 msgVar = ExprVar(params[0].name)
                 ifdying = StmtIf(ExprBinary(
-                    ExprBinary(ExprVar('mState'), '==', self.protocol.dyingState()),
+                    ExprBinary(ExprVar('mLivenessState'), '==', self.protocol.dyingState()),
                     '&&',
                     ExprBinary(
                         ExprBinary(ExprCall(ExprSelect(msgVar, '.', 'is_reply')),
                                    '!=', ExprLiteral.TRUE),
                         '||',
                         ExprBinary(ExprCall(ExprSelect(msgVar, '.', 'is_interrupt')),
                                    '!=', ExprLiteral.TRUE))))
                 ifdying.addifstmts([
--- a/ipc/ipdl/test/cxx/PTestSyncHang.ipdl
+++ b/ipc/ipdl/test/cxx/PTestSyncHang.ipdl
@@ -2,15 +2,15 @@
 namespace mozilla {
 namespace _ipdltest {
 
 
 protocol PTestSyncHang {
 
 child:
     // Add this unused message so we don't get compiler errors
-    // complaining that mState is an unused private field.
+    // complaining that mLivenessState is an unused private field.
     async UnusedMessage();
 };
 
 
 } // namespace mozilla
 } // namespace _ipdltest