Bug 919878 - Fix abort in graphics code if content process shuts down quickly (r=mattwoodrow)

This commit is contained in:
Bill McCloskey 2014-01-15 13:10:39 -08:00
parent c04ea40fa3
commit 0f25ea7c0d
7 changed files with 69 additions and 44 deletions

View File

@ -227,9 +227,12 @@ parent:
* Create a layout frame (encapsulating a remote layer tree) for
* the page that is currently loaded in the <browser>.
*/
sync PRenderFrame()
sync PRenderFrame();
sync InitRenderFrame(PRenderFrame aFrame)
returns (ScrollingBehavior scrolling,
TextureFactoryIdentifier textureFactoryIdentifier, uint64_t layersId);
TextureFactoryIdentifier textureFactoryIdentifier, uint64_t layersId,
bool success);
/**
* Starts an offline application cache update.

View File

@ -2195,9 +2195,7 @@ TabChild::RecvSetUpdateHitRegion(const bool& aEnabled)
}
PRenderFrameChild*
TabChild::AllocPRenderFrameChild(ScrollingBehavior* aScrolling,
TextureFactoryIdentifier* aTextureFactoryIdentifier,
uint64_t* aLayersId)
TabChild::AllocPRenderFrameChild()
{
return new RenderFrameChild();
}
@ -2254,12 +2252,18 @@ TabChild::InitRenderingState()
static_cast<PuppetWidget*>(mWidget.get())->InitIMEState();
uint64_t id;
bool success;
RenderFrameChild* remoteFrame =
static_cast<RenderFrameChild*>(SendPRenderFrameConstructor(
&mScrolling, &mTextureFactoryIdentifier, &id));
static_cast<RenderFrameChild*>(SendPRenderFrameConstructor());
if (!remoteFrame) {
NS_WARNING("failed to construct RenderFrame");
return false;
NS_WARNING("failed to construct RenderFrame");
return false;
}
SendInitRenderFrame(remoteFrame, &mScrolling, &mTextureFactoryIdentifier, &id, &success);
if (!success) {
NS_WARNING("failed to construct RenderFrame");
PRenderFrameChild::Send__delete__(remoteFrame);
return false;
}
PLayerTransactionChild* shadowManager = nullptr;

View File

@ -367,9 +367,7 @@ public:
}
protected:
virtual PRenderFrameChild* AllocPRenderFrameChild(ScrollingBehavior* aScrolling,
TextureFactoryIdentifier* aTextureFactoryIdentifier,
uint64_t* aLayersId) MOZ_OVERRIDE;
virtual PRenderFrameChild* AllocPRenderFrameChild() MOZ_OVERRIDE;
virtual bool DeallocPRenderFrameChild(PRenderFrameChild* aFrame) MOZ_OVERRIDE;
virtual bool RecvDestroy() MOZ_OVERRIDE;
virtual bool RecvSetUpdateHitRegion(const bool& aEnabled) MOZ_OVERRIDE;

View File

@ -1525,23 +1525,36 @@ TabParent::HandleDelayedDialogs()
}
}
PRenderFrameParent*
TabParent::AllocPRenderFrameParent(ScrollingBehavior* aScrolling,
TextureFactoryIdentifier* aTextureFactoryIdentifier,
uint64_t* aLayersId)
bool
TabParent::RecvInitRenderFrame(PRenderFrameParent* aFrame,
ScrollingBehavior* aScrolling,
TextureFactoryIdentifier* aTextureFactoryIdentifier,
uint64_t* aLayersId,
bool *aSuccess)
{
MOZ_ASSERT(ManagedPRenderFrameParent().IsEmpty());
*aScrolling = UseAsyncPanZoom() ? ASYNC_PAN_ZOOM : DEFAULT_SCROLLING;
*aTextureFactoryIdentifier = TextureFactoryIdentifier();
*aLayersId = 0;
nsRefPtr<nsFrameLoader> frameLoader = GetFrameLoader();
if (!frameLoader) {
NS_WARNING("Can't allocate graphics resources, aborting subprocess");
return nullptr;
NS_WARNING("Can't allocate graphics resources. May already be shutting down.");
*aSuccess = false;
return true;
}
*aScrolling = UseAsyncPanZoom() ? ASYNC_PAN_ZOOM : DEFAULT_SCROLLING;
return new RenderFrameParent(frameLoader,
*aScrolling,
aTextureFactoryIdentifier, aLayersId);
static_cast<RenderFrameParent*>(aFrame)->Init(frameLoader, *aScrolling,
aTextureFactoryIdentifier, aLayersId);
*aSuccess = true;
return true;
}
PRenderFrameParent*
TabParent::AllocPRenderFrameParent()
{
MOZ_ASSERT(ManagedPRenderFrameParent().IsEmpty());
return new RenderFrameParent();
}
bool
@ -1692,10 +1705,7 @@ TabParent::RecvBrowserFrameOpenWindow(PBrowserParent* aOpener,
}
bool
TabParent::RecvPRenderFrameConstructor(PRenderFrameParent* actor,
ScrollingBehavior* scrolling,
TextureFactoryIdentifier* factoryIdentifier,
uint64_t* layersId)
TabParent::RecvPRenderFrameConstructor(PRenderFrameParent* actor)
{
return true;
}

View File

@ -112,10 +112,12 @@ public:
virtual bool RecvMoveFocus(const bool& aForward);
virtual bool RecvEvent(const RemoteDOMEvent& aEvent);
virtual bool RecvPRenderFrameConstructor(PRenderFrameParent* actor,
ScrollingBehavior* scrolling,
TextureFactoryIdentifier* identifier,
uint64_t* layersId);
virtual bool RecvPRenderFrameConstructor(PRenderFrameParent* actor);
virtual bool RecvInitRenderFrame(PRenderFrameParent* aFrame,
ScrollingBehavior* scrolling,
TextureFactoryIdentifier* identifier,
uint64_t* layersId,
bool *aSuccess);
virtual bool RecvBrowserFrameOpenWindow(PBrowserParent* aOpener,
const nsString& aURL,
const nsString& aName,
@ -312,9 +314,7 @@ protected:
bool ShouldDelayDialogs();
bool AllowContentIME();
virtual PRenderFrameParent* AllocPRenderFrameParent(ScrollingBehavior* aScrolling,
TextureFactoryIdentifier* aTextureFactoryIdentifier,
uint64_t* aLayersId) MOZ_OVERRIDE;
virtual PRenderFrameParent* AllocPRenderFrameParent() MOZ_OVERRIDE;
virtual bool DeallocPRenderFrameParent(PRenderFrameParent* aFrame) MOZ_OVERRIDE;
// IME

View File

@ -670,15 +670,21 @@ private:
ZoomConstraints mZoomConstraints;
};
RenderFrameParent::RenderFrameParent(nsFrameLoader* aFrameLoader,
ScrollingBehavior aScrollingBehavior,
TextureFactoryIdentifier* aTextureFactoryIdentifier,
uint64_t* aId)
RenderFrameParent::RenderFrameParent()
: mLayersId(0)
, mFrameLoader(aFrameLoader)
, mFrameLoaderDestroyed(false)
, mBackgroundColor(gfxRGBA(1, 1, 1))
{
}
void
RenderFrameParent::Init(nsFrameLoader* aFrameLoader,
ScrollingBehavior aScrollingBehavior,
TextureFactoryIdentifier* aTextureFactoryIdentifier,
uint64_t* aId)
{
mFrameLoader = aFrameLoader;
*aId = 0;
nsRefPtr<LayerManager> lm = GetFrom(mFrameLoader);

View File

@ -55,16 +55,20 @@ class RenderFrameParent : public PRenderFrameParent,
public:
typedef std::map<ViewID, nsRefPtr<nsContentView> > ViewMap;
/* Init should be called immediately after allocation. */
RenderFrameParent();
virtual ~RenderFrameParent();
/**
* Select the desired scrolling behavior. If ASYNC_PAN_ZOOM is
* chosen, then RenderFrameParent will watch input events and use
* them to asynchronously pan and zoom.
*/
RenderFrameParent(nsFrameLoader* aFrameLoader,
ScrollingBehavior aScrollingBehavior,
TextureFactoryIdentifier* aTextureFactoryIdentifier,
uint64_t* aId);
virtual ~RenderFrameParent();
void
Init(nsFrameLoader* aFrameLoader,
ScrollingBehavior aScrollingBehavior,
TextureFactoryIdentifier* aTextureFactoryIdentifier,
uint64_t* aId);
void Destroy();