Bug 1350633 - Remove the Msg_GetWidgetNativeData sync IPC, r=billm, r=jimm

MozReview-Commit-ID: Bql29wgVDZ5
This commit is contained in:
Michael Layzell 2017-06-13 13:37:31 -04:00
Родитель 31e36ee704
Коммит 3c82b8c224
7 изменённых файлов: 41 добавлений и 23 удалений

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

@ -149,11 +149,6 @@ parent:
async PPaymentRequest();
/**
* Return native data of root widget
*/
nested(inside_cpow) sync GetWidgetNativeData() returns (WindowsHandle value);
/**
* Sends an NS_NATIVE_CHILD_OF_SHAREABLE_WINDOW to be adopted by the
* widget's shareable window on the chrome side. Only used on Windows.
@ -894,6 +889,12 @@ child:
*/
async SetOriginAttributes(OriginAttributes aOriginAttributes);
/**
* Pass the current handle for the current native widget to the content
* process, so it can be used by PuppetWidget.
*/
async SetWidgetNativeData(WindowsHandle aHandle);
/*
* FIXME: write protocol!

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

@ -411,6 +411,7 @@ TabChild::TabChild(nsIContentChild* aManager,
, mPendingDocShellPreserveLayers(false)
, mPendingDocShellReceivedMessage(false)
, mPendingDocShellBlockers(0)
, mWidgetNativeData(0)
{
nsWeakPtr weakPtrThis(do_GetWeakReference(static_cast<nsITabChild*>(this))); // for capture by the lambda
mSetAllowedTouchBehaviorCallback = [weakPtrThis](uint64_t aInputBlockId,
@ -3211,6 +3212,13 @@ TabChild::RecvSetOriginAttributes(const OriginAttributes& aOriginAttributes)
return IPC_OK();
}
mozilla::ipc::IPCResult
TabChild::RecvSetWidgetNativeData(const WindowsHandle& aWidgetNativeData)
{
mWidgetNativeData = aWidgetNativeData;
return IPC_OK();
}
mozilla::plugins::PPluginWidgetChild*
TabChild::AllocPPluginWidgetChild()
{

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

@ -697,6 +697,12 @@ public:
void AddPendingDocShellBlocker();
void RemovePendingDocShellBlocker();
// The HANDLE object for the widget this TabChild in.
WindowsHandle WidgetNativeData()
{
return mWidgetNativeData;
}
protected:
virtual ~TabChild();
@ -738,6 +744,8 @@ protected:
virtual mozilla::ipc::IPCResult RecvSetOriginAttributes(const OriginAttributes& aOriginAttributes) override;
virtual mozilla::ipc::IPCResult RecvSetWidgetNativeData(const WindowsHandle& aWidgetNativeData) override;
private:
void HandleDoubleTap(const CSSPoint& aPoint, const Modifiers& aModifiers,
const ScrollableLayerGuid& aGuid);
@ -881,6 +889,8 @@ private:
bool mPendingDocShellReceivedMessage;
uint32_t mPendingDocShellBlockers;
WindowsHandle mWidgetNativeData;
DISALLOW_EVIL_CONSTRUCTORS(TabChild);
};

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

@ -292,6 +292,17 @@ TabParent::SetOwnerElement(Element* aElement)
AddWindowListeners();
TryCacheDPIAndScale();
// Try to send down WidgetNativeData, now that this TabParent is associated
// with a widget.
nsCOMPtr<nsIWidget> widget = GetTopLevelWidget();
if (widget) {
WindowsHandle widgetNativeData = reinterpret_cast<WindowsHandle>(
widget->GetNativeData(NS_NATIVE_SHAREABLE_WINDOW));
if (widgetNativeData) {
Unused << SendSetWidgetNativeData(widgetNativeData);
}
}
}
void
@ -2315,18 +2326,6 @@ TabParent::GetTopLevelWidget()
return nullptr;
}
mozilla::ipc::IPCResult
TabParent::RecvGetWidgetNativeData(WindowsHandle* aValue)
{
*aValue = 0;
nsCOMPtr<nsIWidget> widget = GetTopLevelWidget();
if (widget) {
*aValue = reinterpret_cast<WindowsHandle>(
widget->GetNativeData(NS_NATIVE_SHAREABLE_WINDOW));
}
return IPC_OK();
}
mozilla::ipc::IPCResult
TabParent::RecvSetNativeChildOfShareableWindow(const uintptr_t& aChildWindow)
{

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

@ -305,8 +305,6 @@ public:
virtual mozilla::ipc::IPCResult RecvGetWidgetRounding(int32_t* aValue) override;
virtual mozilla::ipc::IPCResult RecvGetWidgetNativeData(WindowsHandle* aValue) override;
virtual mozilla::ipc::IPCResult RecvSetNativeChildOfShareableWindow(const uintptr_t& childWindow) override;
virtual mozilla::ipc::IPCResult RecvDispatchFocusToTopLevelWindow() override;

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

@ -821,8 +821,6 @@ description =
description =
[PBrowser::PPluginWidget]
description =
[PBrowser::GetWidgetNativeData]
description =
[PBrowser::DispatchFocusToTopLevelWindow]
description =
[PBrowser::NotifyIMEFocus]

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

@ -1189,10 +1189,14 @@ PuppetWidget::GetNativeData(uint32_t aDataType)
{
switch (aDataType) {
case NS_NATIVE_SHAREABLE_WINDOW: {
MOZ_ASSERT(mTabChild, "Need TabChild to get the nativeWindow from!");
// NOTE: We can not have a tab child in some situations, such as when we're
// rendering to a fake widget for thumbnails.
if (!mTabChild) {
NS_WARNING("Need TabChild to get the nativeWindow from!");
}
mozilla::WindowsHandle nativeData = 0;
if (mTabChild) {
mTabChild->SendGetWidgetNativeData(&nativeData);
nativeData = mTabChild->WidgetNativeData();
}
return (void*)nativeData;
}