Bug 1525720, part 1 - Allow calling BrowserParent::InitRendering multiple times, and remove RenderFrame dependency from nsFrameLoader. r=kats

This cleanup will simplify refactoring nsFrameLoader later.

Differential Revision: https://phabricator.services.mozilla.com/D31429

--HG--
extra : source : 00d83f1d02e015735d580045524eceeeccdc4e28
This commit is contained in:
Ryan Hunt 2019-04-24 22:36:27 -05:00
parent a745ec6099
commit ce59f54daf
3 changed files with 12 additions and 15 deletions

View File

@ -1063,15 +1063,10 @@ bool nsFrameLoader::ShowRemoteFrame(const ScreenIntSize& size,
return true;
}
RenderFrame* rf =
mBrowserParent ? mBrowserParent->GetRenderFrame() : nullptr;
if (!rf || !rf->AttachLayerManager()) {
// This is just not going to work.
if (!mBrowserParent->Show(
size, ParentWindowIsActive(mOwnerContent->OwnerDoc()))) {
return false;
}
mBrowserParent->Show(size, ParentWindowIsActive(mOwnerContent->OwnerDoc()));
mRemoteBrowserShown = true;
nsCOMPtr<nsIObserverService> os = services::GetObserverService();

View File

@ -884,9 +884,10 @@ void BrowserParent::ResumeLoad(uint64_t aPendingSwitchID) {
}
void BrowserParent::InitRendering() {
MOZ_ASSERT(!mRenderFrame.IsInitialized());
if (mRenderFrame.IsInitialized()) {
return;
}
mRenderFrame.Initialize(this);
MOZ_ASSERT(mRenderFrame.IsInitialized());
layers::LayersId layersId = mRenderFrame.GetLayersId();
AddBrowserParentToTable(layersId, this);
@ -906,13 +907,16 @@ void BrowserParent::MaybeShowFrame() {
frameLoader->MaybeShowFrame();
}
void BrowserParent::Show(const ScreenIntSize& size, bool aParentIsActive) {
bool BrowserParent::Show(const ScreenIntSize& size, bool aParentIsActive) {
mDimensions = size;
if (mIsDestroyed) {
return;
return false;
}
MOZ_ASSERT(mRenderFrame.IsInitialized());
if (!mRenderFrame.AttachLayerManager()) {
return false;
}
nsCOMPtr<nsISupports> container = mFrameElement->OwnerDoc()->GetContainer();
nsCOMPtr<nsIBaseWindow> baseWindow = do_QueryInterface(container);
@ -921,6 +925,7 @@ void BrowserParent::Show(const ScreenIntSize& size, bool aParentIsActive) {
mSizeMode = mainWidget ? mainWidget->SizeMode() : nsSizeMode_Normal;
Unused << SendShow(size, GetShowInfo(), aParentIsActive, mSizeMode);
return true;
}
mozilla::ipc::IPCResult BrowserParent::RecvSetDimensions(const uint32_t& aFlags,

View File

@ -463,10 +463,7 @@ class BrowserParent final : public PBrowserParent,
void InitRendering();
void MaybeShowFrame();
// XXX/cjones: it's not clear what we gain by hiding these
// message-sending functions under a layer of indirection and
// eating the return values
void Show(const ScreenIntSize& aSize, bool aParentIsActive);
bool Show(const ScreenIntSize& aSize, bool aParentIsActive);
void UpdateDimensions(const nsIntRect& aRect, const ScreenIntSize& aSize);