Bug 1003041 - Merge PRenderFrame() and InitRenderFrame() to avoid extra sync child->parent messaging. r=billm

This commit is contained in:
Olli Pettay 2014-05-08 16:04:00 +02:00
Родитель 82bd55c1cf
Коммит cbcf60df5e
7 изменённых файлов: 53 добавлений и 60 удалений

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

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

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

@ -2379,7 +2379,10 @@ TabChild::RecvSetIsDocShellActive(const bool& aIsActive)
}
PRenderFrameChild*
TabChild::AllocPRenderFrameChild()
TabChild::AllocPRenderFrameChild(ScrollingBehavior* aScrolling,
TextureFactoryIdentifier* aTextureFactoryIdentifier,
uint64_t* aLayersId,
bool* aSuccess)
{
return new RenderFrameChild();
}
@ -2438,12 +2441,14 @@ TabChild::InitRenderingState()
uint64_t id;
bool success;
RenderFrameChild* remoteFrame =
static_cast<RenderFrameChild*>(SendPRenderFrameConstructor());
static_cast<RenderFrameChild*>(SendPRenderFrameConstructor(
&mScrolling,
&mTextureFactoryIdentifier, &id,
&success));
if (!remoteFrame) {
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);

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

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

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

@ -1740,36 +1740,19 @@ TabParent::DeallocPColorPickerParent(PColorPickerParent* actor)
return true;
}
bool
TabParent::RecvInitRenderFrame(PRenderFrameParent* aFrame,
ScrollingBehavior* aScrolling,
TextureFactoryIdentifier* aTextureFactoryIdentifier,
uint64_t* aLayersId,
bool *aSuccess)
{
*aScrolling = UseAsyncPanZoom() ? ASYNC_PAN_ZOOM : DEFAULT_SCROLLING;
*aTextureFactoryIdentifier = TextureFactoryIdentifier();
*aLayersId = 0;
nsRefPtr<nsFrameLoader> frameLoader = GetFrameLoader();
if (!frameLoader) {
NS_WARNING("Can't allocate graphics resources. May already be shutting down.");
*aSuccess = false;
return true;
}
static_cast<RenderFrameParent*>(aFrame)->Init(frameLoader, *aScrolling,
aTextureFactoryIdentifier, aLayersId);
*aSuccess = true;
return true;
}
PRenderFrameParent*
TabParent::AllocPRenderFrameParent()
TabParent::AllocPRenderFrameParent(ScrollingBehavior* aScrolling,
TextureFactoryIdentifier* aTextureFactoryIdentifier,
uint64_t* aLayersId, bool* aSuccess)
{
MOZ_ASSERT(ManagedPRenderFrameParent().IsEmpty());
return new RenderFrameParent();
nsRefPtr<nsFrameLoader> frameLoader = GetFrameLoader();
*aScrolling = UseAsyncPanZoom() ? ASYNC_PAN_ZOOM : DEFAULT_SCROLLING;
return new RenderFrameParent(frameLoader,
*aScrolling,
aTextureFactoryIdentifier, aLayersId,
aSuccess);
}
bool
@ -1919,7 +1902,11 @@ TabParent::RecvBrowserFrameOpenWindow(PBrowserParent* aOpener,
}
bool
TabParent::RecvPRenderFrameConstructor(PRenderFrameParent* actor)
TabParent::RecvPRenderFrameConstructor(PRenderFrameParent* aActor,
ScrollingBehavior* aScrolling,
TextureFactoryIdentifier* aFactoryIdentifier,
uint64_t* aLayersId,
bool* aSuccess)
{
return true;
}

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

@ -115,12 +115,11 @@ public:
virtual bool RecvMoveFocus(const bool& aForward) MOZ_OVERRIDE;
virtual bool RecvEvent(const RemoteDOMEvent& aEvent) MOZ_OVERRIDE;
virtual bool RecvReplyKeyEvent(const WidgetKeyboardEvent& event);
virtual bool RecvPRenderFrameConstructor(PRenderFrameParent* actor) MOZ_OVERRIDE;
virtual bool RecvInitRenderFrame(PRenderFrameParent* aFrame,
ScrollingBehavior* scrolling,
TextureFactoryIdentifier* identifier,
uint64_t* layersId,
bool *aSuccess) MOZ_OVERRIDE;
virtual bool RecvPRenderFrameConstructor(PRenderFrameParent* aActor,
ScrollingBehavior* aScrolling,
TextureFactoryIdentifier* aFactoryIdentifier,
uint64_t* aLayersId,
bool* aSuccess) MOZ_OVERRIDE;
virtual bool RecvBrowserFrameOpenWindow(PBrowserParent* aOpener,
const nsString& aURL,
const nsString& aName,
@ -328,7 +327,10 @@ protected:
bool AllowContentIME();
nsIntPoint GetChildProcessOffset();
virtual PRenderFrameParent* AllocPRenderFrameParent() MOZ_OVERRIDE;
virtual PRenderFrameParent* AllocPRenderFrameParent(ScrollingBehavior* aScrolling,
TextureFactoryIdentifier* aTextureFactoryIdentifier,
uint64_t* aLayersId,
bool* aSuccess) MOZ_OVERRIDE;
virtual bool DeallocPRenderFrameParent(PRenderFrameParent* aFrame) MOZ_OVERRIDE;
// IME

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

@ -704,20 +704,20 @@ private:
nsRegion mTouchSensitiveRegion;
};
RenderFrameParent::RenderFrameParent()
RenderFrameParent::RenderFrameParent(nsFrameLoader* aFrameLoader,
ScrollingBehavior aScrollingBehavior,
TextureFactoryIdentifier* aTextureFactoryIdentifier,
uint64_t* aId,
bool* aSuccess)
: 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;
*aSuccess = false;
if (!mFrameLoader) {
return;
}
*aId = 0;
@ -752,6 +752,7 @@ RenderFrameParent::Init(nsFrameLoader* aFrameLoader,
}
// Set a default RenderFrameParent
mFrameLoader->SetCurrentRemoteFrame(this);
*aSuccess = true;
}
APZCTreeManager*

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

@ -55,20 +55,17 @@ 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.
*/
void
Init(nsFrameLoader* aFrameLoader,
ScrollingBehavior aScrollingBehavior,
TextureFactoryIdentifier* aTextureFactoryIdentifier,
uint64_t* aId);
RenderFrameParent(nsFrameLoader* aFrameLoader,
ScrollingBehavior aScrollingBehavior,
TextureFactoryIdentifier* aTextureFactoryIdentifier,
uint64_t* aId, bool* aSuccess);
virtual ~RenderFrameParent();
void Destroy();