Bug 651192 - Part 3: Add IPC structures for AsyncBitmapModel. r=cjones
authorBas Schouten <bschouten@mozilla.com>
Thu, 16 Feb 2012 04:09:06 +0100
changeset 88271 54a134419d1b1cbc143bd1b6175ce74a6eeb3aa5
parent 88270 7ba25b39e2b3c0eac018688e603e7544b87cc69c
child 88272 12c2ab926f8e4226c7779f6f531b099e0fd6a8ae
push id157
push userMs2ger@gmail.com
push dateWed, 07 Mar 2012 19:27:10 +0000
reviewerscjones
bugs651192
milestone13.0a1
Bug 651192 - Part 3: Add IPC structures for AsyncBitmapModel. r=cjones
dom/plugins/ipc/PPluginInstance.ipdl
dom/plugins/ipc/PluginMessageUtils.h
--- a/dom/plugins/ipc/PPluginInstance.ipdl
+++ b/dom/plugins/ipc/PPluginInstance.ipdl
@@ -47,23 +47,25 @@ include protocol PPluginSurface;
 
 include "mozilla/plugins/PluginMessageUtils.h";
 include "IPC/nsGUIEventIPC.h";
 
 using NPError;
 using NPRemoteWindow;
 using NPRemoteEvent;
 using NPRect;
+using NPImageFormat;
 using NPNURLVariable;
 using NPCoordinateSpace;
 using mozilla::plugins::NativeWindowHandle;
 using mozilla::gfxSurfaceType;
 using gfxIntSize;
 using mozilla::null_t;
 using mozilla::plugins::WindowsSharedMemoryHandle;
+using mozilla::plugins::DXGISharedSurfaceHandle;
 using SurfaceDescriptorX11;
 using nsIntRect;
 using nsTextEvent;
 using nsKeyEvent;
 
 namespace mozilla {
 namespace plugins {
 
@@ -79,16 +81,30 @@ union SurfaceDescriptor {
   // Descriptor can be null here in case
   // 1) of first Show call (prevSurface is null)
   // 2) when child is going to destroy
   //    and it just want to grab prevSurface
   //     back without giving new surface
   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;
 
   manages PPluginBackgroundDestroyer;
   manages PPluginScriptableObject;
   manages PBrowserStream;
   manages PPluginStream;
--- a/dom/plugins/ipc/PluginMessageUtils.h
+++ b/dom/plugins/ipc/PluginMessageUtils.h
@@ -137,18 +137,20 @@ typedef XID NativeWindowHandle;
 #elif defined(XP_MACOSX) || defined(ANDROID) || defined(MOZ_WIDGET_QT)
 typedef intptr_t NativeWindowHandle; // never actually used, will always be 0
 #else
 #error Need NativeWindowHandle for this platform
 #endif
 
 #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?
 
 #define VARSTR(v_)  case v_: return #v_
 inline const char* const
 NPPVariableToString(NPPVariable aVar)
 {
@@ -350,16 +352,42 @@ struct ParamTraits<NPWindowType>
 
   static void Log(const paramType& aParam, std::wstring* aLog)
   {
     aLog->append(StringPrintf(L"%d", int16(aParam)));
   }
 };
 
 template <>
+struct ParamTraits<NPImageFormat>
+{
+  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<mozilla::plugins::NPRemoteWindow>
 {
   typedef mozilla::plugins::NPRemoteWindow paramType;
 
   static void Write(Message* aMsg, const paramType& aParam)
   {
     aMsg->WriteUInt64(aParam.window);
     WriteParam(aMsg, aParam.x);