Bug 1308652 - Part 1 - Remove about:bloat. r=froydnj, a=ritu
authorAndrew McCreight <continuation@gmail.com>
Mon, 10 Oct 2016 10:48:34 -0700
changeset 356064 b3ed087a00417c2df14aee87127ee3ddbca56e2e
parent 356063 2583041da3fcc262f616dab06abe6a5bd39b0e08
child 356065 ff79bdf882fc8278514fca6d0f7e8b06aef6da7a
push id6570
push userraliiev@mozilla.com
push dateMon, 14 Nov 2016 12:26:13 +0000
treeherdermozilla-beta@f455459b2ae5 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersfroydnj, ritu
bugs1308652
milestone51.0a2
Bug 1308652 - Part 1 - Remove about:bloat. r=froydnj, a=ritu MozReview-Commit-ID: 1FmdvLlygjq
netwerk/build/nsNetModule.cpp
netwerk/protocol/about/moz.build
netwerk/protocol/about/nsAboutBloat.cpp
--- a/netwerk/build/nsNetModule.cpp
+++ b/netwerk/build/nsNetModule.cpp
@@ -228,19 +228,16 @@ typedef mozilla::net::nsAboutProtocolHan
 typedef mozilla::net::nsSafeAboutProtocolHandler nsSafeAboutProtocolHandler;
 typedef mozilla::net::nsNestedAboutURI nsNestedAboutURI;
 NS_GENERIC_FACTORY_CONSTRUCTOR(nsAboutProtocolHandler)
 NS_GENERIC_FACTORY_CONSTRUCTOR(nsSafeAboutProtocolHandler)
 NS_GENERIC_FACTORY_CONSTRUCTOR(nsNestedAboutURI)
 
 #ifdef NECKO_PROTOCOL_about
 // about
-#ifdef NS_BUILD_REFCNT_LOGGING
-#include "nsAboutBloat.h"
-#endif
 #include "nsAboutCache.h"
 #include "nsAboutCacheEntry.h"
 NS_GENERIC_FACTORY_CONSTRUCTOR(nsAboutCacheEntry)
 #endif
 
 NS_GENERIC_FACTORY_CONSTRUCTOR(nsApplicationCacheService)
 NS_GENERIC_FACTORY_CONSTRUCTOR(nsApplicationCacheNamespace)
 NS_GENERIC_FACTORY_CONSTRUCTOR(nsApplicationCache)
@@ -806,19 +803,16 @@ NS_DEFINE_NAMED_CID(NS_RESPROTOCOLHANDLE
 NS_DEFINE_NAMED_CID(NS_EXTENSIONPROTOCOLHANDLER_CID);
 NS_DEFINE_NAMED_CID(NS_SUBSTITUTINGURL_CID);
 #endif
 NS_DEFINE_NAMED_CID(NS_ABOUTPROTOCOLHANDLER_CID);
 NS_DEFINE_NAMED_CID(NS_SAFEABOUTPROTOCOLHANDLER_CID);
 NS_DEFINE_NAMED_CID(NS_ABOUT_BLANK_MODULE_CID);
 NS_DEFINE_NAMED_CID(NS_NESTEDABOUTURI_CID);
 #ifdef NECKO_PROTOCOL_about
-#ifdef NS_BUILD_REFCNT_LOGGING
-NS_DEFINE_NAMED_CID(NS_ABOUT_BLOAT_MODULE_CID);
-#endif
 NS_DEFINE_NAMED_CID(NS_ABOUT_CACHE_MODULE_CID);
 NS_DEFINE_NAMED_CID(NS_ABOUT_CACHE_ENTRY_MODULE_CID);
 #endif
 NS_DEFINE_NAMED_CID(NS_SOCKSSOCKETPROVIDER_CID);
 NS_DEFINE_NAMED_CID(NS_SOCKS4SOCKETPROVIDER_CID);
 NS_DEFINE_NAMED_CID(NS_UDPSOCKETPROVIDER_CID);
 NS_DEFINE_NAMED_CID(NS_CACHESERVICE_CID);
 NS_DEFINE_NAMED_CID(NS_APPLICATIONCACHESERVICE_CID);
@@ -957,19 +951,16 @@ static const mozilla::Module::CIDEntry k
     { &kNS_EXTENSIONPROTOCOLHANDLER_CID, false, nullptr, mozilla::ExtensionProtocolHandlerConstructor },
     { &kNS_SUBSTITUTINGURL_CID, false, nullptr, mozilla::SubstitutingURLConstructor },
 #endif
     { &kNS_ABOUTPROTOCOLHANDLER_CID, false, nullptr, nsAboutProtocolHandlerConstructor },
     { &kNS_SAFEABOUTPROTOCOLHANDLER_CID, false, nullptr, nsSafeAboutProtocolHandlerConstructor },
     { &kNS_ABOUT_BLANK_MODULE_CID, false, nullptr, nsAboutBlank::Create },
     { &kNS_NESTEDABOUTURI_CID, false, nullptr, nsNestedAboutURIConstructor },
 #ifdef NECKO_PROTOCOL_about
-#ifdef NS_BUILD_REFCNT_LOGGING
-    { &kNS_ABOUT_BLOAT_MODULE_CID, false, nullptr, nsAboutBloat::Create },
-#endif
     { &kNS_ABOUT_CACHE_MODULE_CID, false, nullptr, nsAboutCache::Create },
     { &kNS_ABOUT_CACHE_ENTRY_MODULE_CID, false, nullptr, nsAboutCacheEntryConstructor },
 #endif
     { &kNS_SOCKSSOCKETPROVIDER_CID, false, nullptr, nsSOCKSSocketProvider::CreateV5 },
     { &kNS_SOCKS4SOCKETPROVIDER_CID, false, nullptr, nsSOCKSSocketProvider::CreateV4 },
     { &kNS_UDPSOCKETPROVIDER_CID, false, nullptr, nsUDPSocketProviderConstructor },
     { &kNS_CACHESERVICE_CID, false, nullptr, nsCacheService::Create },
     { &kNS_APPLICATIONCACHESERVICE_CID, false, nullptr, nsApplicationCacheServiceConstructor },
@@ -1117,19 +1108,16 @@ static const mozilla::Module::ContractID
 #ifdef NECKO_PROTOCOL_res
     { NS_NETWORK_PROTOCOL_CONTRACTID_PREFIX "resource", &kNS_RESPROTOCOLHANDLER_CID },
     { NS_NETWORK_PROTOCOL_CONTRACTID_PREFIX "moz-extension", &kNS_EXTENSIONPROTOCOLHANDLER_CID },
 #endif
     { NS_NETWORK_PROTOCOL_CONTRACTID_PREFIX "about", &kNS_ABOUTPROTOCOLHANDLER_CID },
     { NS_NETWORK_PROTOCOL_CONTRACTID_PREFIX "moz-safe-about", &kNS_SAFEABOUTPROTOCOLHANDLER_CID },
     { NS_ABOUT_MODULE_CONTRACTID_PREFIX "blank", &kNS_ABOUT_BLANK_MODULE_CID },
 #ifdef NECKO_PROTOCOL_about
-#ifdef NS_BUILD_REFCNT_LOGGING
-    { NS_ABOUT_MODULE_CONTRACTID_PREFIX "bloat", &kNS_ABOUT_BLOAT_MODULE_CID },
-#endif
     { NS_ABOUT_MODULE_CONTRACTID_PREFIX "cache", &kNS_ABOUT_CACHE_MODULE_CID },
     { NS_ABOUT_MODULE_CONTRACTID_PREFIX "cache-entry", &kNS_ABOUT_CACHE_ENTRY_MODULE_CID },
 #endif
     { NS_NETWORK_SOCKET_CONTRACTID_PREFIX "socks", &kNS_SOCKSSOCKETPROVIDER_CID },
     { NS_NETWORK_SOCKET_CONTRACTID_PREFIX "socks4", &kNS_SOCKS4SOCKETPROVIDER_CID },
     { NS_NETWORK_SOCKET_CONTRACTID_PREFIX "udp", &kNS_UDPSOCKETPROVIDER_CID },
     { NS_CACHESERVICE_CONTRACTID, &kNS_CACHESERVICE_CID },
     { NS_APPLICATIONCACHESERVICE_CONTRACTID, &kNS_APPLICATIONCACHESERVICE_CID },
--- a/netwerk/protocol/about/moz.build
+++ b/netwerk/protocol/about/moz.build
@@ -11,17 +11,16 @@ XPIDL_SOURCES += [
 XPIDL_MODULE = 'necko_about'
 
 EXPORTS += [
     'nsAboutProtocolUtils.h',
 ]
 
 UNIFIED_SOURCES += [
     'nsAboutBlank.cpp',
-    'nsAboutBloat.cpp',
     'nsAboutCache.cpp',
     'nsAboutCacheEntry.cpp',
     'nsAboutProtocolHandler.cpp',
 ]
 
 include('/ipc/chromium/chromium-config.mozbuild')
 
 FINAL_LIBRARY = 'xul'
deleted file mode 100644
--- a/netwerk/protocol/about/nsAboutBloat.cpp
+++ /dev/null
@@ -1,147 +0,0 @@
-/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#include "nsTraceRefcnt.h"
-
-// if NS_BUILD_REFCNT_LOGGING isn't defined, don't try to build
-#ifdef NS_BUILD_REFCNT_LOGGING
-
-#include "nsAboutBloat.h"
-#include "nsContentUtils.h"
-#include "nsStringStream.h"
-#include "nsIURI.h"
-#include "nsCOMPtr.h"
-#include "prtime.h"
-#include "nsDirectoryServiceDefs.h"
-#include "nsIFile.h"
-#include "nsNetUtil.h"
-
-static void GC_gcollect() {}
-
-NS_IMPL_ISUPPORTS(nsAboutBloat, nsIAboutModule)
-
-NS_IMETHODIMP
-nsAboutBloat::NewChannel(nsIURI* aURI,
-                         nsILoadInfo* aLoadInfo,
-                         nsIChannel** result)
-{
-    NS_ENSURE_ARG_POINTER(aURI);
-    nsresult rv;
-    nsAutoCString path;
-    rv = aURI->GetPath(path);
-    if (NS_FAILED(rv)) return rv;
-
-    nsTraceRefcnt::StatisticsType statType = nsTraceRefcnt::ALL_STATS;
-    bool clear = false;
-    bool leaks = false;
-
-    int32_t pos = path.Find("?");
-    if (pos > 0) {
-        nsAutoCString param;
-        (void)path.Right(param, path.Length() - (pos+1));
-        if (param.EqualsLiteral("new"))
-            statType = nsTraceRefcnt::NEW_STATS;
-        else if (param.EqualsLiteral("clear"))
-            clear = true;
-        else if (param.EqualsLiteral("leaks"))
-            leaks = true;
-    }
-
-    nsCOMPtr<nsIInputStream> inStr;
-    if (clear) {
-        nsTraceRefcnt::ResetStatistics();
-
-        rv = NS_NewCStringInputStream(getter_AddRefs(inStr),
-            NS_LITERAL_CSTRING("Bloat statistics cleared."));
-        if (NS_FAILED(rv)) return rv;
-    }
-    else if (leaks) {
-        // dump the current set of leaks.
-        GC_gcollect();
-
-        rv = NS_NewCStringInputStream(getter_AddRefs(inStr),
-            NS_LITERAL_CSTRING("Memory leaks dumped."));
-        if (NS_FAILED(rv)) return rv;
-    }
-    else {
-        nsCOMPtr<nsIFile> file;
-        rv = NS_GetSpecialDirectory(NS_OS_CURRENT_PROCESS_DIR,
-                                    getter_AddRefs(file));
-        if (NS_FAILED(rv)) return rv;
-
-        rv = file->AppendNative(NS_LITERAL_CSTRING("bloatlogs"));
-        if (NS_FAILED(rv)) return rv;
-
-        bool exists;
-        rv = file->Exists(&exists);
-        if (NS_FAILED(rv)) return rv;
-
-        if (!exists) {
-            // On all the platforms that I know use permissions,
-            // directories need to have the executable flag set
-            // if you want to do anything inside the directory.
-            rv = file->Create(nsIFile::DIRECTORY_TYPE, 0755);
-            if (NS_FAILED(rv)) return rv;
-        }
-
-        nsAutoCString dumpFileName;
-        if (statType == nsTraceRefcnt::ALL_STATS)
-            dumpFileName.AssignLiteral("all-");
-        else
-            dumpFileName.AssignLiteral("new-");
-        PRExplodedTime expTime;
-        PR_ExplodeTime(PR_Now(), PR_LocalTimeParameters, &expTime);
-        char time[128];
-        PR_FormatTimeUSEnglish(time, 128, "%Y-%m-%d-%H%M%S.txt", &expTime);
-        dumpFileName += time;
-        rv = file->AppendNative(dumpFileName);
-        if (NS_FAILED(rv)) return rv;
-
-        FILE* out;
-        rv = file->OpenANSIFileDesc("w", &out);
-        if (NS_FAILED(rv)) return rv;
-
-        rv = nsTraceRefcnt::DumpStatistics(statType, out);
-        ::fclose(out);
-        if (NS_FAILED(rv)) return rv;
-
-        rv = NS_NewLocalFileInputStream(getter_AddRefs(inStr), file);
-        if (NS_FAILED(rv)) return rv;
-    }
-
-    nsIChannel* channel = nullptr;
-    rv = NS_NewInputStreamChannelInternal(&channel,
-                                          aURI,
-                                          inStr,
-                                          NS_LITERAL_CSTRING("text/plain"),
-                                          NS_LITERAL_CSTRING("utf-8"),
-                                          aLoadInfo);
-    if (NS_FAILED(rv)) return rv;
-
-    *result = channel;
-    return rv;
-}
-
-NS_IMETHODIMP
-nsAboutBloat::GetURIFlags(nsIURI *aURI, uint32_t *result)
-{
-    *result = 0;
-    return NS_OK;
-}
-
-nsresult
-nsAboutBloat::Create(nsISupports *aOuter, REFNSIID aIID, void **aResult)
-{
-    nsAboutBloat* about = new nsAboutBloat();
-    if (about == nullptr)
-        return NS_ERROR_OUT_OF_MEMORY;
-    NS_ADDREF(about);
-    nsresult rv = about->QueryInterface(aIID, aResult);
-    NS_RELEASE(about);
-    return rv;
-}
-
-////////////////////////////////////////////////////////////////////////////////
-#endif /* NS_BUILD_REFCNT_LOGGING */