Bug 1308459 - Rename RefreshDriver::PresContext() to hint about its behavior, r=tnikkel

--HG--
extra : rebase_source : 50cf1fd7f1ee052e182ae3fa84ce8648e46143cd
This commit is contained in:
Olli Pettay 2016-10-12 14:27:38 +03:00
Родитель 19d5482c9c
Коммит 97b9917978
5 изменённых файлов: 20 добавлений и 15 удалений

Просмотреть файл

@ -987,7 +987,7 @@ nsPresContext::DetachShell()
mRestyleManager->Disconnect();
mRestyleManager = nullptr;
}
if (mRefreshDriver && mRefreshDriver->PresContext() == this) {
if (mRefreshDriver && mRefreshDriver->GetPresContext() == this) {
mRefreshDriver->Disconnect();
// Can't null out the refresh driver here.
}

Просмотреть файл

@ -134,7 +134,8 @@ class nsRootPresContext;
// An interface for presentation contexts. Presentation contexts are
// objects that provide an outer context for a presentation shell.
class nsPresContext : public nsIObserver {
class nsPresContext : public nsIObserver,
public mozilla::SupportsWeakPtr<nsPresContext> {
public:
typedef mozilla::FramePropertyTable FramePropertyTable;
typedef mozilla::LangGroupFontPrefs LangGroupFontPrefs;
@ -145,6 +146,7 @@ public:
NS_DECL_NSIOBSERVER
NS_DECL_AND_IMPL_ZEROING_OPERATOR_NEW
NS_DECL_CYCLE_COLLECTION_CLASS(nsPresContext)
MOZ_DECLARE_WEAKREFERENCE_TYPENAME(nsPresContext)
enum nsPresContextType {
eContext_Galley, // unpaginated screen presentation

Просмотреть файл

@ -1295,7 +1295,7 @@ PresShell::Destroy()
mHiddenInvalidationObserverRefreshDriver->RemovePresShellToInvalidateIfHidden(this);
}
if (rd->PresContext() == GetPresContext()) {
if (rd->GetPresContext() == GetPresContext()) {
rd->RevokeViewManagerFlush();
}
@ -8997,7 +8997,7 @@ PresShell::Freeze()
nsPresContext* presContext = GetPresContext();
if (presContext &&
presContext->RefreshDriver()->PresContext() == presContext) {
presContext->RefreshDriver()->GetPresContext() == presContext) {
presContext->RefreshDriver()->Freeze();
}
@ -9055,7 +9055,7 @@ PresShell::Thaw()
{
nsPresContext* presContext = GetPresContext();
if (presContext &&
presContext->RefreshDriver()->PresContext() == presContext) {
presContext->RefreshDriver()->GetPresContext() == presContext) {
presContext->RefreshDriver()->Thaw();
}
@ -10911,7 +10911,7 @@ PresShell::SetIsActive(bool aIsActive)
nsPresContext* presContext = GetPresContext();
if (presContext &&
presContext->RefreshDriver()->PresContext() == presContext) {
presContext->RefreshDriver()->GetPresContext() == presContext) {
presContext->RefreshDriver()->SetThrottled(!mIsActive);
}
@ -11142,7 +11142,7 @@ nsIPresShell::FontSizeInflationEnabled()
void
PresShell::PausePainting()
{
if (GetPresContext()->RefreshDriver()->PresContext() != GetPresContext())
if (GetPresContext()->RefreshDriver()->GetPresContext() != GetPresContext())
return;
mPaintingIsFrozen = true;
@ -11152,7 +11152,7 @@ PresShell::PausePainting()
void
PresShell::ResumePainting()
{
if (GetPresContext()->RefreshDriver()->PresContext() != GetPresContext())
if (GetPresContext()->RefreshDriver()->GetPresContext() != GetPresContext())
return;
mPaintingIsFrozen = false;

Просмотреть файл

@ -173,7 +173,8 @@ public:
NS_ASSERTION(mRootRefreshDrivers.Contains(aDriver), "RemoveRefreshDriver for a refresh driver that's not in the root refresh list!");
mRootRefreshDrivers.RemoveElement(aDriver);
} else {
nsPresContext* rootContext = aDriver->PresContext()->GetRootPresContext();
nsPresContext* pc = aDriver->GetPresContext();
nsPresContext* rootContext = pc ? pc->GetRootPresContext() : nullptr;
// During PresContext shutdown, we can't accurately detect
// if a root refresh driver exists or not. Therefore, we have to
// search and find out which list this driver exists in.
@ -227,7 +228,8 @@ protected:
bool IsRootRefreshDriver(nsRefreshDriver* aDriver)
{
nsPresContext* rootContext = aDriver->PresContext()->GetRootPresContext();
nsPresContext* pc = aDriver->GetPresContext();
nsPresContext* rootContext = pc ? pc->GetRootPresContext() : nullptr;
if (!rootContext) {
return false;
}
@ -2100,7 +2102,8 @@ nsRefreshDriver::IsWaitingForPaint(mozilla::TimeStamp aTime)
// Try find the 'root' refresh driver for the current window and check
// if that is waiting for a paint.
nsPresContext *rootContext = PresContext()->GetRootPresContext();
nsPresContext* pc = GetPresContext();
nsPresContext* rootContext = pc ? pc->GetRootPresContext() : nullptr;
if (rootContext) {
nsRefreshDriver *rootRefresh = rootContext->RefreshDriver();
if (rootRefresh && rootRefresh != this) {

Просмотреть файл

@ -14,7 +14,7 @@
#include "mozilla/TimeStamp.h"
#include "mozilla/Vector.h"
#include "mozilla/WeakPtr.h"
#include "mozFlushType.h"
#include "nsTObserverArray.h"
#include "nsTArray.h"
@ -273,7 +273,7 @@ public:
/**
* Return the prescontext we were initialized with
*/
nsPresContext* PresContext() const { return mPresContext; }
nsPresContext* GetPresContext() const { return mPresContext; }
/**
* PBackgroundChild actor is created asynchronously in content process.
@ -381,8 +381,8 @@ private:
ProfilerBacktrace* mReflowCause;
ProfilerBacktrace* mStyleCause;
nsPresContext *mPresContext; // weak; pres context passed in constructor
// and unset in Disconnect
// nsPresContext passed in constructor and unset in Disconnect.
mozilla::WeakPtr<nsPresContext> mPresContext;
RefPtr<nsRefreshDriver> mRootRefresh;