Bug 619488 - Inform child processes of the compositor's layer-manager type. r=jones.chris.g a=b-f

This commit is contained in:
Oleg Romashin 2010-12-31 09:40:19 +02:00
Родитель d16a7a6cee
Коммит 06bafdb192
7 изменённых файлов: 70 добавлений и 3 удалений

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

@ -232,10 +232,12 @@ class THEBES_API LayerManager {
public:
enum LayersBackend {
LAYERS_BASIC = 0,
LAYERS_NONE = 0,
LAYERS_BASIC,
LAYERS_OPENGL,
LAYERS_D3D9,
LAYERS_D3D10
LAYERS_D3D10,
LAYERS_LAST
};
LayerManager() : mDestroyed(PR_FALSE), mSnapEffectiveTransforms(PR_TRUE)

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

@ -54,6 +54,7 @@ using mozilla::GraphicsFilterType;
using mozilla::layers::FrameMetrics;
using mozilla::layers::SurfaceDescriptorX11;
using mozilla::null_t;
using mozilla::LayersBackend;
/**
* The layers protocol is spoken between thread contexts that manage
@ -243,6 +244,9 @@ parent:
sync Update(Edit[] cset)
returns (EditReply[] reply);
sync GetParentType()
returns (LayersBackend backend);
async __delete__();
};

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

@ -123,7 +123,9 @@ struct AutoTxnEnd {
Transaction* mTxn;
};
ShadowLayerForwarder::ShadowLayerForwarder() : mShadowManager(NULL)
ShadowLayerForwarder::ShadowLayerForwarder()
: mShadowManager(NULL)
, mParentBackend(LayerManager::LAYERS_NONE)
{
mTxn = new Transaction();
}
@ -372,6 +374,18 @@ ShadowLayerForwarder::EndTransaction(InfallibleTArray<EditReply>* aReplies)
return PR_TRUE;
}
LayersBackend
ShadowLayerForwarder::GetParentBackendType()
{
if (mParentBackend == LayerManager::LAYERS_NONE) {
LayersBackend backend;
if (mShadowManager->SendGetParentType(&backend)) {
mParentBackend = backend;
}
}
return mParentBackend;
}
static gfxASurface::gfxImageFormat
OptimalFormatFor(gfxASurface::gfxContentType aContent)
{

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

@ -111,6 +111,8 @@ class Transaction;
class ShadowLayerForwarder
{
public:
typedef LayerManager::LayersBackend LayersBackend;
virtual ~ShadowLayerForwarder();
/**
@ -305,6 +307,8 @@ public:
*/
PLayerChild* ConstructShadowFor(ShadowableLayer* aLayer);
LayersBackend GetParentBackendType();
protected:
ShadowLayerForwarder();
@ -324,6 +328,7 @@ private:
static void PlatformSyncBeforeUpdate();
Transaction* mTxn;
LayersBackend mParentBackend;
};

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

@ -444,6 +444,13 @@ ShadowLayersParent::RecvUpdate(const InfallibleTArray<Edit>& cset,
return true;
}
bool
ShadowLayersParent::RecvGetParentType(LayersBackend* aBackend)
{
*aBackend = layer_manager()->GetBackendType();
return true;
}
PLayerParent*
ShadowLayersParent::AllocPLayer()
{

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

@ -72,6 +72,8 @@ protected:
NS_OVERRIDE virtual bool RecvUpdate(const EditArray& cset,
EditReplyArray* reply);
NS_OVERRIDE virtual bool RecvGetParentType(LayersBackend* aBackend);
NS_OVERRIDE virtual PLayerParent* AllocPLayer();
NS_OVERRIDE virtual bool DeallocPLayer(PLayerParent* actor);

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

@ -51,6 +51,7 @@
#include "nsRect.h"
#include "nsRegion.h"
#include "gfxASurface.h"
#include "Layers.h"
#ifdef _MSC_VER
#pragma warning( disable : 4800 )
@ -65,10 +66,13 @@
namespace base { class FileDescriptor { }; }
#endif
using mozilla::layers::LayerManager;
namespace mozilla {
typedef gfxPattern::GraphicsFilter GraphicsFilterType;
typedef gfxASurface::gfxSurfaceType gfxSurfaceType;
typedef LayerManager::LayersBackend LayersBackend;
// XXX there are out of place and might be generally useful. Could
// move to nscore.h or something.
@ -498,6 +502,35 @@ struct ParamTraits<mozilla::gfxSurfaceType>
}
};
template<>
struct ParamTraits<mozilla::LayersBackend>
{
typedef mozilla::LayersBackend paramType;
static void Write(Message* msg, const paramType& param)
{
if (LayerManager::LAYERS_NONE < param &&
param < LayerManager::LAYERS_LAST) {
WriteParam(msg, int32(param));
return;
}
NS_RUNTIMEABORT("surface type not reached");
}
static bool Read(const Message* msg, void** iter, paramType* result)
{
int32 type;
if (!ReadParam(msg, iter, &type))
return false;
if (LayerManager::LAYERS_NONE < type &&
type < LayerManager::LAYERS_LAST) {
*result = paramType(type);
return true;
}
return false;
}
};
template<>
struct ParamTraits<gfxRGBA>