зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1152326 - When processing plugin updates only update the visibility of the set of plugins associated with the same compositor. r=aklotz
This commit is contained in:
Родитель
bef4807107
Коммит
a0edcafb63
|
@ -262,7 +262,7 @@ CompositorChild::RecvUpdatePluginConfigurations(const nsIntPoint& aContentOffset
|
|||
|
||||
// Tracks visible plugins we update, so we can hide any plugins we don't.
|
||||
nsTArray<uintptr_t> visiblePluginIds;
|
||||
|
||||
nsIWidget* parent = nullptr;
|
||||
for (uint32_t pluginsIdx = 0; pluginsIdx < aPlugins.Length(); pluginsIdx++) {
|
||||
nsIWidget* widget =
|
||||
nsIWidget::LookupRegisteredPluginWindow(aPlugins[pluginsIdx].windowId());
|
||||
|
@ -270,6 +270,9 @@ CompositorChild::RecvUpdatePluginConfigurations(const nsIntPoint& aContentOffset
|
|||
NS_WARNING("Unexpected, plugin id not found!");
|
||||
continue;
|
||||
}
|
||||
if (!parent) {
|
||||
parent = widget->GetParent();
|
||||
}
|
||||
bool isVisible = aPlugins[pluginsIdx].visible();
|
||||
if (widget && !widget->Destroyed()) {
|
||||
gfx::IntRect bounds;
|
||||
|
@ -321,13 +324,14 @@ CompositorChild::RecvUpdatePluginConfigurations(const nsIntPoint& aContentOffset
|
|||
}
|
||||
// Any plugins we didn't update need to be hidden, as they are
|
||||
// not associated with visible content.
|
||||
nsIWidget::UpdateRegisteredPluginWindowVisibility(visiblePluginIds);
|
||||
nsIWidget::UpdateRegisteredPluginWindowVisibility((uintptr_t)parent, visiblePluginIds);
|
||||
return true;
|
||||
#endif // !defined(XP_WIN) && !defined(MOZ_WIDGET_GTK)
|
||||
}
|
||||
|
||||
bool
|
||||
CompositorChild::RecvUpdatePluginVisibility(nsTArray<uintptr_t>&& aVisibleIdList)
|
||||
CompositorChild::RecvUpdatePluginVisibility(const uintptr_t& aOwnerWidget,
|
||||
nsTArray<uintptr_t>&& aVisibleIdList)
|
||||
{
|
||||
#if !defined(XP_WIN) && !defined(MOZ_WIDGET_GTK)
|
||||
NS_NOTREACHED("CompositorChild::RecvUpdatePluginVisibility calls "
|
||||
|
@ -335,7 +339,7 @@ CompositorChild::RecvUpdatePluginVisibility(nsTArray<uintptr_t>&& aVisibleIdList
|
|||
return false;
|
||||
#else
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
nsIWidget::UpdateRegisteredPluginWindowVisibility(aVisibleIdList);
|
||||
nsIWidget::UpdateRegisteredPluginWindowVisibility(aOwnerWidget, aVisibleIdList);
|
||||
return true;
|
||||
#endif // !defined(XP_WIN) && !defined(MOZ_WIDGET_GTK)
|
||||
}
|
||||
|
|
|
@ -88,7 +88,8 @@ public:
|
|||
nsTArray<PluginWindowData>&& aPlugins) override;
|
||||
|
||||
virtual bool
|
||||
RecvUpdatePluginVisibility(nsTArray<uintptr_t>&& aWindowList) override;
|
||||
RecvUpdatePluginVisibility(const uintptr_t& aOwnerWidget,
|
||||
nsTArray<uintptr_t>&& aWindowList) override;
|
||||
|
||||
/**
|
||||
* Request that the parent tell us when graphics are ready on GPU.
|
||||
|
|
|
@ -1440,12 +1440,9 @@ CompositorParent::AllocPLayerTransactionParent(const nsTArray<LayersBackend>& aB
|
|||
{
|
||||
MOZ_ASSERT(aId == 0);
|
||||
|
||||
// mWidget doesn't belong to the compositor thread, so it should be set to
|
||||
// nullptr before returning from this method, to avoid accessing it elsewhere.
|
||||
gfx::IntRect rect;
|
||||
mWidget->GetClientBounds(rect);
|
||||
InitializeLayerManager(aBackendHints);
|
||||
mWidget = nullptr;
|
||||
|
||||
if (!mLayerManager) {
|
||||
NS_WARNING("Failed to initialise Compositor");
|
||||
|
@ -2037,7 +2034,9 @@ UpdatePluginWindowState(uint64_t aId)
|
|||
// to do here is hide the plugins for the old tree, so don't waste time
|
||||
// calculating clipping.
|
||||
nsTArray<uintptr_t> aVisibleIdList;
|
||||
unused << lts.mParent->SendUpdatePluginVisibility(aVisibleIdList);
|
||||
uintptr_t parentWidget = (uintptr_t)lts.mParent->GetWidget();
|
||||
unused << lts.mParent->SendUpdatePluginVisibility(parentWidget,
|
||||
aVisibleIdList);
|
||||
lts.mUpdatedPluginDataAvailable = false;
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -424,6 +424,8 @@ public:
|
|||
*/
|
||||
static bool IsInCompositorThread();
|
||||
|
||||
nsIWidget* GetWidget() { return mWidget; }
|
||||
|
||||
protected:
|
||||
// Protected destructor, to discourage deletion outside of Release():
|
||||
virtual ~CompositorParent();
|
||||
|
|
|
@ -69,7 +69,8 @@ child:
|
|||
* Sets the list of currently visible plugin windows based on a
|
||||
* list of plugin window ids.
|
||||
*/
|
||||
async UpdatePluginVisibility(uintptr_t[] aVisibleIdList);
|
||||
async UpdatePluginVisibility(uintptr_t aOwnerWidget,
|
||||
uintptr_t[] aVisibleIdList);
|
||||
|
||||
/**
|
||||
* Drop any buffers that might be retained on the child compositor
|
||||
|
|
|
@ -1900,6 +1900,11 @@ nsIWidget::LookupRegisteredPluginWindow(uintptr_t aWindowID)
|
|||
}
|
||||
|
||||
#if defined(XP_WIN) || defined(MOZ_WIDGET_GTK)
|
||||
struct VisEnumContext {
|
||||
uintptr_t parentWidget;
|
||||
const nsTArray<uintptr_t>* list;
|
||||
};
|
||||
|
||||
static PLDHashOperator
|
||||
RegisteredPluginEnumerator(const void* aWindowId, nsIWidget* aWidget, void* aUserArg)
|
||||
{
|
||||
|
@ -1907,9 +1912,13 @@ RegisteredPluginEnumerator(const void* aWindowId, nsIWidget* aWidget, void* aUse
|
|||
MOZ_ASSERT(aWindowId);
|
||||
MOZ_ASSERT(aWidget);
|
||||
MOZ_ASSERT(aUserArg);
|
||||
const nsTArray<uintptr_t>* visible = static_cast<const nsTArray<uintptr_t>*>(aUserArg);
|
||||
if (!visible->Contains((uintptr_t)aWindowId) && !aWidget->Destroyed()) {
|
||||
aWidget->Show(false);
|
||||
|
||||
if (!aWidget->Destroyed()) {
|
||||
VisEnumContext* pctx = static_cast<VisEnumContext*>(aUserArg);
|
||||
if ((uintptr_t)aWidget->GetParent() == pctx->parentWidget &&
|
||||
!pctx->list->Contains((uintptr_t)aWindowId)) {
|
||||
aWidget->Show(false);
|
||||
}
|
||||
}
|
||||
return PLDHashOperator::PL_DHASH_NEXT;
|
||||
}
|
||||
|
@ -1917,7 +1926,8 @@ RegisteredPluginEnumerator(const void* aWindowId, nsIWidget* aWidget, void* aUse
|
|||
|
||||
// static
|
||||
void
|
||||
nsIWidget::UpdateRegisteredPluginWindowVisibility(nsTArray<uintptr_t>& aVisibleList)
|
||||
nsIWidget::UpdateRegisteredPluginWindowVisibility(uintptr_t aOwnerWidget,
|
||||
nsTArray<uintptr_t>& aVisibleList)
|
||||
{
|
||||
#if !defined(XP_WIN) && !defined(MOZ_WIDGET_GTK)
|
||||
NS_NOTREACHED("nsBaseWidget::UpdateRegisteredPluginWindowVisibility not implemented!");
|
||||
|
@ -1925,7 +1935,11 @@ nsIWidget::UpdateRegisteredPluginWindowVisibility(nsTArray<uintptr_t>& aVisibleL
|
|||
#else
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
MOZ_ASSERT(sPluginWidgetList);
|
||||
sPluginWidgetList->EnumerateRead(RegisteredPluginEnumerator, static_cast<void*>(&aVisibleList));
|
||||
// Our visible list is associated with a compositor which is associated with
|
||||
// a specific top level window. We hand the parent widget in here so the
|
||||
// enumerator can skip the plugin widgets owned by other top level windows.
|
||||
VisEnumContext ctx = { aOwnerWidget, &aVisibleList };
|
||||
sPluginWidgetList->EnumerateRead(RegisteredPluginEnumerator, static_cast<void*>(&ctx));
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
@ -1526,7 +1526,8 @@ class nsIWidget : public nsISupports {
|
|||
* widgets are currently included in the visible layer tree. It calls this
|
||||
* helper to hide widgets it knows nothing about.
|
||||
*/
|
||||
static void UpdateRegisteredPluginWindowVisibility(nsTArray<uintptr_t>& aVisibleList);
|
||||
static void UpdateRegisteredPluginWindowVisibility(uintptr_t aOwnerWidget,
|
||||
nsTArray<uintptr_t>& aVisibleList);
|
||||
|
||||
/**
|
||||
* Set the shadow style of the window.
|
||||
|
|
Загрузка…
Ссылка в новой задаче