Bug 855822 - Remove Add/RemoveLibraryMappingForChild. r=ted
authorMike Hommey <mh+mozilla@glandium.org>
Sat, 30 Mar 2013 10:32:10 +0100
changeset 127122 bb93e5fe985a67bca1689247a7d094e24e0d6af9
parent 127121 0b6ab22654e15b740ad9382ac148ec05a6a58ca2
child 127123 c99f1fd792db545e16245f64d9e27952258e99bf
push id270
push userpvanderbeken@mozilla.com
push dateThu, 06 Mar 2014 09:24:21 +0000
reviewersted
bugs855822
milestone22.0a1
Bug 855822 - Remove Add/RemoveLibraryMappingForChild. r=ted
dom/ipc/ContentChild.cpp
dom/ipc/CrashReporterParent.cpp
dom/ipc/CrashReporterParent.h
dom/ipc/PCrashReporter.ipdl
toolkit/crashreporter/nsExceptionHandler.cpp
toolkit/crashreporter/nsExceptionHandler.h
--- a/dom/ipc/ContentChild.cpp
+++ b/dom/ipc/ContentChild.cpp
@@ -303,31 +303,16 @@ ContentChild::Init(MessageLoop* aIOLoop,
     NS_ASSERTION(!sSingleton, "only one ContentChild per child");
 
     Open(aChannel, aParentHandle, aIOLoop);
     sSingleton = this;
 
 #ifdef MOZ_CRASHREPORTER
     SendPCrashReporterConstructor(CrashReporter::CurrentThreadId(),
                                   XRE_GetProcessType());
-#if defined(MOZ_WIDGET_ANDROID)
-    PCrashReporterChild* crashreporter = ManagedPCrashReporterChild()[0];
-
-    InfallibleTArray<Mapping> mappings;
-    const struct mapping_info *info = getLibraryMapping();
-    while (info && info->name) {
-        mappings.AppendElement(Mapping(nsDependentCString(info->name),
-                                       nsDependentCString(info->file_id),
-                                       info->base,
-                                       info->len,
-                                       info->offset));
-        info++;
-    }
-    crashreporter->SendAddLibraryMappings(mappings);
-#endif
 #endif
 
     SendGetProcessAttributes(&mID, &mIsForApp, &mIsForBrowser);
 
     if (mIsForApp && !mIsForBrowser) {
         SetProcessName(NS_LITERAL_STRING("(Preallocated app)"));
     } else {
         SetProcessName(NS_LITERAL_STRING("Browser"));
--- a/dom/ipc/CrashReporterParent.cpp
+++ b/dom/ipc/CrashReporterParent.cpp
@@ -10,41 +10,16 @@
 #include <time.h>
 
 using namespace base;
 
 namespace mozilla {
 namespace dom {
 
 void
-CrashReporterParent::ActorDestroy(ActorDestroyReason why)
-{
-#if defined(MOZ_WIDGET_ANDROID) && defined(MOZ_CRASHREPORTER)
-  CrashReporter::RemoveLibraryMappingsForChild(ProcessId(OtherProcess()));
-#endif
-}
-
-bool
-CrashReporterParent::RecvAddLibraryMappings(const InfallibleTArray<Mapping>& mappings)
-{
-#if defined(MOZ_WIDGET_ANDROID) && defined(MOZ_CRASHREPORTER)
-  for (uint32_t i = 0; i < mappings.Length(); i++) {
-    const Mapping& m = mappings[i];
-    CrashReporter::AddLibraryMappingForChild(ProcessId(OtherProcess()),
-                                             m.library_name().get(),
-                                             m.file_id().get(),
-                                             m.start_address(),
-                                             m.mapping_length(),
-                                             m.file_offset());
-  }
-#endif
-  return true;
-}
-
-void
 CrashReporterParent::AnnotateCrashReport(const nsCString& key,
                                          const nsCString& data)
 {
 #ifdef MOZ_CRASHREPORTER
     mNotes.Put(key, data);
 #endif
 }
 
--- a/dom/ipc/CrashReporterParent.h
+++ b/dom/ipc/CrashReporterParent.h
@@ -68,20 +68,16 @@ public:
   const nsString& ChildDumpID() {
     return mChildDumpID;
   }
 
   void
   AnnotateCrashReport(const nsCString& key, const nsCString& data);
 
  protected:
-  virtual void ActorDestroy(ActorDestroyReason why);
-
-  virtual bool
-    RecvAddLibraryMappings(const InfallibleTArray<Mapping>& m);
   virtual bool
     RecvAnnotateCrashReport(const nsCString& key, const nsCString& data) {
     AnnotateCrashReport(key, data);
     return true;
   }
   virtual bool
     RecvAppendAppNotes(const nsCString& data);
 
--- a/dom/ipc/PCrashReporter.ipdl
+++ b/dom/ipc/PCrashReporter.ipdl
@@ -16,16 +16,15 @@ struct Mapping {
   uintptr_t start_address;
   size_t mapping_length;
   size_t file_offset;
 };
 
 protocol PCrashReporter {
   manager PContent or PPluginModule;
 parent:
-  AddLibraryMappings(Mapping[] m);
   AnnotateCrashReport(nsCString key, nsCString data);
   AppendAppNotes(nsCString data);
   __delete__();
 };
 
 }
 }
--- a/toolkit/crashreporter/nsExceptionHandler.cpp
+++ b/toolkit/crashreporter/nsExceptionHandler.cpp
@@ -349,17 +349,16 @@ typedef struct {
   std::string name;
   std::string debug_id;
   uintptr_t   start_address;
   size_t      length;
   size_t      file_offset;
 } mapping_info;
 static std::vector<mapping_info> library_mappings;
 typedef std::map<uint32_t,google_breakpad::MappingList> MappingMap;
-static MappingMap child_library_mappings;
 
 void FileIDToGUID(const char* file_id, u_int8_t guid[sizeof(MDGUID)])
 {
   for (int i = 0; i < sizeof(MDGUID); i++) {
     int c;
     sscanf(file_id, "%02X", &c);
     guid[i] = (u_int8_t)(c & 0xFF);
     file_id += 2;
@@ -2844,41 +2843,11 @@ void AddLibraryMapping(const char* libra
     FileIDToGUID(file_id, guid);
     gExceptionHandler->AddMappingInfo(library_name,
                                       guid,
                                       start_address,
                                       mapping_length,
                                       file_offset);
   }
 }
-
-void AddLibraryMappingForChild(uint32_t    childPid,
-                               const char* library_name,
-                               const char* file_id,
-                               uintptr_t   start_address,
-                               size_t      mapping_length,
-                               size_t      file_offset)
-{
-  if (child_library_mappings.find(childPid) == child_library_mappings.end())
-    child_library_mappings[childPid] = google_breakpad::MappingList();
-  google_breakpad::MappingInfo info;
-  info.start_addr = start_address;
-  info.size = mapping_length;
-  info.offset = file_offset;
-  strcpy(info.name, library_name);
-
-  struct google_breakpad::MappingEntry mapping;
-  mapping.first = info;
-  u_int8_t guid[sizeof(MDGUID)];
-  FileIDToGUID(file_id, guid);
-  memcpy(mapping.second, guid, sizeof(MDGUID));
-  child_library_mappings[childPid].push_back(mapping);
-}
-
-void RemoveLibraryMappingsForChild(uint32_t childPid)
-{
-  MappingMap::iterator iter = child_library_mappings.find(childPid);
-  if (iter != child_library_mappings.end())
-    child_library_mappings.erase(iter);
-}
 #endif
 
 } // namespace CrashReporter
--- a/toolkit/crashreporter/nsExceptionHandler.h
+++ b/toolkit/crashreporter/nsExceptionHandler.h
@@ -186,19 +186,12 @@ bool UnsetRemoteExceptionHandler();
 // info about the shared libraries that are mapped into these anonymous
 // mappings.
 void AddLibraryMapping(const char* library_name,
                        const char* file_id,
                        uintptr_t   start_address,
                        size_t      mapping_length,
                        size_t      file_offset);
 
-void AddLibraryMappingForChild(uint32_t    childPid,
-                               const char* library_name,
-                               const char* file_id,
-                               uintptr_t   start_address,
-                               size_t      mapping_length,
-                               size_t      file_offset);
-void RemoveLibraryMappingsForChild(uint32_t childPid);
 #endif
 }
 
 #endif /* nsExceptionHandler_h__ */