Bug 981261 part.3 Rename nsListenerType to nsEventListenerManager::Listener::ListenerType r=smaug
authorMasayuki Nakano <masayuki@d-toybox.com>
Mon, 17 Mar 2014 15:56:51 +0900
changeset 192079 4166d9d87a057565e674ea5b2361d7be613e49ca
parent 192078 95a8536c310a983b1e35fb10660d5ec1b13a3975
child 192080 e0b529437af0dbb7c127fb9a79df65df704f2ed3
push id474
push userasasaki@mozilla.com
push dateMon, 02 Jun 2014 21:01:02 +0000
treeherdermozilla-release@967f4cf1b31c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssmaug
bugs981261
milestone30.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 981261 part.3 Rename nsListenerType to nsEventListenerManager::Listener::ListenerType r=smaug
dom/events/nsEventListenerManager.cpp
dom/events/nsEventListenerManager.h
--- a/dom/events/nsEventListenerManager.cpp
+++ b/dom/events/nsEventListenerManager.cpp
@@ -254,23 +254,23 @@ nsEventListenerManager::AddEventListener
   listener->mListenerIsHandler = aHandler;
   listener->mHandlerIsString = false;
   listener->mAllEvents = aAllEvents;
 
   // Detect the type of event listener.
   nsCOMPtr<nsIXPConnectWrappedJS> wjs;
   if (aFlags.mListenerIsJSListener) {
     MOZ_ASSERT(!aListener.HasWebIDLCallback());
-    listener->mListenerType = eJSEventListener;
+    listener->mListenerType = Listener::eJSEventListener;
   } else if (aListener.HasWebIDLCallback()) {
-    listener->mListenerType = eWebIDLListener;
+    listener->mListenerType = Listener::eWebIDLListener;
   } else if ((wjs = do_QueryInterface(aListener.GetXPCOMCallback()))) {
-    listener->mListenerType = eWrappedJSListener;
+    listener->mListenerType = Listener::eWrappedJSListener;
   } else {
-    listener->mListenerType = eNativeListener;
+    listener->mListenerType = Listener::eNativeListener;
   }
 
 
   if (aFlags.mInSystemGroup) {
     mMayHaveSystemGroupListeners = true;
   }
   if (aFlags.mCapture) {
     mMayHaveCapturingListeners = true;
@@ -946,17 +946,17 @@ nsEventListenerManager::HandleEventSubTy
                                            nsIDOMEvent* aDOMEvent,
                                            EventTarget* aCurrentTarget)
 {
   nsresult result = NS_OK;
   EventListenerHolder listenerHolder(aListener->mListener);  // strong ref
 
   // If this is a script handler and we haven't yet
   // compiled the event handler itself
-  if ((aListener->mListenerType == eJSEventListener) &&
+  if ((aListener->mListenerType == Listener::eJSEventListener) &&
       aListener->mHandlerIsString) {
     result = CompileEventHandlerInternal(aListener, nullptr, nullptr);
     aListener = nullptr;
   }
 
   if (NS_SUCCEEDED(result)) {
     if (mIsMainThreadELM) {
       nsContentUtils::EnterMicroTask();
@@ -1182,17 +1182,17 @@ nsEventListenerManager::GetListenerInfo(
   nsCOMPtr<EventTarget> target = do_QueryInterface(mTarget);
   NS_ENSURE_STATE(target);
   aList->Clear();
   uint32_t count = mListeners.Length();
   for (uint32_t i = 0; i < count; ++i) {
     const Listener& listener = mListeners.ElementAt(i);
     // If this is a script handler and we haven't yet
     // compiled the event handler itself go ahead and compile it
-    if (listener.mListenerType == eJSEventListener &&
+    if (listener.mListenerType == Listener::eJSEventListener &&
         listener.mHandlerIsString) {
       CompileEventHandlerInternal(const_cast<Listener*>(&listener), nullptr,
                                   nullptr);
     }
     nsAutoString eventType;
     if (listener.mAllEvents) {
       eventType.SetIsVoid(true);
     } else {
@@ -1335,19 +1335,19 @@ nsEventListenerManager::MarkForCC()
     nsIJSEventListener* jsl = listener.GetJSListener();
     if (jsl) {
       if (jsl->GetHandler().HasEventHandler()) {
         JS::ExposeObjectToActiveJS(jsl->GetHandler().Ptr()->Callable());
       }
       if (JSObject* scope = jsl->GetEventScope()) {
         JS::ExposeObjectToActiveJS(scope);
       }
-    } else if (listener.mListenerType == eWrappedJSListener) {
+    } else if (listener.mListenerType == Listener::eWrappedJSListener) {
       xpc_TryUnmarkWrappedGrayObject(listener.mListener.GetXPCOMCallback());
-    } else if (listener.mListenerType == eWebIDLListener) {
+    } else if (listener.mListenerType == Listener::eWebIDLListener) {
       // Callback() unmarks gray
       listener.mListener.GetWebIDLCallback()->Callback();
     }
   }
   if (mRefCnt.IsPurple()) {
     mRefCnt.RemovePurple();
   }
 }
--- a/dom/events/nsEventListenerManager.h
+++ b/dom/events/nsEventListenerManager.h
@@ -140,39 +140,40 @@ inline EventListenerFlags AllEventsAtSys
   flags.mInSystemGroup = true;
   flags.mAllowUntrustedEvents = true;
   return flags;
 }
 
 } // namespace dom
 } // namespace mozilla
 
-typedef enum
-{
-    eNativeListener = 0,
-    eJSEventListener,
-    eWrappedJSListener,
-    eWebIDLListener,
-    eListenerTypeCount
-} nsListenerType;
-
 /*
  * Event listener manager
  */
 
 class nsEventListenerManager
 {
 public:
   struct Listener
   {
     mozilla::dom::EventListenerHolder mListener;
     nsCOMPtr<nsIAtom> mTypeAtom; // for the main thread
     nsString mTypeString; // for non-main-threads
     uint16_t mEventType;
+
+    enum ListenerType MOZ_ENUM_TYPE(uint8_t)
+    {
+      eNativeListener = 0,
+      eJSEventListener,
+      eWrappedJSListener,
+      eWebIDLListener,
+      eListenerTypeCount
+    };
     uint8_t mListenerType;
+
     bool mListenerIsHandler : 1;
     bool mHandlerIsString : 1;
     bool mAllEvents : 1;
 
     mozilla::dom::EventListenerFlags mFlags;
 
     nsIJSEventListener* GetJSListener() const
     {