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 : rebase_source : 416d91a0119c4df11faf73076fb425bb0471a48e
extra : histedit_source : 62cc6bc346b2b961860b3e070fd34ca69b9cf0e0
This commit is contained in:
Ryan Hunt 2019-04-24 22:36:27 -05:00
Родитель 16671b371f
Коммит b3a1c0edb7
3 изменённых файлов: 12 добавлений и 15 удалений

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

@ -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();

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

@ -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,

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

@ -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);