Bug 1378930 - Part 1: Remove nsINamed::SetName(). r=billm

MozReview-Commit-ID: 7aM1yJRsfPH

--HG--
extra : rebase_source : f207a37be835ac4e6c431af56737cebacf5c566d
This commit is contained in:
Bevis Tseng 2017-07-21 11:50:43 +08:00
Родитель 6d3d4f0f2d
Коммит d935b29e72
19 изменённых файлов: 40 добавлений и 178 удалений

Просмотреть файл

@ -244,11 +244,5 @@ TimeoutExecutor::GetName(nsACString& aNameOut)
return NS_OK;
}
NS_IMETHODIMP
TimeoutExecutor::SetName(const char* aName)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
} // namespace dom
} // namespace mozilla

Просмотреть файл

@ -1659,9 +1659,3 @@ nsContentSink::GetName(nsACString& aName)
aName.AssignASCII("nsContentSink_timer");
return NS_OK;
}
NS_IMETHODIMP
nsContentSink::SetName(const char* aName)
{
return NS_ERROR_NOT_IMPLEMENTED;
}

Просмотреть файл

@ -693,12 +693,6 @@ IdleRequestExecutor::GetName(nsACString& aName)
return NS_OK;
}
NS_IMETHODIMP
IdleRequestExecutor::SetName(const char* aName)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
IdleRequestExecutor::Run()
{

Просмотреть файл

@ -237,12 +237,6 @@ UITimerCallback::GetName(nsACString& aName)
return NS_OK;
}
NS_IMETHODIMP
UITimerCallback::SetName(const char* aName)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/******************************************************************/
/* mozilla::OverOutElementsWrapper */
/******************************************************************/

Просмотреть файл

@ -469,13 +469,6 @@ public:
return NS_OK;
}
NS_IMETHOD
SetName(const char* aName) override
{
MOZ_CRASH("The name shall never be set!");
return NS_OK;
}
private:
explicit ReleasingTimerHolder(nsTArray<nsWeakPtr>&& aArray)
: mURIs(aArray)

Просмотреть файл

@ -826,12 +826,6 @@ DecoderDoctorDocumentWatcher::GetName(nsACString& aName)
return NS_OK;
}
NS_IMETHODIMP
DecoderDoctorDocumentWatcher::SetName(const char* aName)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
void
DecoderDoctorDiagnostics::StoreFormatDiagnostics(nsIDocument* aDocument,
const nsAString& aFormat,

Просмотреть файл

@ -1214,9 +1214,6 @@ nsCSPContext::AsyncReportViolation(nsISupports* aBlockedContentSource,
if (XRE_IsContentProcess()) {
if (mEventTarget) {
if (nsCOMPtr<nsINamed> named = do_QueryInterface(task)) {
named->SetName("CSPReportSenderRunnable");
}
mEventTarget->Dispatch(task.forget(), NS_DISPATCH_NORMAL);
return NS_OK;
}

Просмотреть файл

@ -617,12 +617,6 @@ private:
return NS_OK;
}
NS_IMETHOD
SetName(const char* aName) override
{
return NS_ERROR_NOT_IMPLEMENTED;
}
void
LoadingFinished(uint32_t aIndex, nsresult aRv)
{

Просмотреть файл

@ -5202,11 +5202,7 @@ nsresult
WorkerPrivate::DispatchToMainThread(already_AddRefed<nsIRunnable> aRunnable,
uint32_t aFlags)
{
nsCOMPtr<nsIRunnable> runnable = aRunnable;
if (nsCOMPtr<nsINamed> named = do_QueryInterface(runnable)) {
named->SetName("WorkerRunnable");
}
return mMainThreadEventTarget->Dispatch(runnable.forget(), aFlags);
return mMainThreadEventTarget->Dispatch(Move(aRunnable), aFlags);
}
nsISerialEventTarget*

Просмотреть файл

@ -3954,12 +3954,6 @@ XMLHttpRequestMainThread::GetName(nsACString& aName)
return NS_OK;
}
NS_IMETHODIMP
XMLHttpRequestMainThread::SetName(const char* aName)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
// nsXMLHttpRequestXPCOMifier implementation
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsXMLHttpRequestXPCOMifier)
NS_INTERFACE_MAP_ENTRY(nsIStreamListener)

Просмотреть файл

@ -97,12 +97,6 @@ public:
return NS_OK;
}
NS_IMETHOD SetName(const char * aName) override
{
mName.Assign(aName);
return NS_OK;
}
private:
Function mFunction;
nsCString mName;

Просмотреть файл

