☠☠ backed out by 3fee518242f6 ☠ ☠ | |
author | Michael Layzell <michael@thelayzells.com> |
Thu, 16 Feb 2017 14:38:09 -0500 | |
changeset 344618 | c8aeead6fe83a62d86c15decc9445a089ab2b717 |
parent 344617 | 422e63b872b5284a2f31cfaf36c1853a8f636a75 |
child 344619 | 19239f566a9332087f637930f14ee7c2bed086e6 |
push id | 31414 |
push user | cbook@mozilla.com |
push date | Fri, 24 Feb 2017 10:47:41 +0000 |
treeherder | mozilla-central@be661bae6cb9 [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | aklotz |
bugs | 1336510 |
milestone | 54.0a1 |
first release with | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
ipc/mscom/MainThreadHandoff.cpp | file | annotate | diff | comparison | revisions | |
ipc/mscom/WeakRef.cpp | file | annotate | diff | comparison | revisions |
--- a/ipc/mscom/MainThreadHandoff.cpp +++ b/ipc/mscom/MainThreadHandoff.cpp @@ -8,16 +8,17 @@ #include "mozilla/Move.h" #include "mozilla/mscom/InterceptorLog.h" #include "mozilla/mscom/Registration.h" #include "mozilla/mscom/Utils.h" #include "mozilla/Assertions.h" #include "mozilla/DebugOnly.h" #include "nsThreadUtils.h" +#include "nsProxyRelease.h" using mozilla::DebugOnly; namespace { class HandoffRunnable : public mozilla::Runnable { public: @@ -102,22 +103,21 @@ MainThreadHandoff::Release() { ULONG newRefCnt = (ULONG) InterlockedDecrement((LONG*)&mRefCnt); if (newRefCnt == 0) { // It is possible for the last Release() call to happen off-main-thread. // If so, we need to dispatch an event to delete ourselves. if (NS_IsMainThread()) { delete this; } else { - mozilla::DebugOnly<nsresult> rv = - NS_DispatchToMainThread(NS_NewRunnableFunction([=]() -> void - { - delete this; - })); - MOZ_ASSERT(NS_SUCCEEDED(rv)); + // We need to delete this object on the main thread, but we aren't on the + // main thread right now, so we send a reference to ourselves to the main + // thread to be re-released there. + RefPtr<MainThreadHandoff> self = this; + NS_ReleaseOnMainThread(self.forget()); } } return newRefCnt; } HRESULT MainThreadHandoff::OnCall(ICallFrame* aFrame) {
--- a/ipc/mscom/WeakRef.cpp +++ b/ipc/mscom/WeakRef.cpp @@ -6,16 +6,17 @@ #define INITGUID #include "mozilla/mscom/WeakRef.h" #include "mozilla/DebugOnly.h" #include "mozilla/Mutex.h" #include "nsThreadUtils.h" #include "nsWindowsHelpers.h" +#include "nsProxyRelease.h" static void InitializeCS(CRITICAL_SECTION& aCS) { DWORD flags = 0; #if defined(RELEASE_OR_BETA) flags |= CRITICAL_SECTION_NO_DEBUG_INFO; #endif @@ -142,24 +143,21 @@ WeakReferenceSupport::Release() mSharedRef->Clear(); } } NS_LOG_RELEASE(this, newRefCnt, "mscom::WeakReferenceSupport"); if (newRefCnt == 0) { if (mFlags != Flags::eDestroyOnMainThread || NS_IsMainThread()) { delete this; } else { - // It is possible for the last Release() call to happen off-main-thread. - // If so, we need to dispatch an event to delete ourselves. - mozilla::DebugOnly<nsresult> rv = - NS_DispatchToMainThread(NS_NewRunnableFunction([this]() -> void - { - delete this; - })); - MOZ_ASSERT(NS_SUCCEEDED(rv)); + // We need to delete this object on the main thread, but we aren't on the + // main thread right now, so we send a reference to ourselves to the main + // thread to be re-released there. + RefPtr<WeakReferenceSupport> self = this; + NS_ReleaseOnMainThread(self.forget()); } } return newRefCnt; } HRESULT WeakReferenceSupport::GetWeakReference(IWeakReference** aOutWeakRef) {