Bug 598862, part 2: Add a dummy base::FileDescriptor. r=bsmedberg
authorChris Jones <jones.chris.g@gmail.com>
Mon, 08 Nov 2010 20:48:59 -0600
changeset 57137 ed4fabb94ad82d6a33f20aa4b60fed26ef4e0cb8
parent 57136 ed1d65957bd0039d9fb72805306542108e900cfe
child 57138 f45d69fd9aaa5da1b6c6084c6909d80e1e26fa5e
push idunknown
push userunknown
push dateunknown
reviewersbsmedberg
bugs598862
milestone2.0b8pre
Bug 598862, part 2: Add a dummy base::FileDescriptor. r=bsmedberg
ipc/glue/IPCMessageUtils.h
--- a/ipc/glue/IPCMessageUtils.h
+++ b/ipc/glue/IPCMessageUtils.h
@@ -51,16 +51,24 @@
 #include "nsRect.h"
 #include "nsRegion.h"
 #include "gfxASurface.h"
 
 #ifdef _MSC_VER
 #pragma warning( disable : 4800 )
 #endif
 
+#if !defined(OS_POSIX)
+// This condition must be kept in sync with the one in
+// ipc_message_utils.h, but this dummy definition of
+// base::FileDescriptor acts as a static assert that we only get one
+// def or the other (or neither, in which case code using
+// FileDescriptor fails to build)
+namespace base { class FileDescriptor { }; }
+#endif
 
 namespace mozilla {
 
 typedef gfxPattern::GraphicsFilter GraphicsFilterType;
 typedef gfxASurface::gfxSurfaceType gfxSurfaceType;
 
 // XXX there are out of place and might be generally useful.  Could
 // move to nscore.h or something.
@@ -112,16 +120,32 @@ struct ParamTraits<PRUint8>
     if (!aMsg->ReadBytes(aIter, &outp, sizeof(*aResult)))
       return false;
 
     *aResult = *reinterpret_cast<const paramType*>(outp);
     return true;
   }
 };
 
+#if !defined(OS_POSIX)
+// See above re: keeping definitions in sync
+template<>
+struct ParamTraits<base::FileDescriptor>
+{
+  typedef base::FileDescriptor paramType;
+  static void Write(Message* aMsg, const paramType& aParam) {
+    NS_RUNTIMEABORT("FileDescriptor isn't meaningful on this platform");
+  }
+  static bool Read(const Message* aMsg, void** aIter, paramType* aResult) {
+    NS_RUNTIMEABORT("FileDescriptor isn't meaningful on this platform");
+    return false;
+  }
+};
+#endif  // !defined(OS_POSIX)
+
 template <>
 struct ParamTraits<nsACString>
 {
   typedef nsACString paramType;
 
   static void Write(Message* aMsg, const paramType& aParam)
   {
     bool isVoid = aParam.IsVoid();