| 1 | // Licensed to the .NET Foundation under one or more agreements. |
|---|---|
| 2 | // The .NET Foundation licenses this file to you under the MIT license. |
| 3 | // See the LICENSE file in the project root for more information. |
| 4 | /*============================================================ |
| 5 | ** |
| 6 | ** Header: AppDomain.i |
| 7 | ** |
| 8 | |
| 9 | ** |
| 10 | ** Purpose: Implements AppDomain (loader domain) architecture |
| 11 | ** inline functions |
| 12 | ** |
| 13 | ** |
| 14 | ===========================================================*/ |
| 15 | #ifndef _APPDOMAIN_I |
| 16 | #define _APPDOMAIN_I |
| 17 | |
| 18 | #ifndef DACCESS_COMPILE |
| 19 | |
| 20 | #include "appdomain.hpp" |
| 21 | |
| 22 | inline DomainAssembly* AppDomain::FindDomainAssembly(Assembly* assembly) |
| 23 | { |
| 24 | CONTRACTL |
| 25 | { |
| 26 | GC_NOTRIGGER; |
| 27 | MODE_COOPERATIVE; |
| 28 | PRECONDITION(CheckPointer(assembly)); |
| 29 | } |
| 30 | CONTRACTL_END; |
| 31 | return assembly->FindDomainAssembly(this); |
| 32 | }; |
| 33 | |
| 34 | inline BOOL AppDomain::IsRunningIn(Thread* pThread) |
| 35 | { |
| 36 | WRAPPER_NO_CONTRACT; |
| 37 | if (IsDefaultDomain()) |
| 38 | return TRUE; |
| 39 | return pThread->IsRunningIn(this, NULL)!=NULL; |
| 40 | } |
| 41 | |
| 42 | |
| 43 | |
| 44 | inline void AppDomain::AddMemoryPressure() |
| 45 | { |
| 46 | STANDARD_VM_CONTRACT; |
| 47 | m_MemoryPressure=EstimateSize(); |
| 48 | GCInterface::AddMemoryPressure(m_MemoryPressure); |
| 49 | } |
| 50 | |
| 51 | inline void AppDomain::RemoveMemoryPressure() |
| 52 | { |
| 53 | WRAPPER_NO_CONTRACT; |
| 54 | |
| 55 | GCInterface::RemoveMemoryPressure(m_MemoryPressure); |
| 56 | } |
| 57 | |
| 58 | #endif // DACCESS_COMPILE |
| 59 | |
| 60 | inline AppDomain::PathIterator AppDomain::IterateNativeDllSearchDirectories() |
| 61 | { |
| 62 | WRAPPER_NO_CONTRACT; |
| 63 | PathIterator i; |
| 64 | i.m_i = m_NativeDllSearchDirectories.Iterate(); |
| 65 | return i; |
| 66 | } |
| 67 | |
| 68 | inline BOOL AppDomain::HasNativeDllSearchDirectories() |
| 69 | { |
| 70 | WRAPPER_NO_CONTRACT; |
| 71 | return m_NativeDllSearchDirectories.GetCount() !=0; |
| 72 | } |
| 73 | |
| 74 | inline bool AppDomain::MustForceTrivialWaitOperations() |
| 75 | { |
| 76 | LIMITED_METHOD_CONTRACT; |
| 77 | return m_ForceTrivialWaitOperations; |
| 78 | } |
| 79 | |
| 80 | inline void AppDomain::SetForceTrivialWaitOperations() |
| 81 | { |
| 82 | LIMITED_METHOD_CONTRACT; |
| 83 | m_ForceTrivialWaitOperations = true; |
| 84 | } |
| 85 | |
| 86 | inline PTR_LoaderHeap AppDomain::GetHighFrequencyHeap() |
| 87 | { |
| 88 | WRAPPER_NO_CONTRACT; |
| 89 | return GetLoaderAllocator()->GetHighFrequencyHeap(); |
| 90 | } |
| 91 | |
| 92 | inline PTR_LoaderHeap AppDomain::GetLowFrequencyHeap() |
| 93 | { |
| 94 | WRAPPER_NO_CONTRACT; |
| 95 | return GetLoaderAllocator()->GetLowFrequencyHeap(); |
| 96 | } |
| 97 | |
| 98 | inline PTR_LoaderHeap AppDomain::GetStubHeap() |
| 99 | { |
| 100 | WRAPPER_NO_CONTRACT; |
| 101 | return GetLoaderAllocator()->GetStubHeap(); |
| 102 | } |
| 103 | |
| 104 | /* static */ |
| 105 | inline DWORD DomainLocalModule::DynamicEntry::GetOffsetOfDataBlob() |
| 106 | { |
| 107 | LIMITED_METHOD_CONTRACT; |
| 108 | _ASSERTE(DWORD(offsetof(NormalDynamicEntry, m_pDataBlob)) == offsetof(NormalDynamicEntry, m_pDataBlob)); |
| 109 | return (DWORD)offsetof(NormalDynamicEntry, m_pDataBlob); |
| 110 | } |
| 111 | |
| 112 | |
| 113 | #endif // _APPDOMAIN_I |
| 114 | |
| 115 |