Bug 1095754 - Compositor plumbing for plugin configuration. r=roc

This commit is contained in:
Jim Mathies 2015-01-29 13:41:55 -06:00
parent 7149a4e627
commit f53c479605
13 changed files with 92 additions and 18 deletions

View File

@ -44,7 +44,7 @@
#include "nsTArrayForwardDeclare.h" // for InfallibleTArray
#include "nscore.h" // for nsACString, nsAString
#include "prlog.h" // for PRLogModuleInfo
#include "gfx2DGlue.h"
#include "nsIWidget.h" // For plugin window configuration information structs
#include "gfxVR.h"
class gfxContext;
@ -307,7 +307,7 @@ public:
virtual bool HasShadowManagerInternal() const { return false; }
bool HasShadowManager() const { return HasShadowManagerInternal(); }
virtual void StorePluginWidgetConfigurations(const nsTArray<nsIWidget::Configuration>& aConfigurations) {}
bool IsSnappingEffectiveTransforms() { return mSnapEffectiveTransforms; }

View File

@ -22,7 +22,6 @@
#include "mozilla/layers/TextureClientPool.h" // for TextureClientPool
#include "ClientReadbackLayer.h" // for ClientReadbackLayer
#include "nsAString.h"
#include "nsIWidget.h" // for nsIWidget
#include "nsIWidgetListener.h"
#include "nsTArray.h" // for AutoInfallibleTArray
#include "nsXULAppAPI.h" // for XRE_GetProcessType, etc
@ -299,6 +298,14 @@ ClientLayerManager::EndTransactionInternal(DrawPaintedLayerCallback aCallback,
return !mTransactionIncomplete;
}
void
ClientLayerManager::StorePluginWidgetConfigurations(const nsTArray<nsIWidget::Configuration>& aConfigurations)
{
if (mForwarder) {
mForwarder->StorePluginWidgetConfigurations(aConfigurations);
}
}
void
ClientLayerManager::EndTransaction(DrawPaintedLayerCallback aCallback,
void* aCallbackData,

View File

@ -26,8 +26,7 @@
#include "nsTArray.h" // for nsTArray
#include "nscore.h" // for nsAString
#include "mozilla/layers/TransactionIdAllocator.h"
class nsIWidget;
#include "nsIWidget.h" // For plugin window configuration information structs
namespace mozilla {
namespace layers {
@ -129,6 +128,15 @@ public:
void ReturnTextureClient(TextureClient& aClient);
void ReportClientLost(TextureClient& aClient);
/**
* Pass through call to the forwarder for nsPresContext's
* CollectPluginGeometryUpdates. Passes widget configuration information
* to the compositor for transmission to the chrome process. This
* configuration gets set when the window paints.
*/
void StorePluginWidgetConfigurations(const nsTArray<nsIWidget::Configuration>&
aConfigurations) MOZ_OVERRIDE;
// Drop cached resources and ask our shadow manager to do the same,
// if we have one.
virtual void ClearCachedResources(Layer* aSubtree = nullptr) MOZ_OVERRIDE;

View File

@ -1047,6 +1047,7 @@ void
CompositorParent::ShadowLayersUpdated(LayerTransactionParent* aLayerTree,
const uint64_t& aTransactionId,
const TargetConfig& aTargetConfig,
const InfallibleTArray<PluginWindowData>& aUnused,
bool aIsFirstPaint,
bool aScheduleComposite,
uint32_t aPaintSequenceNumber,
@ -1491,6 +1492,7 @@ public:
virtual void ShadowLayersUpdated(LayerTransactionParent* aLayerTree,
const uint64_t& aTransactionId,
const TargetConfig& aTargetConfig,
const InfallibleTArray<PluginWindowData>& aPlugins,
bool aIsFirstPaint,
bool aScheduleComposite,
uint32_t aPaintSequenceNumber,

View File

@ -173,6 +173,7 @@ public:
virtual void ShadowLayersUpdated(LayerTransactionParent* aLayerTree,
const uint64_t& aTransactionId,
const TargetConfig& aTargetConfig,
const InfallibleTArray<PluginWindowData>& aPlugins,
bool aIsFirstPaint,
bool aScheduleComposite,
uint32_t aPaintSequenceNumber,
@ -301,6 +302,7 @@ public:
TargetConfig mTargetConfig;
APZTestData mApzTestData;
LayerTransactionParent* mLayerTree;
nsTArray<PluginWindowData> mPluginData;
};
/**

View File

@ -193,13 +193,14 @@ bool
LayerTransactionParent::RecvUpdateNoSwap(InfallibleTArray<Edit>&& cset,
const uint64_t& aTransactionId,
const TargetConfig& targetConfig,
PluginsArray&& aPlugins,
const bool& isFirstPaint,
const bool& scheduleComposite,
const uint32_t& paintSequenceNumber,
const bool& isRepeatTransaction,
const mozilla::TimeStamp& aTransactionStart)
{
return RecvUpdate(Move(cset), aTransactionId, targetConfig, isFirstPaint,
return RecvUpdate(Move(cset), aTransactionId, targetConfig, Move(aPlugins), isFirstPaint,
scheduleComposite, paintSequenceNumber, isRepeatTransaction,
aTransactionStart, nullptr);
}
@ -223,6 +224,7 @@ bool
LayerTransactionParent::RecvUpdate(InfallibleTArray<Edit>&& cset,
const uint64_t& aTransactionId,
const TargetConfig& targetConfig,
PluginsArray&& aPlugins,
const bool& isFirstPaint,
const bool& scheduleComposite,
const uint32_t& paintSequenceNumber,
@ -581,7 +583,8 @@ LayerTransactionParent::RecvUpdate(InfallibleTArray<Edit>&& cset,
}
mShadowLayersManager->ShadowLayersUpdated(this, aTransactionId, targetConfig,
isFirstPaint, scheduleComposite, paintSequenceNumber, isRepeatTransaction);
aPlugins, isFirstPaint, scheduleComposite,
paintSequenceNumber, isRepeatTransaction);
{
AutoResolveRefLayers resolve(mShadowLayersManager->GetCompositionManager(this));

View File

@ -42,6 +42,7 @@ class LayerTransactionParent : public PLayerTransactionParent,
typedef InfallibleTArray<Edit> EditArray;
typedef InfallibleTArray<EditReply> EditReplyArray;
typedef InfallibleTArray<AsyncChildMessageData> AsyncChildMessageArray;
typedef InfallibleTArray<PluginWindowData> PluginsArray;
public:
LayerTransactionParent(LayerManagerComposite* aManager,
@ -106,6 +107,7 @@ protected:
virtual bool RecvUpdate(EditArray&& cset,
const uint64_t& aTransactionId,
const TargetConfig& targetConfig,
PluginsArray&& aPlugins,
const bool& isFirstPaint,
const bool& scheduleComposite,
const uint32_t& paintSequenceNumber,
@ -116,6 +118,7 @@ protected:
virtual bool RecvUpdateNoSwap(EditArray&& cset,
const uint64_t& aTransactionId,
const TargetConfig& targetConfig,
PluginsArray&& aPlugins,
const bool& isFirstPaint,
const bool& scheduleComposite,
const uint32_t& paintSequenceNumber,

View File

@ -259,6 +259,14 @@ struct LayerAttributes {
SpecificLayerAttributes specific;
};
// See nsIWidget Configurations
struct PluginWindowData {
uintptr_t windowId;
nsIntRect[] clip;
nsIntRect bounds;
bool visible;
};
struct OpSetLayerAttributes {
PLayer layer;
LayerAttributes attrs;

View File

@ -6,6 +6,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
include LayersSurfaces;
include LayersMessages;
include protocol PLayerTransaction;
include "mozilla/GfxMessageUtils.h";
include "nsRegion.h";
@ -56,8 +57,14 @@ child:
*/
async RemotePaintIsReady();
parent:
/**
* Bounce plugin widget configurations over to the main thread for
* application on the widgets. Used on Windows and Linux in managing
* plugin widgets.
*/
async UpdatePluginConfigurations(PluginWindowData[] plugins);
parent:
// Child sends the parent a request for fill ratio numbers.
async RequestOverfill();

View File

@ -53,14 +53,16 @@ parent:
// The isFirstPaint flag can be used to indicate that this is the first update
// for a particular document.
sync Update(Edit[] cset, uint64_t id, TargetConfig targetConfig, bool isFirstPaint,
sync Update(Edit[] cset, uint64_t id, TargetConfig targetConfig,
PluginWindowData[] plugins, bool isFirstPaint,
bool scheduleComposite, uint32_t paintSequenceNumber,
bool isRepeatTransaction, TimeStamp transactionStart)
returns (EditReply[] reply);
// We don't need to send a sync transaction if
// no transaction operate require a swap.
async UpdateNoSwap(Edit[] cset, uint64_t id, TargetConfig targetConfig, bool isFirstPaint,
async UpdateNoSwap(Edit[] cset, uint64_t id, TargetConfig targetConfig,
PluginWindowData[] plugins, bool isFirstPaint,
bool scheduleComposite, uint32_t paintSequenceNumber,
bool isRepeatTransaction, TimeStamp transactionStart);

View File

@ -538,6 +538,22 @@ ShadowLayerForwarder::RemoveTexture(TextureClient* aTexture)
}
}
void
ShadowLayerForwarder::StorePluginWidgetConfigurations(const nsTArray<nsIWidget::Configuration>&
aConfigurations)
{
// Cache new plugin widget configs here until we call update, at which
// point this data will get shipped over to chrome.
mPluginWindowData.Clear();
for (uint32_t idx = 0; idx < aConfigurations.Length(); idx++) {
const nsIWidget::Configuration& configuration = aConfigurations[idx];
mPluginWindowData.AppendElement(PluginWindowData(configuration.mWindowID,
configuration.mClipRegion,
configuration.mBounds,
configuration.mVisible));
}
}
bool
ShadowLayerForwarder::EndTransaction(InfallibleTArray<EditReply>* aReplies,
const nsIntRegion& aRegionToClear,
@ -674,10 +690,10 @@ ShadowLayerForwarder::EndTransaction(InfallibleTArray<EditReply>* aReplies,
RenderTraceScope rendertrace3("Forward Transaction", "000093");
if (!HasShadowManager() ||
!mShadowManager->IPCOpen() ||
!mShadowManager->SendUpdate(cset, aId, targetConfig, mIsFirstPaint,
aScheduleComposite, aPaintSequenceNumber,
aIsRepeatTransaction, aTransactionStart,
aReplies)) {
!mShadowManager->SendUpdate(cset, aId, targetConfig, mPluginWindowData,
mIsFirstPaint, aScheduleComposite,
aPaintSequenceNumber, aIsRepeatTransaction,
aTransactionStart, aReplies)) {
MOZ_LAYERS_LOG(("[LayersForwarder] WARNING: sending transaction failed!"));
return false;
}
@ -688,14 +704,19 @@ ShadowLayerForwarder::EndTransaction(InfallibleTArray<EditReply>* aReplies,
RenderTraceScope rendertrace3("Forward NoSwap Transaction", "000093");
if (!HasShadowManager() ||
!mShadowManager->IPCOpen() ||
!mShadowManager->SendUpdateNoSwap(cset, aId, targetConfig, mIsFirstPaint,
aScheduleComposite, aPaintSequenceNumber,
aIsRepeatTransaction, aTransactionStart)) {
!mShadowManager->SendUpdateNoSwap(cset, aId, targetConfig, mPluginWindowData,
mIsFirstPaint, aScheduleComposite,
aPaintSequenceNumber, aIsRepeatTransaction,
aTransactionStart)) {
MOZ_LAYERS_LOG(("[LayersForwarder] WARNING: sending transaction failed!"));
return false;
}
}
// Clear any cached plugin data we might have, now that the
// transaction is complete.
mPluginWindowData.Clear();
*aSent = true;
mIsFirstPaint = false;
MOZ_LAYERS_LOG(("[LayersForwarder] ... done"));

View File

@ -20,7 +20,8 @@
#include "nsCOMPtr.h" // for already_AddRefed
#include "nsRegion.h" // for nsIntRegion
#include "nsTArrayForwardDeclare.h" // for InfallibleTArray
#include "nsIWidget.h"
struct nsIntPoint;
struct nsIntRect;
@ -313,6 +314,14 @@ public:
*/
void SetShadowManager(PLayerTransactionChild* aShadowManager);
/**
* Layout calls here to cache current plugin widget configuration
* data. We ship this across with the rest of the layer updates when
* we update. Chrome handles applying these changes.
*/
void StorePluginWidgetConfigurations(const nsTArray<nsIWidget::Configuration>&
aConfigurations);
void StopReceiveAsyncParentMessge();
void ClearCachedResources();
@ -407,6 +416,7 @@ private:
DiagnosticTypes mDiagnosticTypes;
bool mIsFirstPaint;
bool mWindowOverlayChanged;
InfallibleTArray<PluginWindowData> mPluginWindowData;
};
class CompositableClient;

View File

@ -21,6 +21,7 @@ public:
virtual void ShadowLayersUpdated(LayerTransactionParent* aLayerTree,
const uint64_t& aTransactionId,
const TargetConfig& aTargetConfig,
const InfallibleTArray<PluginWindowData>& aPlugins,
bool aIsFirstPaint,
bool aScheduleComposite,
uint32_t aPaintSequenceNumber,