#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
#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()
//
// 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
}
//
-// 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()
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
// 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;
}
#define GC_PRESSURE_WINRT_HIGH 800000
#endif // HOST_64BIT
-extern bool g_fShutDownCOM;
-
enum {INTERFACE_ENTRY_CACHE_SIZE = 8};
struct RCWAuxiliaryData;
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
#ifdef FEATURE_APPX
static void* QCALLTYPE GetWinRTDispatcherForCurrentThread();
- static void Cleanup();
#endif
};
#endif // _SYNCHRONIZATIONCONTEXTNATIVE_H
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;
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.