Imported Upstream version 5.4.0.167

Former-commit-id: 5624ac747d633e885131e8349322922b6a59baaa
This commit is contained in:
Xamarin Public Jenkins (auto-signing)
2017-08-21 15:34:15 +00:00
parent e49d6f06c0
commit 536cd135cc
12856 changed files with 563812 additions and 223249 deletions

View File

@ -1 +1 @@
65f0272002f410cb2fa2a9ac6d2b7c2ef979c154
7ad0d9bd9c7dde1fcdab869ee37fa87177a82006

View File

@ -67,15 +67,13 @@ internal abstract class BuildResultCache {
internal class MemoryBuildResultCache: BuildResultCache {
private CacheInternal _cache;
private CacheItemRemovedCallback _onRemoveCallback;
// The keys are simple assembly names
// The values are ArrayLists containing the simple names of assemblies that depend on it
private Hashtable _dependentAssemblies = new Hashtable();
internal MemoryBuildResultCache(CacheInternal cache) {
_cache = cache;
internal MemoryBuildResultCache() {
// Register an AssemblyLoad event
AppDomain.CurrentDomain.AssemblyLoad += new AssemblyLoadEventHandler(OnAssemblyLoad);
@ -121,7 +119,7 @@ internal class MemoryBuildResultCache: BuildResultCache {
Debug.Trace("BuildResultCache", "Looking for '" + cacheKey + "' in the memory cache");
string key = GetMemoryCacheKey(cacheKey);
BuildResult result = (BuildResult) _cache.Get(key);
BuildResult result = (BuildResult) HttpRuntime.Cache.InternalCache.Get(key);
// Not found in the cache
if (result == null) {
@ -137,9 +135,9 @@ internal class MemoryBuildResultCache: BuildResultCache {
Debug.Trace("BuildResultCache", "'" + cacheKey + "' was found but is out of date");
// Remove it from the cache
_cache.Remove(key);
HttpRuntime.Cache.InternalCache.Remove(key);
Debug.Assert(_cache.Get(key) == null);
Debug.Assert(HttpRuntime.Cache.InternalCache.Get(key) == null);
return null;
}
@ -183,16 +181,11 @@ internal class MemoryBuildResultCache: BuildResultCache {
// Insert a new cache entry using the assembly path as the key
string assemblyKey = GetAssemblyCacheKey(compiledResult.ResultAssembly);
Assembly a = (Assembly)_cache.Get(assemblyKey);
Assembly a = (Assembly) HttpRuntime.Cache.InternalCache.Get(assemblyKey);
if (a == null) {
Debug.Trace("BuildResultCache", "Adding marker cache entry " + compiledResult.ResultAssembly);
// VSWhidbey 500049 - add as NotRemovable to prevent the assembly from being prematurely deleted
_cache.UtcInsert(assemblyKey, compiledResult.ResultAssembly,
null,
Cache.NoAbsoluteExpiration,
Cache.NoSlidingExpiration,
CacheItemPriority.NotRemovable,
null);
HttpRuntime.Cache.InternalCache.Insert(assemblyKey, compiledResult.ResultAssembly, null);
}
else {
Debug.Assert(a == compiledResult.ResultAssembly);
@ -237,11 +230,13 @@ internal class MemoryBuildResultCache: BuildResultCache {
onRemoveCallback = _onRemoveCallback;
}
_cache.UtcInsert(key, result, cacheDependency,
result.MemoryCacheExpiration,
result.MemoryCacheSlidingExpiration,
cachePriority,
onRemoveCallback);
HttpRuntime.Cache.InternalCache.Insert(key, result, new CacheInsertOptions() {
Dependencies = cacheDependency,
AbsoluteExpiration = result.MemoryCacheExpiration,
SlidingExpiration = result.MemoryCacheSlidingExpiration,
Priority = cachePriority,
OnRemovedCallback = onRemoveCallback
});
}
// OnCacheItemRemoved can be invoked with user code on the stack, for example if someone
@ -338,7 +333,7 @@ internal class MemoryBuildResultCache: BuildResultCache {
// If we have no cache entry for this assembly, there is nothing to do
string cacheKey = GetAssemblyCacheKeyFromName(assemblyName);
Assembly assembly = (Assembly)_cache[cacheKey];
Assembly assembly = (Assembly)HttpRuntime.Cache.InternalCache.Get(cacheKey);
if (assembly == null)
return;
@ -348,7 +343,7 @@ internal class MemoryBuildResultCache: BuildResultCache {
Debug.Trace("BuildResultCache", "removing cacheKey for assembly " + assemblyPath + " because of dependency change");
// Remove the cache entry in order to kick out all the pages that are in that batch
_cache.Remove(cacheKey);
HttpRuntime.Cache.InternalCache.Remove(cacheKey);
// Now call recursively on all the dependent assemblies (VSWhidbey 577593)
ICollection dependentAssemblies = _dependentAssemblies[assemblyName] as ICollection;
@ -532,7 +527,7 @@ internal abstract class DiskBuildResultCache: BuildResultCache {
// This is required otherwise new components can be compiled
// with obsolete build results whose assembly has been removed.
string assemblyKey = GetAssemblyCacheKey(f.FullName);
HttpRuntime.CacheInternal.Remove(assemblyKey);
HttpRuntime.Cache.InternalCache.Remove(assemblyKey);
// Remove the assembly
RemoveAssembly(f);

View File

@ -188,7 +188,7 @@ internal static class CompilationLock {
// Always take the BuildManager lock *before* taking the mutex, to avoid possible
// deadlock situations (VSWhidbey 530732)
#pragma warning disable 0618
//@TODO: This overload of Monitor.Enter is obsolete. Please change this to use Monitor.Enter(ref bool), and remove the pragmas -- [....]
//@TODO: This overload of Monitor.Enter is obsolete. Please change this to use Monitor.Enter(ref bool), and remove the pragmas -- Microsoft
Monitor.Enter(BuildManager.TheBuildManager);
#pragma warning restore 0618
_mutex.WaitOne();

View File

@ -271,9 +271,9 @@ namespace System.Web.Compilation {
"." + classKey;
// If we have it cached, return it
CacheInternal cacheInternal = System.Web.HttpRuntime.CacheInternal;
CacheStoreProvider cacheInternal = System.Web.HttpRuntime.Cache.InternalCache;
string cacheKey = CacheInternal.PrefixResourceProvider + fullClassName;
IResourceProvider resourceProvider = cacheInternal[cacheKey] as IResourceProvider;
IResourceProvider resourceProvider = cacheInternal.Get(cacheKey) as IResourceProvider;
if (resourceProvider != null) {
return resourceProvider;
}
@ -282,7 +282,7 @@ namespace System.Web.Compilation {
resourceProvider = s_resourceProviderFactory.CreateGlobalResourceProvider(classKey);
// Cache it
cacheInternal.UtcInsert(cacheKey, resourceProvider);
cacheInternal.Insert(cacheKey, resourceProvider, null);
return resourceProvider;
}
@ -296,9 +296,9 @@ namespace System.Web.Compilation {
internal static IResourceProvider GetLocalResourceProvider(VirtualPath virtualPath) {
// If we have it cached, return it (it may be null if there are no local resources)
CacheInternal cacheInternal = System.Web.HttpRuntime.CacheInternal;
CacheStoreProvider cacheInternal = System.Web.HttpRuntime.Cache.InternalCache;
string cacheKey = CacheInternal.PrefixResourceProvider + virtualPath.VirtualPathString;
IResourceProvider resourceProvider = cacheInternal[cacheKey] as IResourceProvider;
IResourceProvider resourceProvider = cacheInternal.Get(cacheKey) as IResourceProvider;
if (resourceProvider != null) {
return resourceProvider;
}
@ -307,7 +307,7 @@ namespace System.Web.Compilation {
resourceProvider = s_resourceProviderFactory.CreateLocalResourceProvider(virtualPath.VirtualPathString);
// Cache it
cacheInternal.UtcInsert(cacheKey, resourceProvider);
cacheInternal.Insert(cacheKey, resourceProvider, null);
return resourceProvider;
}