Bug 996061 - part 1 - add GetEntryNameAt method for typelibs; r=bholley
authorNathan Froyd <froydnj@mozilla.com>
Fri, 16 May 2014 16:48:29 -0400
changeset 206982 d9e56658ef051dc9c4d973004cf93a3ffa26434a
parent 206981 e3253a7cb5d4726cbb1a59f0a8c9fef887d438d2
child 206983 5c2eaff26d0c1b2b3ff47ecdc61d611369796468
push id494
push userraliiev@mozilla.com
push dateMon, 25 Aug 2014 18:42:16 +0000
treeherdermozilla-release@a3cc3e46b571 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbholley
bugs996061
milestone32.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 996061 - part 1 - add GetEntryNameAt method for typelibs; r=bholley xpt linking works with two different currencies: UUIDs of interfaces, and names of interfaces. Names are how we support linking in unknown-at-compile-time interfaces at runtime. Since we need to know names to decide whether we have shims for interfaces or not, we need a method for exposing the names.
xpcom/reflect/xptinfo/src/xptiTypelibGuts.cpp
xpcom/reflect/xptinfo/src/xptiprivate.h
--- a/xpcom/reflect/xptinfo/src/xptiTypelibGuts.cpp
+++ b/xpcom/reflect/xptinfo/src/xptiTypelibGuts.cpp
@@ -50,8 +50,19 @@ xptiTypelibGuts::GetEntryAt(uint16_t i)
             r = set.mIIDTable.Get(iface->iid);
     }
 
     if (r)
         SetEntryAt(i, r);
 
     return r;
 }
+
+const char*
+xptiTypelibGuts::GetEntryNameAt(uint16_t i)
+{
+    NS_ASSERTION(mHeader, "bad state");
+    NS_ASSERTION(i < GetEntryCount(), "bad index");
+
+    XPTInterfaceDirectoryEntry* iface = mHeader->interface_directory + i;
+
+    return iface->name;
+}
--- a/xpcom/reflect/xptinfo/src/xptiprivate.h
+++ b/xpcom/reflect/xptinfo/src/xptiprivate.h
@@ -98,16 +98,17 @@ public:
     void                SetEntryAt(uint16_t i, xptiInterfaceEntry* ptr)
     {
         NS_ASSERTION(mHeader,"bad state!");
         NS_ASSERTION(i < GetEntryCount(),"bad param!");
         mEntryArray[i] = ptr;
     }        
 
     xptiInterfaceEntry* GetEntryAt(uint16_t i);
+    const char* GetEntryNameAt(uint16_t i);
 
 private:
     xptiTypelibGuts(XPTHeader* aHeader)
         : mHeader(aHeader)
     { }
     ~xptiTypelibGuts();
 
 private: