Bug 1483650 - Remove the component registration for nsCycleCollectorLogger; r=mccr8

This commit is contained in:
Ehsan Akhgari 2018-08-16 16:47:54 -04:00
parent 7b9e74a701
commit e4ec6f1178
10 changed files with 35 additions and 35 deletions

View File

@ -687,8 +687,6 @@ interface nsIDOMWindowUtils : nsISupports {
* non-debug builds. Available to all callers in debug builds.
*
* @param aListener listener that receives information about the CC graph
* (see @mozilla.org/cycle-collector-logger;1 for a logger
* component)
*/
void garbageCollect([optional] in nsICycleCollectorListener aListener);
@ -699,8 +697,6 @@ interface nsIDOMWindowUtils : nsISupports {
* non-debug builds. Available to all callers in debug builds.
*
* @param aListener listener that receives information about the CC graph
* (see @mozilla.org/cycle-collector-logger;1 for a logger
* component)
*/
void cycleCollect([optional] in nsICycleCollectorListener aListener);

View File

@ -296,6 +296,14 @@ interface nsIXPCComponents_Utils : nsISupports
*/
void forceCC([optional] in nsICycleCollectorListener aListener);
/*
* To be called from JS only. C++ callers should use the
* nsCycleCollector_createLogger() function instead.
*
* Create an instance of the built-in cycle collector logger object.
*/
nsICycleCollectorListener createCCLogger();
/*
* To be called from JS only.
*

View File

@ -31,6 +31,7 @@
#include "mozilla/Scheduler.h"
#include "nsZipArchive.h"
#include "nsWindowMemoryReporter.h"
#include "nsICycleCollectorListener.h"
#include "nsIException.h"
#include "nsIScriptError.h"
#include "nsISimpleEnumerator.h"
@ -2317,6 +2318,16 @@ nsXPCComponents_Utils::ForceCC(nsICycleCollectorListener* listener)
return NS_OK;
}
NS_IMETHODIMP
nsXPCComponents_Utils::CreateCCLogger(nsICycleCollectorListener** aListener)
{
NS_ENSURE_ARG_POINTER(aListener);
nsCOMPtr<nsICycleCollectorListener> logger =
nsCycleCollector_createLogger();
logger.forget(aListener);
return NS_OK;
}
NS_IMETHODIMP
nsXPCComponents_Utils::FinishCC()
{

View File

@ -32,6 +32,7 @@
#include "nsDOMMutationObserver.h"
#include "nsICycleCollectorListener.h"
#include "nsCycleCollector.h"
#include "nsIObjectInputStream.h"
#include "nsIObjectOutputStream.h"
#include "nsScriptSecurityManager.h"
@ -1111,12 +1112,8 @@ DumpJSStack()
MOZ_EXPORT void
DumpCompleteHeap()
{
nsCOMPtr<nsICycleCollectorListener> listener =
do_CreateInstance("@mozilla.org/cycle-collector-logger;1");
if (!listener) {
NS_WARNING("Failed to create CC logger");
return;
}
nsCOMPtr<nsICycleCollectorListener> listener = nsCycleCollector_createLogger();
MOZ_ASSERT(listener);
nsCOMPtr<nsICycleCollectorListener> alltracesListener;
listener->AllTraces(getter_AddRefs(alltracesListener));

View File

@ -2050,18 +2050,11 @@ private:
NS_IMPL_ISUPPORTS(nsCycleCollectorLogger, nsICycleCollectorListener)
nsresult
nsCycleCollectorLoggerConstructor(nsISupports* aOuter,
const nsIID& aIID,
void** aInstancePtr)
already_AddRefed<nsICycleCollectorListener>
nsCycleCollector_createLogger()
{
if (NS_WARN_IF(aOuter)) {
return NS_ERROR_NO_AGGREGATION;
}
nsISupports* logger = new nsCycleCollectorLogger();
return logger->QueryInterface(aIID, aInstancePtr);
nsCOMPtr<nsICycleCollectorListener> logger = new nsCycleCollectorLogger();
return logger.forget();
}
static bool

View File

@ -46,6 +46,7 @@ bool nsCycleCollector_doDeferredDeletion();
bool nsCycleCollector_doDeferredDeletionWithBudget(js::SliceBudget& aBudget);
already_AddRefed<nsICycleCollectorLogSink> nsCycleCollector_createLogSink();
already_AddRefed<nsICycleCollectorListener> nsCycleCollector_createLogger();
void nsCycleCollector_collect(nsICycleCollectorListener* aManualListener);

View File

@ -16,7 +16,7 @@ interface nsIFile;
/**
* A set of interfaces for recording the cycle collector's work. An instance
* of @mozilla.org/cycle-collector-logger;1 can be configured to enable various
* of nsICycleCollectorListener can be configured to enable various
* options, then passed to the cycle collector when it runs.
* Note that additional logging options are available by setting environment
* variables, as described at the top of nsCycleCollector.cpp.
@ -24,7 +24,7 @@ interface nsIFile;
/**
* nsICycleCollectorHandler is the interface JS code should implement to
* receive the results logged by a @mozilla.org/cycle-collector-logger;1
* receive the results logged by an nsICycleCollectorListener
* instance. Pass an instance of this to the logger's 'processNext' method
* after the collection has run. This will describe the objects the cycle
* collector visited, the edges it found, and the conclusions it reached
@ -98,8 +98,10 @@ interface nsICycleCollectorLogSink : nsISupports
*
* To analyze cycle collection data in JS:
*
* - Create an instance of @mozilla.org/cycle-collector-logger;1, which
* implements this interface.
* - Create an instance of nsICycleCollectorListener, which implements this
* interface. In C++, this can be done by calling
* nsCycleCollector_createLogger(). In JS, this can be done by calling
* Components.utils.createCCLogger().
*
* - Set its |disableLog| property to true. This prevents the logger from
* printing messages about each method call to a temporary log file.

View File

@ -384,8 +384,7 @@ nsMemoryInfoDumper::DumpGCAndCCLogsToFile(const nsAString& aIdentifier,
}
}
nsCOMPtr<nsICycleCollectorListener> logger =
do_CreateInstance("@mozilla.org/cycle-collector-logger;1");
nsCOMPtr<nsICycleCollectorListener> logger = nsCycleCollector_createLogger();
if (aDumpAllTraces) {
nsCOMPtr<nsICycleCollectorListener> allTracesLogger;
@ -412,8 +411,7 @@ NS_IMETHODIMP
nsMemoryInfoDumper::DumpGCAndCCLogsToSink(bool aDumpAllTraces,
nsICycleCollectorLogSink* aSink)
{
nsCOMPtr<nsICycleCollectorListener> logger =
do_CreateInstance("@mozilla.org/cycle-collector-logger;1");
nsCOMPtr<nsICycleCollectorListener> logger = nsCycleCollector_createLogger();
if (aDumpAllTraces) {
nsCOMPtr<nsICycleCollectorListener> allTracesLogger;

View File

@ -72,5 +72,4 @@
COMPONENT_M(MEMORY_REPORTER_MANAGER, nsMemoryReporterManagerConstructor, Module::ALLOW_IN_GPU_PROCESS)
COMPONENT(MEMORY_INFO_DUMPER, nsMemoryInfoDumperConstructor)
COMPONENT(IOUTIL, nsIOUtilConstructor)
COMPONENT(CYCLE_COLLECTOR_LOGGER, nsCycleCollectorLoggerConstructor)
COMPONENT(MESSAGE_LOOP, nsMessageLoopConstructor)

View File

@ -76,11 +76,6 @@
*/
#define NS_MEMORY_INFO_DUMPER_CONTRACTID "@mozilla.org/memory-info-dumper;1"
/**
* Cycle collector logger contract id
*/
#define NS_CYCLE_COLLECTOR_LOGGER_CONTRACTID "@mozilla.org/cycle-collector-logger;1"
/**
* nsMessageLoop contract id
*/