Bug 677787 - Remove unique_pointer from typelib code; r=khuey
authorEd Morley <bmo@edmorley.co.uk>
Sat, 20 Aug 2011 13:44:37 +0200
changeset 76910 d5514e9dd45c910d897c29c2ea4f1af013a22ef7
parent 76909 e5547e100b27b09e1d06eeb740313290664d2436
child 76911 46bdfa1f1eba14f6afb8be48e94c013da7852c43
push id78
push userclegnitto@mozilla.com
push dateFri, 16 Dec 2011 17:32:24 +0000
treeherdermozilla-release@79d24e644fdd [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerskhuey
bugs677787
milestone9.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 677787 - Remove unique_pointer from typelib code; r=khuey
xpcom/idl-parser/typelib.py
xpcom/reflect/xptinfo/public/xptinfo.h
xpcom/typelib/xpt/public/xpt_struct.h
xpcom/typelib/xpt/tools/runtests.py
xpcom/typelib/xpt/tools/xpt.py
--- a/xpcom/idl-parser/typelib.py
+++ b/xpcom/idl-parser/typelib.py
@@ -86,17 +86,16 @@ def build_interface(iface, ifaces):
                   return xpt.StringWithSizeType(size_is, size_is)
             elif type.name == 'wstring' and size_is != None:
                   return xpt.WideStringWithSizeType(size_is, size_is)
             else:
                   tag = TypeMap[type.name]
                   isPtr = (tag == xpt.Type.Tags.char_ptr or tag == xpt.Type.Tags.wchar_t_ptr)
                   return xpt.SimpleType(tag,
                                         pointer=isPtr,
-                                        #XXXkhuey unique_pointer is completely unused (bug 677787.)
                                         reference=False)
 
         if isinstance(type, xpidl.Array):
             return xpt.ArrayType(get_type(type.type, calltype), size_is,
                                  #XXXkhuey length_is duplicates size_is (bug 677788),
                                  size_is)
 
         if isinstance(type, xpidl.Interface) or isinstance(type, xpidl.Forward):
@@ -113,25 +112,23 @@ def build_interface(iface, ifaces):
 
         if isinstance(type, xpidl.Native):
             if type.specialtype:
                 # XXXkhuey jsval is marked differently in the typelib and in the headers :-(
                 isPtr = (type.isPtr(calltype) or type.isRef(calltype)) and not type.specialtype == 'jsval'
                 isRef = type.isRef(calltype) and not type.specialtype == 'jsval'
                 return xpt.SimpleType(TypeMap[type.specialtype],
                                       pointer=isPtr,
-                                      #XXXkhuey unique_pointer is completely unused
                                       reference=isRef)
             elif iid_is != None:
                 return xpt.InterfaceIsType(iid_is)
             else:
                 # void ptr
                 return xpt.SimpleType(TypeMap['void'],
                                       pointer=True,
-                                      #XXXkhuey unique_pointer is completely unused
                                       reference=False)
 
         raise Exception("Unknown type!")
 
     def get_nsresult():
         return xpt.SimpleType(TypeMap['nsresult'])
 
     def build_nsresult_param():
--- a/xpcom/reflect/xptinfo/public/xptinfo.h
+++ b/xpcom/reflect/xptinfo/public/xptinfo.h
@@ -69,19 +69,16 @@ public:
         {flags = other.flags; return *this;}
 
     operator PRUint8() const
         {return flags;}
 
     PRBool IsPointer() const
         {return 0 != (XPT_TDP_IS_POINTER(flags));}
 
-    PRBool IsUniquePointer() const
-        {return 0 != (XPT_TDP_IS_UNIQUE_POINTER(flags));}
-
     PRBool IsReference() const
         {return 0 != (XPT_TDP_IS_REFERENCE(flags));}
 
     PRBool IsArithmetic() const     // terminology from Harbison/Steele
         {return flags <= T_WCHAR;}
 
     PRBool IsInterfacePointer() const
         {  switch (TagPart()) {
--- a/xpcom/typelib/xpt/public/xpt_struct.h
+++ b/xpcom/typelib/xpt/public/xpt_struct.h
@@ -332,24 +332,22 @@ XPT_NewStringZ(XPTArena *arena, char *by
 
 /* why bother with a struct?  - other code relies on this being a struct */
 struct XPTTypeDescriptorPrefix {
     PRUint8 flags;
 };
 
 /* flag bits -- fur and jband were right, I was miserably wrong */
 #define XPT_TDP_POINTER          0x80
-#define XPT_TDP_UNIQUE_POINTER   0x40
 #define XPT_TDP_REFERENCE        0x20
 #define XPT_TDP_FLAGMASK         0xe0
 #define XPT_TDP_TAGMASK          (~XPT_TDP_FLAGMASK)
 #define XPT_TDP_TAG(tdp)         ((tdp).flags & XPT_TDP_TAGMASK)
 
 #define XPT_TDP_IS_POINTER(flags)        (flags & XPT_TDP_POINTER)
-#define XPT_TDP_IS_UNIQUE_POINTER(flags) (flags & XPT_TDP_UNIQUE_POINTER)
 #define XPT_TDP_IS_REFERENCE(flags)      (flags & XPT_TDP_REFERENCE)
 
 /* 
  * The following enum maps mnemonic names to the different numeric values 
  * of XPTTypeDescriptor->tag.
  */
 enum XPTTypeDescriptorTags {
     TD_INT8              = 0,
--- a/xpcom/typelib/xpt/tools/runtests.py
+++ b/xpcom/typelib/xpt/tools/runtests.py
@@ -153,17 +153,16 @@ class TypelibCompareMixin:
         self.assertEqual(p1.optional, p2.optional)
         
     def assertEqualTypes(self, t1, t2):
         self.assert_(t1 is not None, "Should not be None")
         self.assert_(t2 is not None, "Should not be None")
         self.assertEqual(type(t1), type(t2), "type types should be equal")
         self.assertEqual(t1.pointer, t2.pointer,
                          "pointer flag should be equal for %s and %s" % (t1, t2))
-        self.assertEqual(t1.unique_pointer, t2.unique_pointer)
         self.assertEqual(t1.reference, t2.reference)
         if isinstance(t1, xpt.SimpleType):
             self.assertEqual(t1.tag, t2.tag)
         elif isinstance(t1, xpt.InterfaceType):
             self.assertEqualInterfaces(t1.iface, t2.iface)
         elif isinstance(t1, xpt.InterfaceIsType):
             self.assertEqual(t1.param_index, t2.param_index)
         elif isinstance(t1, xpt.ArrayType):
--- a/xpcom/typelib/xpt/tools/xpt.py
+++ b/xpcom/typelib/xpt/tools/xpt.py
@@ -136,48 +136,44 @@ class Type(object):
         #XXX: These are also SimpleTypes (but not in the spec)
         # http://hg.mozilla.org/mozilla-central/annotate/0e0e2516f04e/xpcom/typelib/xpt/tools/xpt_dump.c#l69
         'UTF8String',
         'CString',
         'AString',
         'jsval',
         )
 
-    def __init__(self, pointer=False, unique_pointer=False, reference=False):
+    def __init__(self, pointer=False, reference=False):
         self.pointer = pointer
-        self.unique_pointer = unique_pointer
         self.reference = reference
         if reference and not pointer:
             raise Exception("If reference is True pointer must be True too")
 
     @staticmethod
     def decodeflags(byte):
         """
         Given |byte|, an unsigned uint8 containing flag bits,
         decode the flag bits as described in
         http://www.mozilla.org/scriptable/typelib_file.html#TypeDescriptor
         and return a dict of flagname: (True|False) suitable
         for passing to Type.__init__ as **kwargs.
         
         """
         return {'pointer': bool(byte & 0x80),
-                'unique_pointer': bool(byte & 0x40),
                 'reference': bool(byte & 0x20),
                 }
 
     def encodeflags(self):
         """
         Encode the flag bits of this Type object. Returns a byte.
 
         """
         flags = 0
         if self.pointer:
             flags |= 0x80
-        if self.unique_pointer:
-            flags |= 0x40
         if self.reference:
             flags |= 0x20
         return flags
     
     @staticmethod
     def read(typelib, map, data_pool, offset):
         """
         Read a TypeDescriptor at |offset| from the mmaped file |map| with