Bug 1350436 - DocGroup should not inherit from Dispatcher (r=froydnj)
authorBill McCloskey <billm@mozilla.com>
Mon, 03 Apr 2017 16:28:58 -0700
changeset 560282 2e1cf27870806c50856d4b49f1d40e45ce8a49ac
parent 560281 7509b5c557ee81e23b6970c98db2b903e874b022
child 560283 1ff47d6ae913a460e61906e1bd7c1beef17c310c
push id53365
push userjichen@mozilla.com
push dateTue, 11 Apr 2017 08:35:12 +0000
reviewersfroydnj
bugs1350436
milestone55.0a1
Bug 1350436 - DocGroup should not inherit from Dispatcher (r=froydnj) MozReview-Commit-ID: 2oxHkcRjrSM
docshell/base/nsDocShell.cpp
dom/base/DocGroup.cpp
dom/base/DocGroup.h
--- a/docshell/base/nsDocShell.cpp
+++ b/docshell/base/nsDocShell.cpp
@@ -420,17 +420,17 @@ public:
   nsPingListener()
   {
   }
 
   void SetLoadGroup(nsILoadGroup* aLoadGroup) {
     mLoadGroup = aLoadGroup;
   }
 
-  nsresult StartTimeout(Dispatcher* aDispatcher);
+  nsresult StartTimeout(DocGroup* aDocGroup);
 
 private:
   ~nsPingListener();
 
   nsCOMPtr<nsILoadGroup> mLoadGroup;
   nsCOMPtr<nsITimer> mTimer;
 };
 
@@ -440,22 +440,22 @@ nsPingListener::~nsPingListener()
 {
   if (mTimer) {
     mTimer->Cancel();
     mTimer = nullptr;
   }
 }
 
 nsresult
-nsPingListener::StartTimeout(Dispatcher* aDispatcher)
-{
-  NS_ENSURE_ARG(aDispatcher);
+nsPingListener::StartTimeout(DocGroup* aDocGroup)
+{
+  NS_ENSURE_ARG(aDocGroup);
 
   nsCOMPtr<nsITimer> timer = do_CreateInstance(NS_TIMER_CONTRACTID);
-  timer->SetTarget(aDispatcher->EventTargetFor(TaskCategory::Network));
+  timer->SetTarget(aDocGroup->EventTargetFor(TaskCategory::Network));
 
   if (timer) {
     nsresult rv = timer->InitWithFuncCallback(OnPingTimeout, mLoadGroup,
                                               PING_TIMEOUT,
                                               nsITimer::TYPE_ONE_SHOT);
     if (NS_SUCCEEDED(rv)) {
       mTimer = timer;
       return NS_OK;
--- a/dom/base/DocGroup.cpp
+++ b/dom/base/DocGroup.cpp
@@ -65,17 +65,17 @@ DocGroup::Dispatch(const char* aName,
 
 nsIEventTarget*
 DocGroup::EventTargetFor(TaskCategory aCategory) const
 {
   return mTabGroup->EventTargetFor(aCategory);
 }
 
 AbstractThread*
-DocGroup::AbstractMainThreadForImpl(TaskCategory aCategory)
+DocGroup::AbstractMainThreadFor(TaskCategory aCategory)
 {
   MOZ_RELEASE_ASSERT(NS_IsMainThread());
   return mTabGroup->AbstractMainThreadFor(aCategory);
 }
 
 bool*
 DocGroup::GetValidAccessPtr()
 {
--- a/dom/base/DocGroup.h
+++ b/dom/base/DocGroup.h
@@ -31,23 +31,23 @@ namespace dom {
 //
 // A TabGroup is a set of browsing contexts which are all "related". Within a
 // TabGroup, browsing contexts are broken into "similar-origin" DocGroups. In
 // more detail, a DocGroup is actually a collection of documents, and a
 // TabGroup is a collection of DocGroups. A TabGroup typically will contain
 // (through its DocGroups) the documents from one or more tabs related by
 // window.opener. A DocGroup is a member of exactly one TabGroup.
 
-class DocGroup final : public Dispatcher
+class DocGroup final
 {
 public:
   typedef nsTArray<nsIDocument*>::iterator Iterator;
   friend class TabGroup;
 
-  NS_INLINE_DECL_THREADSAFE_REFCOUNTING(DocGroup, override)
+  NS_INLINE_DECL_THREADSAFE_REFCOUNTING(DocGroup)
 
   // Returns NS_ERROR_FAILURE and sets |aString| to an empty string if the TLD
   // service isn't available. Returns NS_OK on success, but may still set
   // |aString| may still be set to an empty string.
   static MOZ_MUST_USE nsresult
   GetKey(nsIPrincipal* aPrincipal, nsACString& aString);
 
   bool MatchesKey(const nsACString& aKey)
@@ -76,37 +76,37 @@ public:
     return mDocuments.begin();
   }
   Iterator end()
   {
     MOZ_ASSERT(NS_IsMainThread());
     return mDocuments.end();
   }
 
-  virtual nsresult Dispatch(const char* aName,
-                            TaskCategory aCategory,
-                            already_AddRefed<nsIRunnable>&& aRunnable) override;
+  nsresult Dispatch(const char* aName,
+                    TaskCategory aCategory,
+                    already_AddRefed<nsIRunnable>&& aRunnable);
 
-  virtual nsIEventTarget* EventTargetFor(TaskCategory aCategory) const override;
+  nsIEventTarget* EventTargetFor(TaskCategory aCategory) const;
+
+  AbstractThread*
+  AbstractMainThreadFor(TaskCategory aCategory);
 
   // Ensure that it's valid to access the DocGroup at this time.
   void ValidateAccess() const
   {
     mTabGroup->ValidateAccess();
   }
 
   // Return a pointer that can be continually checked to see if access to this
   // DocGroup is valid. This pointer should live at least as long as the
   // DocGroup.
   bool* GetValidAccessPtr();
 
 private:
-  virtual AbstractThread*
-  AbstractMainThreadForImpl(TaskCategory aCategory) override;
-
   DocGroup(TabGroup* aTabGroup, const nsACString& aKey);
   ~DocGroup();
 
   nsCString mKey;
   RefPtr<TabGroup> mTabGroup;
   nsTArray<nsIDocument*> mDocuments;
   RefPtr<mozilla::dom::CustomElementReactionsStack> mReactionsStack;
 };