| 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 | // |
| 7 | // Contains VM implementation of WinRT type cache for code:CLRPrivBinderWinRT binder. |
| 8 | // |
| 9 | //===================================================================================================================== |
| 10 | |
| 11 | #pragma once |
| 12 | |
| 13 | #include "internalunknownimpl.h" |
| 14 | #include "clrprivbinding.h" |
| 15 | |
| 16 | //===================================================================================================================== |
| 17 | class CLRPrivTypeCacheWinRT : |
| 18 | public IUnknownCommon<IUnknown> |
| 19 | { |
| 20 | public: |
| 21 | //============================================================================================= |
| 22 | // Class methods |
| 23 | |
| 24 | // S_OK - pAssembly contains type wszTypeName |
| 25 | // S_FALSE - pAssembly does not contain type wszTypeName |
| 26 | HRESULT ContainsType( |
| 27 | ICLRPrivAssembly * pAssembly, |
| 28 | LPCWSTR wszTypeName); |
| 29 | |
| 30 | // S_OK - pAssembly contains type wszTypeName |
| 31 | // S_FALSE - pAssembly does not contain type wszTypeName |
| 32 | // E_FAIL - assembly is not loaded |
| 33 | HRESULT ContainsTypeIfLoaded( |
| 34 | PTR_AppDomain pAppDomain, |
| 35 | PTR_ICLRPrivAssembly pPrivAssembly, |
| 36 | LPCUTF8 szNamespace, |
| 37 | LPCUTF8 szClassName, |
| 38 | PTR_Assembly * ppAssembly); |
| 39 | |
| 40 | static CLRPrivTypeCacheWinRT * GetOrCreateTypeCache(); |
| 41 | |
| 42 | #ifndef DACCESS_COMPILE |
| 43 | |
| 44 | #ifndef CROSSGEN_COMPILE |
| 45 | // Raises user event DesignerNamespaceResolveEvent to get a list of files for this namespace. |
| 46 | void RaiseDesignerNamespaceResolveEvent( |
| 47 | LPCWSTR wszNamespace, |
| 48 | CLRPrivBinderUtil::WStringListHolder * pFileNameList); |
| 49 | #endif // CROSSGEN_COMPILE |
| 50 | |
| 51 | #endif //!DACCESS_COMPILE |
| 52 | |
| 53 | private: |
| 54 | //============================================================================================= |
| 55 | // Private methods |
| 56 | |
| 57 | // Checks if the type (szNamespace/szClassName) is present in the assembly pAssembly. |
| 58 | HRESULT ContainsTypeHelper( |
| 59 | PTR_Assembly pAssembly, |
| 60 | LPCUTF8 szNamespace, |
| 61 | LPCUTF8 szClassName); |
| 62 | |
| 63 | //============================================================================================= |
| 64 | // Class fields |
| 65 | |
| 66 | static CLRPrivTypeCacheWinRT * s_pSingleton; |
| 67 | |
| 68 | }; // class CLRPrivTypeCaheWinRT |
| 69 | |
| 70 | typedef DPTR(CLRPrivTypeCacheWinRT) PTR_CLRPrivTypeCacheWinRT; |
| 71 | |