Bug 1416384 - Part 3: Remove nsPIDOMWindow<nsISupports>, r=smaug

This was needed before as the base to nsGlobalWindow, but now that
nsGlobalWindow doesn't exist, and we only have specific versions, we no longer
need this type.

MozReview-Commit-ID: 6IJmJtnSkMr

--HG--
extra : rebase_source : d21068aa7da89a6d49ead2477b91577809f5856a
This commit is contained in:
Nika Layzell 2017-11-15 11:34:04 -05:00
parent a63b1e0ebd
commit 842c5cbb02
6 changed files with 31 additions and 48 deletions

View File

@ -906,21 +906,16 @@ IsInterval(const Optional<int32_t>& aTimeout, int32_t& aResultTimeout)
return false;
}
template<typename T>
mozilla::dom::TabGroup*
nsPIDOMWindow<T>::TabGroup()
nsPIDOMWindowInner::TabGroup()
{
if (IsInnerWindow()) {
nsGlobalWindowInner* globalWindow =
static_cast<nsGlobalWindowInner*>(
reinterpret_cast<nsPIDOMWindow<nsISupports>*>(this));
return globalWindow->TabGroupInner();
} else {
nsGlobalWindowOuter* globalWindow =
static_cast<nsGlobalWindowOuter*>(
reinterpret_cast<nsPIDOMWindow<nsISupports>*>(this));
return globalWindow->TabGroupOuter();
}
return nsGlobalWindowInner::Cast(this)->TabGroupInner();
}
mozilla::dom::TabGroup*
nsPIDOMWindowOuter::TabGroup()
{
return nsGlobalWindowOuter::Cast(this)->TabGroupOuter();
}
template<typename T>
@ -957,4 +952,3 @@ EnsurePrefCaches()
template class nsPIDOMWindow<mozIDOMWindowProxy>;
template class nsPIDOMWindow<mozIDOMWindow>;
template class nsPIDOMWindow<nsISupports>;

View File

@ -526,7 +526,7 @@ nsGlobalWindowInner::IsBackgroundInternal() const
//*****************************************************************************
nsGlobalWindowInner::nsGlobalWindowInner(nsGlobalWindowOuter *aOuterWindow)
: nsPIDOMWindow<nsISupports>(aOuterWindow->AsOuter()),
: nsPIDOMWindowInner(aOuterWindow->AsOuter()),
mIdleFuzzFactor(0),
mIdleCallbackIndex(-1),
mCurrentlyIdle(false),

View File

