Permalink
Browse files

XamlTypeResolver - removed unnecessary delegate

Its memory was showing up in profiler
  • Loading branch information...
Jonathan Peppers
Jonathan Peppers committed Jun 29, 2016
1 parent d77fd8f commit 743c1b3187025db31fd20ff37a50f06a01c76cec
Showing with 3 additions and 17 deletions.
  1. +3 −17 Xamarin.Forms.Xaml/XamlServiceProvider.cs
@@ -19,8 +19,7 @@ internal XamlServiceProvider(INode node, HydratationContext context)
IRootObjectProvider = new XamlRootObjectProvider(context.RootElement);
if (node != null)
{
IXamlTypeResolver = new XamlTypeResolver(node.NamespaceResolver, XamlParser.GetElementType,
context.RootElement.GetType().GetTypeInfo().Assembly);
IXamlTypeResolver = new XamlTypeResolver(node.NamespaceResolver, context.RootElement.GetType().GetTypeInfo().Assembly);
var enode = node;
while (enode != null && !(enode is IElementNode))
@@ -171,25 +170,15 @@ object IProvideValueTarget.TargetProperty
public class XamlTypeResolver : IXamlTypeResolver
{
readonly Assembly currentAssembly;
readonly GetTypeFromXmlName getTypeFromXmlName;
readonly IXmlNamespaceResolver namespaceResolver;
public XamlTypeResolver(IXmlNamespaceResolver namespaceResolver, Assembly currentAssembly)
: this(namespaceResolver, XamlParser.GetElementType, currentAssembly)
{
}
internal XamlTypeResolver(IXmlNamespaceResolver namespaceResolver, GetTypeFromXmlName getTypeFromXmlName,
Assembly currentAssembly)
internal XamlTypeResolver(IXmlNamespaceResolver namespaceResolver, Assembly currentAssembly)
{
this.currentAssembly = currentAssembly;
if (namespaceResolver == null)
throw new ArgumentNullException();
if (getTypeFromXmlName == null)
throw new ArgumentNullException();
this.namespaceResolver = namespaceResolver;
this.getTypeFromXmlName = getTypeFromXmlName;
}
Type IXamlTypeResolver.Resolve(string qualifiedTypeName, IServiceProvider serviceProvider)
@@ -242,11 +231,8 @@ Type Resolve(string qualifiedTypeName, IServiceProvider serviceProvider, out Xam
return null;
}
return getTypeFromXmlName(new XmlType(namespaceuri, name, null), xmlLineInfo, currentAssembly, out exception);
return XamlParser.GetElementType(new XmlType(namespaceuri, name, null), xmlLineInfo, currentAssembly, out exception);
}
internal delegate Type GetTypeFromXmlName(
XmlType xmlType, IXmlLineInfo xmlInfo, Assembly currentAssembly, out XamlParseException exception);
}
internal class XamlRootObjectProvider : IRootObjectProvider

0 comments on commit 743c1b3

Please sign in to comment.