@ -245,7 +245,6 @@ ShadowLayerForwarder::~ShadowLayerForwarder()
RefPtr<ReleaseOnMainThreadTask<ActiveResourceTracker>> event =
new ReleaseOnMainThreadTask<ActiveResourceTracker>(mActiveResourceTracker);
if (mEventTarget) {
event->SetName("ActiveResourceTracker::~ActiveResourceTracker");
mEventTarget->Dispatch(event.forget(), nsIEventTarget::DISPATCH_NORMAL);
} else {
NS_DispatchToMainThread(event);

Просмотреть файл

@ -1532,14 +1532,3 @@ nsMenuTimerMediator::GetName(nsACString& aName)
aName.AssignLiteral("nsMenuTimerMediator");
return NS_OK;
}
/**
* Set the name to this timer callback.
* @param aName the name to set
*/
NS_IMETHODIMP
nsMenuTimerMediator::SetName(const char* aName)
{
// We don't need to change the name for nsMenuTimerMediator.
return NS_ERROR_NOT_IMPLEMENTED;
}

Просмотреть файл

@ -240,12 +240,6 @@ nsAsyncRedirectVerifyHelper::GetName(nsACString& aName)
return NS_OK;
}
NS_IMETHODIMP
nsAsyncRedirectVerifyHelper::SetName(const char* aName)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
nsAsyncRedirectVerifyHelper::Run()
{

Просмотреть файл

@ -595,12 +595,6 @@ PendingAlertsCollector::GetName(nsACString& aName)
return NS_OK;
}
NS_IMETHODIMP
PendingAlertsCollector::SetName(const char* aName)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
nsresult
PendingAlertsCollector::Start(uint32_t timerDelayMS) {
if (mPending) {

Просмотреть файл

@ -173,16 +173,10 @@ SchedulerGroup::UnlabeledDispatch(const char* aName,
TaskCategory aCategory,
already_AddRefed<nsIRunnable>&& aRunnable)
{
nsCOMPtr<nsIRunnable> runnable(aRunnable);
if (aName) {
if (nsCOMPtr<nsINamed> named = do_QueryInterface(runnable)) {
named->SetName(aName);
}
}
if (NS_IsMainThread()) {
return NS_DispatchToCurrentThread(runnable.forget());
return NS_DispatchToCurrentThread(Move(aRunnable));
} else {
return NS_DispatchToMainThread(runnable.forget());
return NS_DispatchToMainThread(Move(aRunnable));
}
}

Просмотреть файл

@ -21,12 +21,4 @@ interface nsINamed : nsISupports
* never contain privacy sensitive information.
*/
readonly attribute ACString name;
/*
* Note: The string you pass in should be a compile-time literal.
*
* WARNING: This value will be included in telemetry, so it should
* never contain privacy sensitive information.
*/
[noscript] void setName(in string aName);
};

Просмотреть файл

@ -65,15 +65,6 @@ Runnable::GetName(nsACString& aName)
return NS_OK;
}
nsresult
Runnable::SetName(const char* aName)
{
#ifndef RELEASE_OR_BETA
mName = aName;
#endif
return NS_OK;
}
NS_IMPL_ISUPPORTS_INHERITED(CancelableRunnable, Runnable,
nsICancelableRunnable)

Просмотреть файл

