зеркало из https://github.com/mozilla/gecko-dev.git
Bug 836198: Create a "zombie" state for PresShell and use it for the preloaded TabChild PresShell. r=bz
This commit is contained in:
Родитель
81075674d3
Коммит
1e70773735
|
@ -136,6 +136,19 @@ TabChild::PreloadSlowThings()
|
|||
tab->TryCacheLoadAndCompileScript(BROWSER_ELEMENT_CHILD_SCRIPT);
|
||||
tab->RecvLoadRemoteScript(NS_LITERAL_STRING("chrome://global/content/preload.js"));
|
||||
|
||||
nsCOMPtr<nsIDocShell> docShell = do_GetInterface(tab->mWebNav);
|
||||
nsCOMPtr<nsIPresShell> presShell;
|
||||
if (nsIPresShell* presShell = docShell->GetPresShell()) {
|
||||
// Initialize and do an initial reflow of the about:blank
|
||||
// PresShell to let it preload some things for us.
|
||||
presShell->Initialize(0, 0);
|
||||
nsIDocument* doc = presShell->GetDocument();
|
||||
doc->FlushPendingNotifications(Flush_Layout);
|
||||
// ... but after it's done, make sure it doesn't do any more
|
||||
// work.
|
||||
presShell->MakeZombie();
|
||||
}
|
||||
|
||||
sPreallocatedTab = tab;
|
||||
ClearOnShutdown(&sPreallocatedTab);
|
||||
}
|
||||
|
|
|
@ -71,9 +71,6 @@
|
|||
Cc["@mozilla.org/uriloader;1"].getService(Ci["nsIURILoader"]);
|
||||
|
||||
docShell.isActive = false;
|
||||
docShell.QueryInterface(Ci.nsIWebNavigation)
|
||||
.loadURI("about:blank",
|
||||
Ci.nsIWebNavigation.LOAD_FLAGS_NONE,
|
||||
null, null, null);
|
||||
docShell.createAboutBlankContentViewer(null);
|
||||
|
||||
})();
|
||||
|
|
|
@ -120,10 +120,10 @@ typedef struct CapturingContentInfo {
|
|||
nsIContent* mContent;
|
||||
} CapturingContentInfo;
|
||||
|
||||
// 0841d094-debf-4255-bc7c-c6ff638b2c83
|
||||
// da75e297-2c23-43c4-8d7f-96a668e96ba9
|
||||
#define NS_IPRESSHELL_IID \
|
||||
{ 0x0841d094, 0xdebf, 0x4255, \
|
||||
{ 0xbc, 0x7c, 0xc6, 0xff, 0x63, 0x8b, 0x2c, 0x83 } }
|
||||
{ 0xda75e297, 0x2c23, 0x43c4, \
|
||||
{ 0x8d, 0x7f, 0x96, 0xa6, 0x68, 0xe9, 0x6b, 0xa9 } }
|
||||
|
||||
// debug VerifyReflow flags
|
||||
#define VERIFY_REFLOW_ON 0x01
|
||||
|
@ -193,6 +193,18 @@ public:
|
|||
|
||||
bool IsDestroying() { return mIsDestroying; }
|
||||
|
||||
/**
|
||||
* Make a one-way transition into a "zombie" state. In this state,
|
||||
* no reflow is done, no painting is done, and no refresh driver
|
||||
* ticks are processed. This is a dangerous state: it can leave
|
||||
* areas of the composition target unpainted if callers aren't
|
||||
* careful. (Don't let your zombie presshell out of the shed.)
|
||||
*
|
||||
* This is used in cases where a presshell is created for reasons
|
||||
* other than reflow/painting.
|
||||
*/
|
||||
virtual NS_HIDDEN_(void) MakeZombie() = 0;
|
||||
|
||||
/**
|
||||
* All frames owned by the shell are allocated from an arena. They
|
||||
* are also recycled using free lists. Separate free lists are
|
||||
|
@ -1431,6 +1443,7 @@ protected:
|
|||
bool mStylesHaveChanged : 1;
|
||||
bool mDidInitialize : 1;
|
||||
bool mIsDestroying : 1;
|
||||
bool mIsZombie : 1;
|
||||
bool mIsReflowing : 1;
|
||||
|
||||
// For all documents we initially lock down painting.
|
||||
|
|
|
@ -1114,6 +1114,13 @@ PresShell::Destroy()
|
|||
mHaveShutDown = true;
|
||||
}
|
||||
|
||||
void
|
||||
PresShell::MakeZombie()
|
||||
{
|
||||
mIsZombie = true;
|
||||
CancelAllPendingReflows();
|
||||
}
|
||||
|
||||
void
|
||||
nsIPresShell::SetAuthorStyleDisabled(bool aStyleDisabled)
|
||||
{
|
||||
|
@ -3762,6 +3769,10 @@ PresShell::FlushPendingNotifications(mozFlushType aType)
|
|||
void
|
||||
PresShell::FlushPendingNotifications(mozilla::ChangesToFlush aFlush)
|
||||
{
|
||||
if (mIsZombie) {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* VERY IMPORTANT: If you add some sort of new flushing to this
|
||||
* method, make sure to add the relevant SetNeedLayoutFlush or
|
||||
|
@ -5293,7 +5304,7 @@ PresShell::Paint(nsView* aViewToPaint,
|
|||
NS_ASSERTION(!mIsDestroying, "painting a destroyed PresShell");
|
||||
NS_ASSERTION(aViewToPaint, "null view");
|
||||
|
||||
if (!mIsActive) {
|
||||
if (!mIsActive || mIsZombie) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -7484,6 +7495,10 @@ PresShell::ScheduleReflowOffTimer()
|
|||
bool
|
||||
PresShell::DoReflow(nsIFrame* target, bool aInterruptible)
|
||||
{
|
||||
if (mIsZombie) {
|
||||
return true;
|
||||
}
|
||||
|
||||
target->SchedulePaint();
|
||||
nsIFrame *parent = nsLayoutUtils::GetCrossDocParentFrame(target);
|
||||
while (parent) {
|
||||
|
@ -9139,10 +9154,12 @@ PresShell::SetIsActive(bool aIsActive)
|
|||
if (TabChild* tab = GetTabChildFrom(this)) {
|
||||
if (aIsActive) {
|
||||
tab->MakeVisible();
|
||||
if (nsIFrame* root = mFrameConstructor->GetRootFrame()) {
|
||||
FrameLayerBuilder::InvalidateAllLayersForFrame(
|
||||
nsLayoutUtils::GetDisplayRootFrame(root));
|
||||
root->SchedulePaint();
|
||||
if (!mIsZombie) {
|
||||
if (nsIFrame* root = mFrameConstructor->GetRootFrame()) {
|
||||
FrameLayerBuilder::InvalidateAllLayersForFrame(
|
||||
nsLayoutUtils::GetDisplayRootFrame(root));
|
||||
root->SchedulePaint();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
tab->MakeHidden();
|
||||
|
|
|
@ -74,6 +74,7 @@ public:
|
|||
nsStyleSet* aStyleSet,
|
||||
nsCompatibility aCompatMode);
|
||||
virtual NS_HIDDEN_(void) Destroy();
|
||||
virtual NS_HIDDEN_(void) MakeZombie();
|
||||
|
||||
virtual NS_HIDDEN_(nsresult) SetPreferenceStyleRules(bool aForceReflow);
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче