Remove unused COM shutdown logic. (#32381)
authorAaron Robinson <arobins@microsoft.com>
Sat, 15 Feb 2020 23:26:47 +0000 (15:26 -0800)
committerGitHub <noreply@github.com>
Sat, 15 Feb 2020 23:26:47 +0000 (15:26 -0800)
src/coreclr/src/vm/ceemain.cpp
src/coreclr/src/vm/ceemain.h
src/coreclr/src/vm/rcwwalker.cpp
src/coreclr/src/vm/rcwwalker.h
src/coreclr/src/vm/runtimecallablewrapper.cpp
src/coreclr/src/vm/runtimecallablewrapper.h
src/coreclr/src/vm/synchronizationcontextnative.cpp
src/coreclr/src/vm/synchronizationcontextnative.h
src/coreclr/src/vm/vars.cpp
src/coreclr/src/vm/vars.hpp

index 0f2a8b0..b7f8b4a 100644 (file)
 #include "profilinghelper.h"
 #endif // PROFILING_SUPPORTED
 
-#ifdef FEATURE_COMINTEROP
-#include "synchronizationcontextnative.h"       // For SynchronizationContextNative::Cleanup
-#endif
-
 #ifdef FEATURE_INTERPRETER
 #include "interpreter.h"
 #endif // FEATURE_INTERPRETER
@@ -1163,41 +1159,6 @@ HRESULT EEStartup(COINITIEE fFlags)
 
 #ifndef CROSSGEN_COMPILE
 
-#ifdef FEATURE_COMINTEROP
-
-void InnerCoEEShutDownCOM()
-{
-    CONTRACTL
-    {
-        THROWS;
-        GC_TRIGGERS;
-        MODE_ANY;
-    } CONTRACTL_END;
-
-    static LONG AlreadyDone = -1;
-
-    if (g_fEEStarted != TRUE)
-        return;
-
-    if (FastInterlockIncrement(&AlreadyDone) != 0)
-        return;
-
-    g_fShutDownCOM = true;
-
-    // Release IJupiterGCMgr *
-    RCWWalker::OnEEShutdown();
-
-    // Release all of the RCWs in all contexts in all caches.
-    ReleaseRCWsInCaches(NULL);
-
-#ifdef FEATURE_APPX
-    // Cleanup cached factory pointer in SynchronizationContextNative
-    SynchronizationContextNative::Cleanup();
-#endif
-}
-
-#endif // FEATURE_COMINTEROP
-
 // ---------------------------------------------------------------------------
 // %%Function: ForceEEShutdown()
 //
index 064d1f8..1d81c1c 100644 (file)
@@ -42,7 +42,6 @@ enum ShutdownCompleteAction
 
 // Force shutdown of the EE
 void ForceEEShutdown(ShutdownCompleteAction sca = SCA_ExitProcessWhenShutdownComplete);
-void InnerCoEEShutDownCOM();
 
 // We have an internal class that can be used to expose EE functionality to other CLR
 // DLLs, via the deliberately obscure IEE DLL exports from the shim and the EE
index 76b7ac2..5c94a3e 100644 (file)
@@ -526,25 +526,6 @@ void RCWWalker::BeforeJupiterRCWDestroyed(RCW *pRCW)
 }
 
 //
-// Cleanup stuff when EE is about to unload
-//
-void RCWWalker::OnEEShutdown()
-{
-    WRAPPER_NO_CONTRACT;
-
-    if (s_pGCManager)
-    {
-        LOG((LF_INTEROP, LL_INFO100, "[RCW Walker] Releasing RCWWalker::s_pIGCManager 0x%p\n", s_pGCManager));
-
-        // Make sure s_pGCManager is always either NULL or a valid IJupiterGCManager *
-        // this will make crash easier to diagnose
-        IJupiterGCManager *pGCManager = FastInterlockExchangePointer((IJupiterGCManager **)&s_pGCManager, NULL);
-        if (pGCManager != NULL)
-            pGCManager->Release();
-    }
-}
-
-//
 // Walk all the jupiter RCWs in all AppDomains and build references from RCW -> CCW as we go
 //
 void RCWWalker::WalkRCWs()
index f411fc5..0a532d8 100644 (file)
@@ -43,7 +43,6 @@ public :
     static void OnJupiterRCWCreated(RCW *pRCW, IJupiterObject *pJupiterObject);
     static void AfterJupiterRCWCreated(RCW *pRCW);
     static void BeforeJupiterRCWDestroyed(RCW *pRCW);
-    static void OnEEShutdown();
 
     //
     // Send out a AddRefFromTrackerSource callback to notify Jupiter we've done a AddRef
index acad5f2..f61ed2b 100644 (file)
@@ -4081,16 +4081,6 @@ BOOL RCW::AllowEagerSTACleanup()
     // with before calling this.
     _ASSERTE(GetSTAThread() != NULL);
 
-    // If the client has called CoEEShutdownCOM, then we should always try to
-    // clean up RCWs, even if they have previously opted out by calling
-    // DisableComObjectEagerCleanup. There's no way for clients to re-enable
-    // eager cleanup so, if we don't clean up now, they will be leaked. After
-    // shutting down COM, clients would not expect any RCWs to be left over.
-    if( g_fShutDownCOM )
-    {
-        return TRUE;
-    }
-
     return m_Flags.m_fAllowEagerSTACleanup;
 }
 
index ed1e95b..16b9e75 100644 (file)
@@ -90,8 +90,6 @@ class Thread;
 #define GC_PRESSURE_WINRT_HIGH    800000
 #endif // HOST_64BIT
 
-extern bool g_fShutDownCOM;
-
 enum {INTERFACE_ENTRY_CACHE_SIZE = 8};
 
 struct RCWAuxiliaryData;
index 52ca847..447053c 100644 (file)
@@ -149,22 +149,4 @@ void* QCALLTYPE SynchronizationContextNative::GetWinRTDispatcherForCurrentThread
     return result;
 }
 
-void SynchronizationContextNative::Cleanup()
-{
-    CONTRACTL
-    {
-        NOTHROW;
-        GC_TRIGGERS;
-        MODE_ANY;
-    } CONTRACTL_END;
-
-    if (g_pICoreWindowStatic)
-    {
-        SafeRelease(g_pICoreWindowStatic);
-        g_pICoreWindowStatic = NULL;
-    }
-}
-
-
-
 #endif //FEATURE_APPX
index 47b7f01..3d563c5 100644 (file)
@@ -21,7 +21,6 @@ public:
 
 #ifdef FEATURE_APPX
     static void* QCALLTYPE GetWinRTDispatcherForCurrentThread();
-    static void Cleanup();
 #endif
 };
 #endif // _SYNCHRONIZATIONCONTEXTNATIVE_H
index 2e3e8e9..ba0cac3 100644 (file)
@@ -207,9 +207,6 @@ GVAL_IMPL(SIZE_T, g_runtimeVirtualSize);
 Volatile<LONG> g_fForbidEnterEE = false;
 bool g_fManagedAttach = false;
 bool g_fNoExceptions = false;
-#ifdef FEATURE_COMINTEROP
-bool g_fShutDownCOM = false;
-#endif //FEATURE_COMINTEROP
 
 DWORD g_FinalizerWaiterStatus = 0;
 
index 7ea536b..65bb74f 100644 (file)
@@ -504,9 +504,6 @@ EXTERN Volatile<LONG> g_fForbidEnterEE;
 GVAL_DECL(bool, g_fProcessDetach);
 EXTERN bool g_fManagedAttach;
 EXTERN bool g_fNoExceptions;
-#ifdef FEATURE_COMINTEROP
-EXTERN bool g_fShutDownCOM;
-#endif // FEATURE_COMINTEROP
 
 // Indicates whether we're executing shut down as a result of DllMain
 // (DLL_PROCESS_DETACH). See comments at code:EEShutDown for details.