@ -214,18 +214,8 @@ ImplCycleCollectionTraverse(nsCycleCollectionTraversalCallback& aCallback,
// belonging to the same outer window, but that's an unimportant
// side effect of inheriting PRCList).
// NB: Currently nsPIDOMWindowInner and nsPIDOMWindowOuter are identical classes
// with identical member variables and identical vtables, that only differ in
// type name. nsGlobalWindow doesn't want to doubly inherit (and have two
// copies of everything), and it also doesn't want to privilege one over
// the other by making it possible to convert types through the C++ type system
// instead of our accessor methods (AsInner and AsOuter) that do dynamic
// checking. So we inherit from nsPIDOMWindow<nsISupports>, which is also
// identical to both nsPIDOMWindowInner and nsPIDOMWindowOuter, but not
// convertible to either.
class nsGlobalWindowInner : public mozilla::dom::EventTarget,
public nsPIDOMWindow<nsISupports>,
public nsPIDOMWindowInner,
private nsIDOMWindow,
// NOTE: This interface is private, as it's only
// implemented on chrome windows.
@ -251,12 +241,10 @@ public:
#endif
static nsGlobalWindowInner* Cast(nsPIDOMWindowInner* aPIWin) {
return static_cast<nsGlobalWindowInner*>(
reinterpret_cast<nsPIDOMWindow<nsISupports>*>(aPIWin));
return static_cast<nsGlobalWindowInner*>(aPIWin);
}
static const nsGlobalWindowInner* Cast(const nsPIDOMWindowInner* aPIWin) {
return static_cast<const nsGlobalWindowInner*>(
reinterpret_cast<const nsPIDOMWindow<nsISupports>*>(aPIWin));
return static_cast<const nsGlobalWindowInner*>(aPIWin);
}
static nsGlobalWindowInner* Cast(mozIDOMWindow* aWin) {
return Cast(nsPIDOMWindowInner::From(aWin));
@ -1695,6 +1683,8 @@ private:
friend class nsPIDOMWindow<mozIDOMWindowProxy>;
friend class nsPIDOMWindow<mozIDOMWindow>;
friend class nsPIDOMWindow<nsISupports>;
friend class nsPIDOMWindowInner;
friend class nsPIDOMWindowOuter;
mozilla::dom::TabGroup* TabGroupInner();
mozilla::dom::TabGroup* TabGroupOuter();

View File

@ -637,7 +637,7 @@ NewOuterWindowProxy(JSContext *cx, JS::Handle<JSObject*> global, bool isChrome)
//*****************************************************************************
nsGlobalWindowOuter::nsGlobalWindowOuter()
: nsPIDOMWindow<nsISupports>(nullptr),
: nsPIDOMWindowOuter(),
mIdleFuzzFactor(0),
mIdleCallbackIndex(-1),
mCurrentlyIdle(false),

View File

@ -206,18 +206,8 @@ private:
// belonging to the same outer window, but that's an unimportant
// side effect of inheriting PRCList).
// NB: Currently nsPIDOMWindowInner and nsPIDOMWindowOuter are identical classes
// with identical member variables and identical vtables, that only differ in
// type name. nsGlobalWindow doesn't want to doubly inherit (and have two
// copies of everything), and it also doesn't want to privilege one over
// the other by making it possible to convert types through the C++ type system
// instead of our accessor methods (AsInner and AsOuter) that do dynamic
// checking. So we inherit from nsPIDOMWindow<nsISupports>, which is also
// identical to both nsPIDOMWindowInner and nsPIDOMWindowOuter, but not
// convertible to either.
class nsGlobalWindowOuter : public mozilla::dom::EventTarget,
public nsPIDOMWindow<nsISupports>,
public nsPIDOMWindowOuter,
private nsIDOMWindow,
// NOTE: This interface is private, as it's only
// implemented on chrome windows.
@ -243,12 +233,10 @@ public:
#endif
static nsGlobalWindowOuter* Cast(nsPIDOMWindowOuter* aPIWin) {
return static_cast<nsGlobalWindowOuter*>(
reinterpret_cast<nsPIDOMWindow<nsISupports>*>(aPIWin));
return static_cast<nsGlobalWindowOuter*>(aPIWin);
}
static const nsGlobalWindowOuter* Cast(const nsPIDOMWindowOuter* aPIWin) {
return static_cast<const nsGlobalWindowOuter*>(
reinterpret_cast<const nsPIDOMWindow<nsISupports>*>(aPIWin));
return static_cast<const nsGlobalWindowOuter*>(aPIWin);
}
static nsGlobalWindowOuter* Cast(mozIDOMWindowProxy* aWin) {
return Cast(nsPIDOMWindowOuter::From(aWin));
@ -1685,6 +1673,8 @@ private:
friend class nsPIDOMWindow<mozIDOMWindowProxy>;
friend class nsPIDOMWindow<mozIDOMWindow>;
friend class nsPIDOMWindow<nsISupports>;
friend class nsPIDOMWindowInner;
friend class nsPIDOMWindowOuter;
mozilla::dom::TabGroup* TabGroupInner();
mozilla::dom::TabGroup* TabGroupOuter();

View File

@ -603,8 +603,6 @@ public:
virtual nsresult MoveBy(int32_t aXDif, int32_t aYDif) = 0;
virtual nsresult UpdateCommands(const nsAString& anAction, nsISelection* aSel, int16_t aReason) = 0;
mozilla::dom::TabGroup* TabGroup();
mozilla::dom::DocGroup* GetDocGroup() const;
virtual nsISerialEventTarget*
@ -769,6 +767,10 @@ class nsPIDOMWindowInner : public nsPIDOMWindow<mozIDOMWindow>
friend nsGlobalWindowInner;
friend nsGlobalWindowOuter;
explicit nsPIDOMWindowInner(nsPIDOMWindowOuter* aOuterWindow)
: nsPIDOMWindow<mozIDOMWindow>(aOuterWindow)
{}
public:
NS_DECLARE_STATIC_IID_ACCESSOR(NS_PIDOMWINDOWINNER_IID)
@ -941,6 +943,7 @@ public:
// timeout-throttling.
bool HasOpenWebSockets() const;
mozilla::dom::TabGroup* TabGroup();
protected:
void CreatePerformanceObjectIfNeeded();
};
@ -952,6 +955,10 @@ NS_DEFINE_STATIC_IID_ACCESSOR(nsPIDOMWindowInner, NS_PIDOMWINDOWINNER_IID)
class nsPIDOMWindowOuter : public nsPIDOMWindow<mozIDOMWindowProxy>
{
protected:
explicit nsPIDOMWindowOuter()
: nsPIDOMWindow<mozIDOMWindowProxy>(nullptr)
{}
void RefreshMediaElementsVolume();
void RefreshMediaElementsSuspend(SuspendTypes aSuspend);
bool IsDisposableSuspend(SuspendTypes aSuspend) const;
@ -1032,6 +1039,8 @@ public:
bool IsTopLevelWindow();
bool HadOriginalOpener() const;
mozilla::dom::TabGroup* TabGroup();
};
NS_DEFINE_STATIC_IID_ACCESSOR(nsPIDOMWindowOuter, NS_PIDOMWINDOWOUTER_IID)