Bug 1449631 part 13. Remove now-unnecessary forwarding macros. r=smaug
authorBoris Zbarsky <bzbarsky@mit.edu>
Thu, 05 Apr 2018 13:42:42 -0400
changeset 778083 d32c2aed28868ecd1d7aa1db701df5f07a256e07
parent 778082 27805d201b9009bf17a508dff2c840a2e919907f
child 778084 c880e315c1b39277ce526108e988fc975839518a
push id105383
push userbmo:gl@mozilla.com
push dateThu, 05 Apr 2018 20:22:58 +0000
reviewerssmaug
bugs1449631
milestone61.0a1
Bug 1449631 part 13. Remove now-unnecessary forwarding macros. r=smaug MozReview-Commit-ID: 6teO2KoGqUo
dom/base/DOMRequest.h
dom/base/ScreenOrientation.h
dom/base/nsDOMDataChannel.h
dom/base/nsScreen.h
dom/events/DOMEventTargetHelper.h
dom/media/DOMMediaStream.h
dom/media/webspeech/synth/SpeechSynthesisUtterance.h
dom/network/Connection.h
dom/network/UDPSocket.h
dom/xhr/XMLHttpRequestEventTarget.h
dom/xhr/XMLHttpRequestMainThread.h
dom/xhr/XMLHttpRequestUpload.h
--- a/dom/base/DOMRequest.h
+++ b/dom/base/DOMRequest.h
@@ -31,17 +31,16 @@ protected:
   JS::Heap<JS::Value> mResult;
   RefPtr<DOMException> mError;
   RefPtr<Promise> mPromise;
   bool mDone;
 
 public:
   NS_DECL_ISUPPORTS_INHERITED
   NS_DECL_NSIDOMDOMREQUEST
