BREAKING remove some top-level code for registering XPTs draft
authorAndrew McCreight <continuation@gmail.com>
Wed, 28 Feb 2018 12:16:47 -0800
changeset 762240 9e602b48c3fa45d493b4a7166f0599d452f9cff4
parent 762239 90832bcf1c0bfddac2997ef210c16b162ca595e3
child 762241 0411d7053af9845c8837bd90aa86d33feb372c83
push id101107
push userbmo:continuation@gmail.com
push dateThu, 01 Mar 2018 22:22:59 +0000
milestone60.0a1
BREAKING remove some top-level code for registering XPTs MozReview-Commit-ID: 32MrMj8r3Ym
xpcom/components/nsComponentManager.cpp
xpcom/reflect/xptinfo/XPTInterfaceInfoManager.h
xpcom/reflect/xptinfo/xptiInterfaceInfoManager.cpp
--- a/xpcom/components/nsComponentManager.cpp
+++ b/xpcom/components/nsComponentManager.cpp
@@ -576,34 +576,19 @@ nsComponentManagerImpl::ManifestBinaryCo
 {
   LogMessageWithContext(aCx.mFile, aLineNo,
                         "Binary XPCOM components are no longer supported.");
 }
 
 static void
 DoRegisterXPT(FileLocation& aFile)
 {
-  uint32_t len;
-  FileLocation::Data data;
-  UniquePtr<char[]> buf;
-  nsresult rv = aFile.GetData(data);
-  if (NS_SUCCEEDED(rv)) {
-    rv = data.GetSize(&len);
-  }
-  if (NS_SUCCEEDED(rv)) {
-    buf = MakeUnique<char[]>(len);
-    rv = data.Copy(buf.get(), len);
-  }
-  if (NS_SUCCEEDED(rv)) {
-    XPTInterfaceInfoManager::GetSingleton()->RegisterBuffer(buf.get(), len);
-  } else {
-    nsCString uri;
-    aFile.GetURIString(uri);
-    LogMessage("Could not read '%s'.", uri.get());
-  }
+  // XXX Registering XPTs will have to happen in autogenerated code.
+
+  // XXX Need to remove this, and whatever else calls into it.
 }
 
 void
 nsComponentManagerImpl::ManifestXPT(ManifestProcessingContext& aCx,
                                     int aLineNo, char* const* aArgv)
 {
   FileLocation f(aCx.mFile, aArgv[0]);
   DoRegisterXPT(f);
--- a/xpcom/reflect/xptinfo/XPTInterfaceInfoManager.h
+++ b/xpcom/reflect/xptinfo/XPTInterfaceInfoManager.h
@@ -34,35 +34,33 @@ class XPTInterfaceInfoManager final
 
 public:
     // GetSingleton() is infallible
     static XPTInterfaceInfoManager* GetSingleton();
     static void FreeInterfaceInfoManager();
 
     void GetScriptableInterfaces(nsCOMArray<nsIInterfaceInfo>& aInterfaces);
 
-    void RegisterBuffer(char *buf, uint32_t length);
+    void RegisterXPTHeader(const XPTHeader* aHeader);
 
     static Mutex& GetResolveLock()
     {
         return GetSingleton()->mResolveLock;
     }
 
     xptiInterfaceEntry* GetInterfaceEntryForIID(const nsIID *iid);
 
     size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf);
 
 private:
     XPTInterfaceInfoManager();
     ~XPTInterfaceInfoManager();
 
     void InitMemoryReporter();
 
-    void RegisterXPTHeader(const XPTHeader* aHeader);
-
     // idx is the index of this interface in the XPTHeader
     void VerifyAndAddEntryIfNew(const XPTHeader* header,
                                 uint16_t idx,
                                 xptiTypelibGuts* typelib);
 
 private:
 
     class xptiWorkingSet
--- a/xpcom/reflect/xptinfo/xptiInterfaceInfoManager.cpp
+++ b/xpcom/reflect/xptinfo/xptiInterfaceInfoManager.cpp
@@ -93,34 +93,16 @@ XPTInterfaceInfoManager::~XPTInterfaceIn
 
 void
 XPTInterfaceInfoManager::InitMemoryReporter()
 {
     RegisterWeakMemoryReporter(this);
 }
 
 void
-XPTInterfaceInfoManager::RegisterBuffer(char *buf, uint32_t length)
-{
-    XPTState state;
-    XPT_InitXDRState(&state, buf, length);
-
-    XPTCursor curs;
-    NotNull<XPTCursor*> cursor = WrapNotNull(&curs);
-    if (!XPT_MakeCursor(&state, XPT_HEADER, 0, cursor)) {
-        return;
-    }
-
-    XPTHeader *header = nullptr;
-    if (XPT_DoHeader(gXPTIStructArena, cursor, &header)) {
-        RegisterXPTHeader(header);
-    }
-}
-
-void
 XPTInterfaceInfoManager::RegisterXPTHeader(const XPTHeader* aHeader)
 {
     if (aHeader->major_version >= XPT_MAJOR_INCOMPATIBLE_VERSION) {
         NS_ASSERTION(!aHeader->num_interfaces,"bad libxpt");
         LOG_AUTOREG(("      file is version %d.%d  Type file of version %d.0 or higher can not be read.\n", (int)header->major_version, (int)header->minor_version, (int)XPT_MAJOR_INCOMPATIBLE_VERSION));
     }
 
     xptiTypelibGuts* typelib = xptiTypelibGuts::Create(aHeader);