Bug 1347035 - Store the maximum touch points for each tab child on the object instead of querying it synchronously from the parent actor when neeeded; r=smaug ipc-r=kanru

This commit is contained in:
Ehsan Akhgari 2017-03-14 19:48:41 -04:00
Родитель 691628a34e
Коммит 1040ee9f65
11 изменённых файлов: 37 добавлений и 45 удалений

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

@ -825,6 +825,7 @@ ContentChild::ProvideWindowCommon(TabChild* aTabOpener,
TextureFactoryIdentifier textureFactoryIdentifier;
uint64_t layersId = 0;
CompositorOptions compositorOptions;
uint32_t maxTouchPoints = 0;
if (aIframeMoz) {
MOZ_ASSERT(aTabOpener);
@ -841,7 +842,7 @@ ContentChild::ProvideWindowCommon(TabChild* aTabOpener,
newChild->SendBrowserFrameOpenWindow(aTabOpener, renderFrame, NS_ConvertUTF8toUTF16(url),
name, NS_ConvertUTF8toUTF16(features),
aWindowIsNew, &textureFactoryIdentifier,
&layersId, &compositorOptions);
&layersId, &compositorOptions, &maxTouchPoints);
} else {
nsAutoCString baseURIString;
float fullZoom;
@ -865,7 +866,8 @@ ContentChild::ProvideWindowCommon(TabChild* aTabOpener,
&urlToLoad,
&textureFactoryIdentifier,
&layersId,
&compositorOptions)) {
&compositorOptions,
&maxTouchPoints)) {
PRenderFrameChild::Send__delete__(renderFrame);
return NS_ERROR_NOT_AVAILABLE;
}
@ -896,6 +898,8 @@ ContentChild::ProvideWindowCommon(TabChild* aTabOpener,
aTabOpener->mDefaultScale);
}
newChild->SetMaxTouchPoints(maxTouchPoints);
// Set the opener window for this window before we start loading the document
// inside of it. We have to do this before loading the remote scripts, because
// they can poke at the document and cause the nsDocument to be created before

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

@ -4617,7 +4617,8 @@ ContentParent::RecvCreateWindow(PBrowserParent* aThisTab,
nsCString* aURLToLoad,
TextureFactoryIdentifier* aTextureFactoryIdentifier,
uint64_t* aLayersId,
CompositorOptions* aCompositorOptions)
CompositorOptions* aCompositorOptions,
uint32_t* aMaxTouchPoints)
{
// We always expect to open a new window here. If we don't, it's an error.
*aWindowIsNew = true;
@ -4671,6 +4672,9 @@ ContentParent::RecvCreateWindow(PBrowserParent* aThisTab,
}
*aCompositorOptions = rfp->GetCompositorOptions();
nsCOMPtr<nsIWidget> widget = newTab->GetWidget();
*aMaxTouchPoints = widget ? widget->GetMaxTouchPoints() : 0;
return IPC_OK();
}

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

@ -549,7 +549,8 @@ public:
nsCString* aURLToLoad,
layers::TextureFactoryIdentifier* aTextureFactoryIdentifier,
uint64_t* aLayersId,
mozilla::layers::CompositorOptions* aCompositorOptions) override;
mozilla::layers::CompositorOptions* aCompositorOptions,
uint32_t* aMaxTouchPoints) override;
virtual mozilla::ipc::IPCResult RecvCreateWindowInDifferentProcess(
PBrowserParent* aThisTab,

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

@ -377,11 +377,6 @@ parent:
*/
sync GetWidgetRounding() returns (int32_t value);
/**
* Gets maximum of touch points at current device.
*/
sync GetMaxTouchPoints() returns (uint32_t value);
/**
* Set the native cursor.
* @param value
@ -466,7 +461,8 @@ parent:
returns (bool windowOpened,
TextureFactoryIdentifier textureFactoryIdentifier,
uint64_t layersId,
CompositorOptions compositorOptions);
CompositorOptions compositorOptions,
uint32_t maxTouchPoints);
/**
* Tells the containing widget whether the given input block results in a

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

@ -1020,7 +1020,8 @@ parent:
nsCString urlToLoad,
TextureFactoryIdentifier textureFactoryIdentifier,
uint64_t layersId,
CompositorOptions compositorOptions);
CompositorOptions compositorOptions,
uint32_t maxTouchPoints);
async CreateWindowInDifferentProcess(
PBrowser aThisTab,

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

@ -376,6 +376,7 @@ TabChild::TabChild(nsIContentChild* aManager,
, mRemoteFrame(nullptr)
, mManager(aManager)
, mChromeFlags(aChromeFlags)
, mMaxTouchPoints(0)
, mActiveSuppressDisplayport(0)
, mLayersId(0)
, mBeforeUnloadListeners(0)
@ -2705,13 +2706,6 @@ TabChild::GetWidgetRounding(int32_t* aRounding)
SendGetWidgetRounding(aRounding);
}
void
TabChild::GetMaxTouchPoints(uint32_t* aTouchPoints)
{
// Fallback to a sync call.
SendGetMaxTouchPoints(aTouchPoints);
}
void
TabChild::NotifyPainted()
{

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

@ -503,7 +503,15 @@ public:
bool IsTransparent() const { return mIsTransparent; }
void GetMaxTouchPoints(uint32_t* aTouchPoints);
void GetMaxTouchPoints(uint32_t* aTouchPoints)
{
*aTouchPoints = mMaxTouchPoints;
}
void SetMaxTouchPoints(uint32_t aMaxTouchPoints)
{
mMaxTouchPoints = aMaxTouchPoints;
}
ScreenOrientationInternal GetOrientation() const { return mOrientation; }
@ -787,6 +795,7 @@ private:
RefPtr<nsIContentChild> mManager;
RefPtr<TabChildSHistoryListener> mHistoryListener;
uint32_t mChromeFlags;
uint32_t mMaxTouchPoints;
int32_t mActiveSuppressDisplayport;
uint64_t mLayersId;
int64_t mBeforeUnloadListeners;

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

@ -2296,18 +2296,6 @@ TabParent::RecvGetWidgetRounding(int32_t* aValue)
return IPC_OK();
}
mozilla::ipc::IPCResult
TabParent::RecvGetMaxTouchPoints(uint32_t* aTouchPoints)
{
nsCOMPtr<nsIWidget> widget = GetWidget();
if (widget) {
*aTouchPoints = widget->GetMaxTouchPoints();
} else {
*aTouchPoints = 0;
}
return IPC_OK();
}
already_AddRefed<nsIWidget>
TabParent::GetTopLevelWidget()
{
@ -2589,7 +2577,8 @@ TabParent::RecvBrowserFrameOpenWindow(PBrowserParent* aOpener,
bool* aOutWindowOpened,
TextureFactoryIdentifier* aTextureFactoryIdentifier,
uint64_t* aLayersId,
CompositorOptions* aCompositorOptions)
CompositorOptions* aCompositorOptions,
uint32_t* aMaxTouchPoints)
{
BrowserElementParent::OpenWindowResult opened =
BrowserElementParent::OpenWindowOOP(TabParent::GetFrom(aOpener),
@ -2597,6 +2586,8 @@ TabParent::RecvBrowserFrameOpenWindow(PBrowserParent* aOpener,
aTextureFactoryIdentifier, aLayersId);
*aCompositorOptions = static_cast<RenderFrameParent*>(aRenderFrame)->GetCompositorOptions();
*aOutWindowOpened = (opened == BrowserElementParent::OPEN_WINDOW_ADDED);
nsCOMPtr<nsIWidget> widget = GetWidget();
*aMaxTouchPoints = widget ? widget->GetMaxTouchPoints() : 0;
if (!*aOutWindowOpened) {
Destroy();
}

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

@ -181,7 +181,8 @@ public:
bool* aOutWindowOpened,
TextureFactoryIdentifier* aTextureFactoryIdentifier,
uint64_t* aLayersId,
CompositorOptions* aCompositorOptions) override;
CompositorOptions* aCompositorOptions,
uint32_t* aMaxTouchPoints) override;
virtual mozilla::ipc::IPCResult
RecvSyncMessage(const nsString& aMessage,
@ -315,8 +316,6 @@ public:
virtual mozilla::ipc::IPCResult RecvGetWidgetRounding(int32_t* aValue) override;
virtual mozilla::ipc::IPCResult RecvGetMaxTouchPoints(uint32_t* aTouchPoints) override;
virtual mozilla::ipc::IPCResult RecvGetWidgetNativeData(WindowsHandle* aValue) override;
virtual mozilla::ipc::IPCResult RecvSetNativeChildOfShareableWindow(const uintptr_t& childWindow) override;

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

@ -845,8 +845,6 @@ description =
description =
[PBrowser::GetWidgetRounding]
description =
[PBrowser::GetMaxTouchPoints]
description =
[PBrowser::BrowserFrameOpenWindow]
description =
[PBrowser::RequestNativeKeyBindings]

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

@ -1260,16 +1260,11 @@ PuppetWidget::GetScreenBounds()
uint32_t PuppetWidget::GetMaxTouchPoints() const
{
static uint32_t sTouchPoints = 0;
static bool sIsInitialized = false;
if (sIsInitialized) {
return sTouchPoints;
}
uint32_t maxTouchPoints = 0;
if (mTabChild) {
mTabChild->GetMaxTouchPoints(&sTouchPoints);
sIsInitialized = true;
mTabChild->GetMaxTouchPoints(&maxTouchPoints);
}
return sTouchPoints;
return maxTouchPoints;
}
void