From 9f2ab07bb61c42ffe2fc534078e4c7b4e45e7608 Mon Sep 17 00:00:00 2001 From: Bas Schouten Date: Thu, 16 Feb 2012 04:09:06 +0100 Subject: [PATCH] Bug 651192 - Part 3: Add IPC structures for AsyncBitmapModel. r=cjones --- dom/plugins/ipc/PPluginInstance.ipdl | 16 ++++++++++++++++ dom/plugins/ipc/PluginMessageUtils.h | 28 ++++++++++++++++++++++++++++ 2 files changed, 44 insertions(+) diff --git a/dom/plugins/ipc/PPluginInstance.ipdl b/dom/plugins/ipc/PPluginInstance.ipdl index 63597538168..95640f1733e 100644 --- a/dom/plugins/ipc/PPluginInstance.ipdl +++ b/dom/plugins/ipc/PPluginInstance.ipdl @@ -52,6 +52,7 @@ using NPError; using NPRemoteWindow; using NPRemoteEvent; using NPRect; +using NPImageFormat; using NPNURLVariable; using NPCoordinateSpace; using mozilla::plugins::NativeWindowHandle; @@ -59,6 +60,7 @@ using mozilla::gfxSurfaceType; using gfxIntSize; using mozilla::null_t; using mozilla::plugins::WindowsSharedMemoryHandle; +using mozilla::plugins::DXGISharedSurfaceHandle; using SurfaceDescriptorX11; using nsIntRect; using nsTextEvent; @@ -84,6 +86,20 @@ union SurfaceDescriptor { null_t; }; +union AsyncSurfaceDescriptor { + Shmem; + DXGISharedSurfaceHandle; +}; + +struct NPRemoteAsyncSurface +{ + uint32_t version; + gfxIntSize size; + NPImageFormat format; + uint32_t stride; + AsyncSurfaceDescriptor data; +}; + rpc protocol PPluginInstance { manager PPluginModule; diff --git a/dom/plugins/ipc/PluginMessageUtils.h b/dom/plugins/ipc/PluginMessageUtils.h index b48ffb74e22..ad7527a1f69 100644 --- a/dom/plugins/ipc/PluginMessageUtils.h +++ b/dom/plugins/ipc/PluginMessageUtils.h @@ -142,8 +142,10 @@ typedef intptr_t NativeWindowHandle; // never actually used, will always be 0 #ifdef XP_WIN typedef base::SharedMemoryHandle WindowsSharedMemoryHandle; +typedef HANDLE DXGISharedSurfaceHandle; #else typedef mozilla::null_t WindowsSharedMemoryHandle; +typedef mozilla::null_t DXGISharedSurfaceHandle; #endif // XXX maybe not the best place for these. better one? @@ -354,6 +356,32 @@ struct ParamTraits } }; +template <> +struct ParamTraits +{ + typedef NPImageFormat paramType; + + static void Write(Message* aMsg, const paramType& aParam) + { + aMsg->WriteInt16(int16(aParam)); + } + + static bool Read(const Message* aMsg, void** aIter, paramType* aResult) + { + int16 result; + if (aMsg->ReadInt16(aIter, &result)) { + *aResult = paramType(result); + return true; + } + return false; + } + + static void Log(const paramType& aParam, std::wstring* aLog) + { + aLog->append(StringPrintf(L"%d", int16(aParam))); + } +}; + template <> struct ParamTraits {