@ -516,8 +516,8 @@ class RunnableFunction : public Runnable
{
public:
template <typename F>
explicit RunnableFunction(F&& aFunction)
: Runnable("RunnableFunction")
explicit RunnableFunction(const char* aName, F&& aFunction)
: Runnable(aName)
, mFunction(Forward<F>(aFunction))
{ }
@ -536,21 +536,6 @@ template<typename Function>
using RunnableFunctionImpl =
// Make sure we store a non-reference in nsRunnableFunction.
typename detail::RunnableFunction<typename RemoveReference<Function>::Type>;
template <typename T>
inline already_AddRefed<T>
SetRunnableName(const char* aName, T* aObj)
{
#ifdef RELEASE_OR_BETA
return do_AddRef(aObj);
#else
MOZ_RELEASE_ASSERT(aName);
RefPtr<T> ref(aObj);
ref->SetName(aName);
return ref.forget();
#endif
}
} // namespace detail
namespace detail {
@ -645,10 +630,9 @@ NS_NewRunnableFunction(const char* aName, Function&& aFunction)
{
// We store a non-reference in RunnableFunction, but still forward aFunction
// to move if possible.
return mozilla::detail::SetRunnableName(
aName,
return do_AddRef(
new mozilla::detail::RunnableFunctionImpl<Function>(
mozilla::Forward<Function>(aFunction)));
aName, mozilla::Forward<Function>(aFunction)));
}
namespace mozilla {
@ -722,7 +706,7 @@ class nsRunnableMethod
mozilla::CancelableRunnable,
mozilla::IdleRunnable>::Type>::Type;
public:
nsRunnableMethod() : BaseType("nsRunnableMethod") {}
nsRunnableMethod(const char* aName) : BaseType(aName) {}
virtual void Revoke() = 0;
@ -1191,9 +1175,10 @@ private:
}
public:
template<typename ForwardedPtrType, typename... Args>
explicit RunnableMethodImpl(ForwardedPtrType&& aObj, Method aMethod,
Args&&... aArgs)
: mReceiver(Forward<ForwardedPtrType>(aObj))
explicit RunnableMethodImpl(const char* aName, ForwardedPtrType&& aObj,
Method aMethod, Args&&... aArgs)
: BaseType(aName)
, mReceiver(Forward<ForwardedPtrType>(aObj))
, mMethod(aMethod)
, mArgs(Forward<Args>(aArgs)...)
{
@ -1402,30 +1387,27 @@ template<typename PtrType, typename Method>
already_AddRefed<detail::OwningRunnableMethod<PtrType, Method>>
NewRunnableMethod(const char* aName, PtrType&& aPtr, Method aMethod)
{
return detail::SetRunnableName(
aName,
return do_AddRef(
new detail::OwningRunnableMethodImpl<PtrType, Method>(
Forward<PtrType>(aPtr), aMethod));
aName, Forward<PtrType>(aPtr), aMethod));
}
template<typename PtrType, typename Method>
already_AddRefed<detail::CancelableRunnableMethod<PtrType, Method>>
NewCancelableRunnableMethod(const char* aName, PtrType&& aPtr, Method aMethod)
{
return detail::SetRunnableName(
aName,
return do_AddRef(
new detail::CancelableRunnableMethodImpl<PtrType, Method>(
Forward<PtrType>(aPtr), aMethod));
aName, Forward<PtrType>(aPtr), aMethod));
}
template<typename PtrType, typename Method>
already_AddRefed<detail::IdleRunnableMethod<PtrType, Method>>
NewIdleRunnableMethod(const char* aName, PtrType&& aPtr, Method aMethod)
{
return detail::SetRunnableName(
aName,
return do_AddRef(
new detail::IdleRunnableMethodImpl<PtrType, Method>(
Forward<PtrType>(aPtr), aMethod));
aName, Forward<PtrType>(aPtr), aMethod));
}
template<typename PtrType, typename Method>
@ -1434,20 +1416,18 @@ NewIdleRunnableMethodWithTimer(const char* aName,
PtrType&& aPtr,
Method aMethod)
{
return detail::SetRunnableName(
aName,
return do_AddRef(
new detail::IdleRunnableMethodWithTimerImpl<PtrType, Method>(
Forward<PtrType>(aPtr), aMethod));
aName, Forward<PtrType>(aPtr), aMethod));
}
template<typename PtrType, typename Method>
already_AddRefed<detail::NonOwningRunnableMethod<PtrType, Method>>
NewNonOwningRunnableMethod(const char* aName, PtrType&& aPtr, Method aMethod)
{
return detail::SetRunnableName(
aName,
return do_AddRef(
new detail::NonOwningRunnableMethodImpl<PtrType, Method>(
Forward<PtrType>(aPtr), aMethod));
aName, Forward<PtrType>(aPtr), aMethod));
}
template<typename PtrType, typename Method>
@ -1455,10 +1435,9 @@ already_AddRefed<detail::NonOwningCancelableRunnableMethod<PtrType, Method>>
NewNonOwningCancelableRunnableMethod(const char* aName, PtrType&& aPtr,
Method aMethod)
{
return detail::SetRunnableName(
aName,
return do_AddRef(
new detail::NonOwningCancelableRunnableMethodImpl<PtrType, Method>(
Forward<PtrType>(aPtr), aMethod));
aName, Forward<PtrType>(aPtr), aMethod));
}
template<typename PtrType, typename Method>
@ -1467,10 +1446,9 @@ NewNonOwningIdleRunnableMethod(const char* aName,
PtrType&& aPtr,
Method aMethod)
{
return detail::SetRunnableName(
aName,
return do_AddRef(
new detail::NonOwningIdleRunnableMethodImpl<PtrType, Method>(
Forward<PtrType>(aPtr), aMethod));
aName, Forward<PtrType>(aPtr), aMethod));
}
template<typename PtrType, typename Method>
@ -1479,10 +1457,9 @@ NewNonOwningIdleRunnableMethodWithTimer(const char* aName,
PtrType&& aPtr,
Method aMethod)
{
return detail::SetRunnableName(
aName,
return do_AddRef(
new detail::NonOwningIdleRunnableMethodWithTimerImpl<PtrType, Method>(
Forward<PtrType>(aPtr), aMethod));
aName, Forward<PtrType>(aPtr), aMethod));
}
// Similar to NewRunnableMethod. Call like so:
@ -1495,10 +1472,9 @@ NewRunnableMethod(const char* aName, PtrType&& aPtr, Method aMethod, Args&&... a
{
static_assert(sizeof...(Storages) == sizeof...(Args),
"<Storages...> size should be equal to number of arguments");
return detail::SetRunnableName(
aName,
return do_AddRef(
new detail::OwningRunnableMethodImpl<PtrType, Method, Storages...>(
Forward<PtrType>(aPtr), aMethod, mozilla::Forward<Args>(aArgs)...));
aName, Forward<PtrType>(aPtr), aMethod, mozilla::Forward<Args>(aArgs)...));
}
template<typename... Storages, typename PtrType, typename Method, typename... Args>
@ -1508,10 +1484,9 @@ NewNonOwningRunnableMethod(const char* aName, PtrType&& aPtr, Method aMethod,
{
static_assert(sizeof...(Storages) == sizeof...(Args),
"<Storages...> size should be equal to number of arguments");
return detail::SetRunnableName(
aName,
return do_AddRef(
new detail::NonOwningRunnableMethodImpl<PtrType, Method, Storages...>(
Forward<PtrType>(aPtr), aMethod, mozilla::Forward<Args>(aArgs)...));
aName, Forward<PtrType>(aPtr), aMethod, mozilla::Forward<Args>(aArgs)...));
}
template<typename... Storages, typename PtrType, typename Method, typename... Args>
@ -1521,10 +1496,9 @@ NewCancelableRunnableMethod(const char* aName, PtrType&& aPtr, Method aMethod,
{
static_assert(sizeof...(Storages) == sizeof...(Args),
"<Storages...> size should be equal to number of arguments");
return detail::SetRunnableName(
aName,
return do_AddRef(
new detail::CancelableRunnableMethodImpl<PtrType, Method, Storages...>(
Forward<PtrType>(aPtr), aMethod, mozilla::Forward<Args>(aArgs)...));
aName, Forward<PtrType>(aPtr), aMethod, mozilla::Forward<Args>(aArgs)...));
}
template<typename... Storages, typename PtrType, typename Method, typename... Args>
@ -1534,10 +1508,9 @@ NewNonOwningCancelableRunnableMethod(const char* aName, PtrType&& aPtr,
{
static_assert(sizeof...(Storages) == sizeof...(Args),
"<Storages...> size should be equal to number of arguments");
return detail::SetRunnableName(
aName,
return do_AddRef(
new detail::NonOwningCancelableRunnableMethodImpl<PtrType, Method, Storages...>(
Forward<PtrType>(aPtr), aMethod, mozilla::Forward<Args>(aArgs)...));
aName, Forward<PtrType>(aPtr), aMethod, mozilla::Forward<Args>(aArgs)...));
}
template<typename... Storages,
@ -1552,10 +1525,9 @@ NewIdleRunnableMethod(const char* aName,
{
static_assert(sizeof...(Storages) == sizeof...(Args),
"<Storages...> size should be equal to number of arguments");
return detail::SetRunnableName(
aName,
return do_AddRef(
new detail::IdleRunnableMethodImpl<PtrType, Method, Storages...>(
Forward<PtrType>(aPtr), aMethod, mozilla::Forward<Args>(aArgs)...));
aName, Forward<PtrType>(aPtr), aMethod, mozilla::Forward<Args>(aArgs)...));
}
template<typename... Storages,
@ -1570,10 +1542,9 @@ NewNonOwningIdleRunnableMethod(const char* aName,
{
static_assert(sizeof...(Storages) == sizeof...(Args),
"<Storages...> size should be equal to number of arguments");
return detail::SetRunnableName(
aName,
return do_AddRef(
new detail::NonOwningIdleRunnableMethodImpl<PtrType, Method, Storages...>(
Forward<PtrType>(aPtr), aMethod, mozilla::Forward<Args>(aArgs)...));
aName, Forward<PtrType>(aPtr), aMethod, mozilla::Forward<Args>(aArgs)...));
}
} // namespace mozilla