Bug 1172889 - Get current RenderFrameParent from TabParent directly. r=roc

This commit is contained in:
Kan-Ru Chen 2015-06-09 18:20:41 +08:00
parent 6b16f09b1f
commit 8f2a83c371
4 changed files with 17 additions and 36 deletions

View File

@ -151,7 +151,6 @@ nsFrameLoader::nsFrameLoader(Element* aOwner, bool aNetworkCreated)
, mClampScrollPosition(true)
, mObservingOwnerContent(false)
, mVisible(true)
, mCurrentRemoteFrame(nullptr)
, mRemoteBrowser(nullptr)
, mChildID(0)
, mEventMode(EVENT_MODE_NORMAL_DISPATCH)
@ -2223,11 +2222,20 @@ nsFrameLoader::TryRemoteBrowser()
}
mozilla::dom::PBrowserParent*
nsFrameLoader::GetRemoteBrowser()
nsFrameLoader::GetRemoteBrowser() const
{
return mRemoteBrowser;
}
RenderFrameParent*
nsFrameLoader::GetCurrentRemoteFrame() const
{
if (mRemoteBrowser) {
return mRemoteBrowser->GetRenderFrame();
}
return nullptr;
}
NS_IMETHODIMP
nsFrameLoader::ActivateRemoteFrame() {
if (mRemoteBrowser) {
@ -2530,7 +2538,6 @@ void
nsFrameLoader::SetRemoteBrowser(nsITabParent* aTabParent)
{
MOZ_ASSERT(!mRemoteBrowser);
MOZ_ASSERT(!mCurrentRemoteFrame);
mRemoteFrame = true;
mRemoteBrowser = TabParent::GetFrom(aTabParent);
mChildID = mRemoteBrowser ? mRemoteBrowser->Manager()->ChildID() : 0;

View File

@ -146,7 +146,7 @@ public:
nsIDocument* GetOwnerDoc() const
{ return mOwnerContent ? mOwnerContent->OwnerDoc() : nullptr; }
PBrowserParent* GetRemoteBrowser();
PBrowserParent* GetRemoteBrowser() const;
/**
* The "current" render frame is the one on which the most recent
@ -162,20 +162,8 @@ public:
* returned. (In-process <browser> behaves similarly, and this
* behavior seems desirable.)
*/
RenderFrameParent* GetCurrentRemoteFrame() const
{
return mCurrentRemoteFrame;
}
RenderFrameParent* GetCurrentRemoteFrame() const;
/**
* |aFrame| can be null. If non-null, it must be the remote frame
* on which the most recent layer transaction completed for this's
* <browser>.
*/
void SetCurrentRemoteFrame(RenderFrameParent* aFrame)
{
mCurrentRemoteFrame = aFrame;
}
nsFrameMessageManager* GetFrameMessageManager() { return mMessageManager; }
mozilla::dom::Element* GetOwnerContent() { return mOwnerContent; }
@ -186,10 +174,10 @@ public:
/**
* Tell this FrameLoader to use a particular remote browser.
*
* This will assert if mRemoteBrowser or mCurrentRemoteFrame is non-null. In
* practice, this means you can't have successfully run TryRemoteBrowser() on
* this object, which means you can't have called ShowRemoteFrame() or
* ReallyStartLoading().
* This will assert if mRemoteBrowser is non-null. In practice,
* this means you can't have successfully run TryRemoteBrowser() on
* this object, which means you can't have called ShowRemoteFrame()
* or ReallyStartLoading().
*/
void SetRemoteBrowser(nsITabParent* aTabParent);
@ -363,7 +351,6 @@ private:
// doesn't necessarily correlate with docshell/document visibility.
bool mVisible : 1;
RenderFrameParent* mCurrentRemoteFrame;
TabParent* mRemoteBrowser;
uint64_t mChildID;

View File

@ -427,6 +427,7 @@ public:
void TakeDragVisualization(RefPtr<mozilla::gfx::SourceSurface>& aSurface,
int32_t& aDragAreaX, int32_t& aDragAreaY);
layout::RenderFrameParent* GetRenderFrame();
protected:
bool ReceiveMessage(const nsString& aMessage,
bool aSync,
@ -480,7 +481,6 @@ protected:
private:
already_AddRefed<nsFrameLoader> GetFrameLoader(bool aUseCachedFrameLoaderAfterDestroy = false) const;
layout::RenderFrameParent* GetRenderFrame();
nsRefPtr<nsIContentParent> mManager;
void TryCacheDPIAndScale();

View File

@ -338,8 +338,6 @@ RenderFrameParent::RenderFrameParent(nsFrameLoader* aFrameLoader,
mLayersId = *aId;
CompositorChild::Get()->SendNotifyChildCreated(mLayersId);
}
// Set a default RenderFrameParent
mFrameLoader->SetCurrentRemoteFrame(this);
*aSuccess = true;
}
@ -454,15 +452,6 @@ RenderFrameParent::ActorDestroy(ActorDestroyReason why)
}
}
if (mFrameLoader && mFrameLoader->GetCurrentRemoteFrame() == this) {
// XXX this might cause some weird issues ... we'll just not
// redraw the part of the window covered by this until the "next"
// remote frame has a layer-tree transaction. For
// why==NormalShutdown, we'll definitely want to do something
// better, especially as nothing guarantees another Update() from
// the "next" remote layer tree.
mFrameLoader->SetCurrentRemoteFrame(nullptr);
}
mFrameLoader = nullptr;
}
@ -490,8 +479,6 @@ RenderFrameParent::RecvUpdateHitRegion(const nsRegion& aRegion)
void
RenderFrameParent::TriggerRepaint()
{
mFrameLoader->SetCurrentRemoteFrame(this);
nsIFrame* docFrame = mFrameLoader->GetPrimaryFrameOfOwningContent();
if (!docFrame) {
// Bad, but nothing we can do about it (XXX/cjones: or is there?