Bug 1331509 - Extract a helper function to initialize the RenderFrameParent from TabParent. r=dvander

MozReview-Commit-ID: KMcpSQUax6z

--HG--
extra : rebase_source : e5e92eba2f61976712a0197a4a728d20ad43129e
This commit is contained in:
Kartikaya Gupta 2017-01-17 15:52:45 -05:00
Родитель 66033ff282
Коммит 169ad97fad
2 изменённых файлов: 31 добавлений и 20 удалений

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

@ -620,6 +620,29 @@ TabParent::LoadURL(nsIURI* aURI)
Unused << SendLoadURL(spec, GetShowInfo());
}
void
TabParent::InitRenderFrame()
{
if (IsInitedByParent()) {
// If TabParent is initialized by parent side then the RenderFrame must also
// be created here. If TabParent is initialized by child side,
// child side will create RenderFrame.
MOZ_ASSERT(!GetRenderFrame());
RefPtr<nsFrameLoader> frameLoader = GetFrameLoader();
if (frameLoader) {
bool success;
RenderFrameParent* renderFrame = new RenderFrameParent(frameLoader, &success);
uint64_t layersId = renderFrame->GetLayersId();
AddTabParentToTable(layersId, this);
Unused << SendPRenderFrameConstructor(renderFrame);
}
} else {
// Otherwise, the child should have constructed the RenderFrame,
// and we should already know about it.
MOZ_ASSERT(GetRenderFrame());
}
}
void
TabParent::Show(const ScreenIntSize& size, bool aParentIsActive)
{
@ -628,27 +651,13 @@ TabParent::Show(const ScreenIntSize& size, bool aParentIsActive)
return;
}
InitRenderFrame();
RenderFrameParent* renderFrame = IsInitedByParent() ? GetRenderFrame() : nullptr;
uint64_t layersId = renderFrame ? renderFrame->GetLayersId() : 0;
TextureFactoryIdentifier textureFactoryIdentifier;
uint64_t layersId = 0;
bool success = false;
RenderFrameParent* renderFrame = nullptr;
if (IsInitedByParent()) {
// If TabParent is initialized by parent side then the RenderFrame must also
// be created here. If TabParent is initialized by child side,
// child side will create RenderFrame.
MOZ_ASSERT(!GetRenderFrame());
RefPtr<nsFrameLoader> frameLoader = GetFrameLoader();
if (frameLoader) {
renderFrame = new RenderFrameParent(frameLoader, &success);
layersId = renderFrame->GetLayersId();
renderFrame->GetTextureFactoryIdentifier(&textureFactoryIdentifier);
AddTabParentToTable(layersId, this);
Unused << SendPRenderFrameConstructor(renderFrame);
}
} else {
// Otherwise, the child should have constructed the RenderFrame,
// and we should already know about it.
MOZ_ASSERT(GetRenderFrame());
if (renderFrame) {
renderFrame->GetTextureFactoryIdentifier(&textureFactoryIdentifier);
}
nsCOMPtr<nsISupports> container = mFrameElement->OwnerDoc()->GetContainer();

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

@ -368,6 +368,8 @@ public:
void LoadURL(nsIURI* aURI);
void InitRenderFrame();
// 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