-  NS_REALLY_FORWARD_NSIDOMEVENTTARGET(DOMEventTargetHelper)
 
   NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS_INHERITED(DOMRequest,
                                                          DOMEventTargetHelper)
 
   // WrapperCache
   nsPIDOMWindowInner* GetParentObject() const
   {
     return GetOwner();
--- a/dom/base/ScreenOrientation.h
+++ b/dom/base/ScreenOrientation.h
@@ -35,17 +35,16 @@ class ScreenOrientation final : public D
                                 public mozilla::hal::ScreenConfigurationObserver
 {
   // nsScreen has deprecated API that shares implementation.
   friend class ::nsScreen;
 
 public:
   NS_DECL_ISUPPORTS_INHERITED
   NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(ScreenOrientation, mozilla::DOMEventTargetHelper)
-  NS_REALLY_FORWARD_NSIDOMEVENTTARGET(mozilla::DOMEventTargetHelper)
 
   IMPL_EVENT_HANDLER(change)
 
   ScreenOrientation(nsPIDOMWindowInner* aWindow, nsScreen* aScreen);
 
   already_AddRefed<Promise> Lock(OrientationLockType aOrientation,
                                  ErrorResult& aRv);
 
--- a/dom/base/nsDOMDataChannel.h
+++ b/dom/base/nsDOMDataChannel.h
@@ -29,18 +29,16 @@ class nsDOMDataChannel final : public mo
 public:
   nsDOMDataChannel(already_AddRefed<mozilla::DataChannel>& aDataChannel,
                    nsPIDOMWindowInner* aWindow);
 
   nsresult Init(nsPIDOMWindowInner* aDOMWindow);
 
   NS_DECL_ISUPPORTS_INHERITED
 
-  NS_REALLY_FORWARD_NSIDOMEVENTTARGET(mozilla::DOMEventTargetHelper)
-
   NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(nsDOMDataChannel,
                                            mozilla::DOMEventTargetHelper)
 
   // EventTarget
   using EventTarget::EventListenerAdded;
   virtual void EventListenerAdded(nsAtom* aType) override;
 
   using EventTarget::EventListenerRemoved;
--- a/dom/base/nsScreen.h
+++ b/dom/base/nsScreen.h
@@ -19,17 +19,16 @@ class nsDeviceContext;
 class nsScreen : public mozilla::DOMEventTargetHelper
 {
   typedef mozilla::ErrorResult ErrorResult;
 public:
   static already_AddRefed<nsScreen> Create(nsPIDOMWindowInner* aWindow);
 
   NS_DECL_ISUPPORTS_INHERITED
   NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(nsScreen, mozilla::DOMEventTargetHelper)
-  NS_REALLY_FORWARD_NSIDOMEVENTTARGET(mozilla::DOMEventTargetHelper)
 
   nsPIDOMWindowInner* GetParentObject() const
   {
     return GetOwner();
   }
 
   nsPIDOMWindowOuter* GetOuter() const;
 
--- a/dom/events/DOMEventTargetHelper.h
+++ b/dom/events/DOMEventTargetHelper.h
@@ -225,66 +225,9 @@ NS_DEFINE_STATIC_IID_ACCESSOR(DOMEventTa
   {                                                                       \
     if (NS_IsMainThread()) {                                              \
       SetEventHandler(nsGkAtoms::on##_event, EmptyString(), aCallback);   \
     } else {                                                              \
       SetEventHandler(nullptr, NS_LITERAL_STRING(#_event), aCallback);    \
     }                                                                     \
   }
 
-/* Use this macro to declare functions that forward the behavior of this
- * interface to another object.
- * This macro doesn't forward GetEventTargetParent because sometimes subclasses
- * want to override it.
- */
-#define NS_FORWARD_NSIDOMEVENTTARGET_NOGETEVENTTARGETPARENT(_to) \
-  NS_IMETHOD AddEventListener(const nsAString & type, nsIDOMEventListener *listener, bool useCapture, bool wantsUntrusted, uint8_t _argc) override { \
-    return _to AddEventListener(type, listener, useCapture, wantsUntrusted, _argc); \
-  } \
-  NS_IMETHOD AddSystemEventListener(const nsAString & type, nsIDOMEventListener *listener, bool aUseCapture, bool aWantsUntrusted, uint8_t _argc) override { \
-    return _to AddSystemEventListener(type, listener, aUseCapture, aWantsUntrusted, _argc); \
-  } \
-  NS_IMETHOD RemoveSystemEventListener(const nsAString & type, nsIDOMEventListener *listener, bool aUseCapture) override { \
-    return _to RemoveSystemEventListener(type, listener, aUseCapture); \
-  } \
-  NS_IMETHOD DispatchEvent(nsIDOMEvent *evt, bool *_retval) override { \
-    return _to DispatchEvent(evt, _retval); \
-  } \
-  virtual mozilla::dom::EventTarget* GetTargetForDOMEvent() { \
-    return _to GetTargetForDOMEvent(); \
-  } \
-  virtual mozilla::dom::EventTarget* GetTargetForEventTargetChain() { \
-    return _to GetTargetForEventTargetChain(); \
-  } \
-  virtual nsresult WillHandleEvent( \
-                     mozilla::EventChainPostVisitor & aVisitor) { \
-    return _to WillHandleEvent(aVisitor); \
-  } \
-  virtual nsresult PostHandleEvent( \
-                     mozilla::EventChainPostVisitor & aVisitor) { \
-    return _to PostHandleEvent(aVisitor); \
-  } \
-  virtual nsresult DispatchDOMEvent(mozilla::WidgetEvent* aEvent, nsIDOMEvent* aDOMEvent, nsPresContext* aPresContext, nsEventStatus* aEventStatus) { \
-    return _to DispatchDOMEvent(aEvent, aDOMEvent, aPresContext, aEventStatus); \
-  } \
-  virtual mozilla::EventListenerManager* GetOrCreateListenerManager() { \
-    return _to GetOrCreateListenerManager(); \
-  } \
-  virtual mozilla::EventListenerManager* GetExistingListenerManager() const { \
-    return _to GetExistingListenerManager(); \
-  } \
-  virtual nsIScriptContext * GetContextForEventHandlers(nsresult *aRv) { \
-    return _to GetContextForEventHandlers(aRv); \
-  }
-
-#define NS_REALLY_FORWARD_NSIDOMEVENTTARGET(_class) \
-  using _class::AddEventListener;                   \
-  NS_FORWARD_NSIDOMEVENTTARGET(_class::)            \
-  virtual mozilla::EventListenerManager*            \
-  GetOrCreateListenerManager() override {           \
-    return _class::GetOrCreateListenerManager();    \
-  }                                                 \
-  virtual mozilla::EventListenerManager*            \
-  GetExistingListenerManager() const override {     \
-    return _class::GetExistingListenerManager();    \
-  }
-
 #endif // mozilla_DOMEventTargetHelper_h_
--- a/dom/media/DOMMediaStream.h
+++ b/dom/media/DOMMediaStream.h
@@ -328,17 +328,16 @@ public:
     // externally. The owner is responsible for destroying the port.
     const InputPortOwnership mOwnership;
   };
 
   DOMMediaStream(nsPIDOMWindowInner* aWindow,
                  MediaStreamTrackSourceGetter* aTrackSourceGetter);
 
   NS_DECL_ISUPPORTS_INHERITED
-  NS_REALLY_FORWARD_NSIDOMEVENTTARGET(DOMEventTargetHelper)
   NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(DOMMediaStream,
                                            DOMEventTargetHelper)
   NS_DECLARE_STATIC_IID_ACCESSOR(NS_DOMMEDIASTREAM_IID)
 
   nsPIDOMWindowInner* GetParentObject() const
   {
     return mWindow;
   }
--- a/dom/media/webspeech/synth/SpeechSynthesisUtterance.h
+++ b/dom/media/webspeech/synth/SpeechSynthesisUtterance.h
@@ -28,17 +28,16 @@ class SpeechSynthesisUtterance final : p
   friend class nsSynthVoiceRegistry;
 
 public:
   SpeechSynthesisUtterance(nsPIDOMWindowInner* aOwnerWindow, const nsAString& aText);
 
   NS_DECL_ISUPPORTS_INHERITED
   NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(SpeechSynthesisUtterance,
                                            DOMEventTargetHelper)
-  NS_REALLY_FORWARD_NSIDOMEVENTTARGET(DOMEventTargetHelper)
 
   nsISupports* GetParentObject() const;
 
   JSObject* WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
 
   static
   already_AddRefed<SpeechSynthesisUtterance> Constructor(GlobalObject& aGlobal,
                                                          ErrorResult& aRv);
--- a/dom/network/Connection.h
+++ b/dom/network/Connection.h
@@ -28,18 +28,16 @@ namespace network {
 class Connection : public DOMEventTargetHelper
                  , public nsINetworkProperties
 {
 public:
   NS_DECL_ISUPPORTS_INHERITED
   NS_DECL_NSINETWORKPROPERTIES
   NS_DECL_OWNINGTHREAD
 
-  NS_REALLY_FORWARD_NSIDOMEVENTTARGET(DOMEventTargetHelper)
-
   static Connection*
   CreateForWindow(nsPIDOMWindowInner* aWindow);
 
   static already_AddRefed<Connection>
   CreateForWorker(WorkerPrivate* aWorkerPrivate,
                   ErrorResult& aRv);
 
   void Shutdown();
--- a/dom/network/UDPSocket.h
+++ b/dom/network/UDPSocket.h
@@ -38,17 +38,16 @@ class UDPSocket final : public DOMEventT
                       , public nsIUDPSocketListener
                       , public nsIUDPSocketInternal
 {
 public:
   NS_DECL_ISUPPORTS_INHERITED
   NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(UDPSocket, DOMEventTargetHelper)
   NS_DECL_NSIUDPSOCKETLISTENER
   NS_DECL_NSIUDPSOCKETINTERNAL
-  NS_REALLY_FORWARD_NSIDOMEVENTTARGET(DOMEventTargetHelper)
 
 public:
   nsPIDOMWindowInner*
   GetParentObject() const
   {
     return GetOwner();
   }
 
--- a/dom/xhr/XMLHttpRequestEventTarget.h
+++ b/dom/xhr/XMLHttpRequestEventTarget.h
@@ -23,17 +23,16 @@ protected:
   {}
 
   virtual ~XMLHttpRequestEventTarget() {}
 
 public:
   NS_DECL_ISUPPORTS_INHERITED
   NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(XMLHttpRequestEventTarget,
                                            DOMEventTargetHelper)
-  NS_REALLY_FORWARD_NSIDOMEVENTTARGET(DOMEventTargetHelper)
 
   IMPL_EVENT_HANDLER(loadstart)
   IMPL_EVENT_HANDLER(progress)
   IMPL_EVENT_HANDLER(abort)
   IMPL_EVENT_HANDLER(error)
   IMPL_EVENT_HANDLER(load)
   IMPL_EVENT_HANDLER(timeout)
   IMPL_EVENT_HANDLER(loadend)
--- a/dom/xhr/XMLHttpRequestMainThread.h
+++ b/dom/xhr/XMLHttpRequestMainThread.h
@@ -246,18 +246,16 @@ public:
 
   // nsINamed
   NS_DECL_NSINAMED
 
   // nsISizeOfEventTarget
   virtual size_t
     SizeOfEventTargetIncludingThis(MallocSizeOf aMallocSizeOf) const override;
 
-  NS_REALLY_FORWARD_NSIDOMEVENTTARGET(XMLHttpRequestEventTarget)
-
   // states
   virtual uint16_t ReadyState() const override;
 
   // request
   nsresult CreateChannel();
   nsresult InitiateFetch(already_AddRefed<nsIInputStream> aUploadStream,
                          int64_t aUploadLength,
                          nsACString& aUploadContentType);
--- a/dom/xhr/XMLHttpRequestUpload.h
+++ b/dom/xhr/XMLHttpRequestUpload.h
@@ -18,17 +18,16 @@ public:
   explicit XMLHttpRequestUpload(DOMEventTargetHelper* aOwner)
     : XMLHttpRequestEventTarget(aOwner)
   {}
 
   explicit XMLHttpRequestUpload()
   {}
 
   NS_DECL_ISUPPORTS_INHERITED
-  NS_REALLY_FORWARD_NSIDOMEVENTTARGET(XMLHttpRequestEventTarget)
 
   virtual JSObject*
   WrapObject(JSContext *cx, JS::Handle<JSObject*> aGivenProto) override;
 
   bool HasListeners()
   {
     return mListenerManager && mListenerManager->HasListeners();
   }