Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion ReactiveUI.Platforms/ComponentModelTypeConverter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

namespace ReactiveUI
{

/// <summary>
/// This binding type converter uses the built-in WPF component model
/// conversions to get a whole bunch of conversions for free. Unfortunately,
Expand All @@ -21,7 +22,7 @@ public class ComponentModelTypeConverter : IBindingTypeConverter

var converter = TypeDescriptor.GetConverter(types.Item1);
return converter.CanConvertTo(types.Item2) ? converter : null;
}, 25);
}, RxApp.SmallCacheLimit);

public int GetAffinityForObjects(Type lhs, Type rhs)
{
Expand Down
6 changes: 6 additions & 0 deletions ReactiveUI.Tests/Properties/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionCode="1" android:versionName="1.0" package="ReactiveUI.Tests_Monodroid">
<uses-sdk />
<application android:label="ReactiveUI.Tests_Monodroid">
</application>
</manifest>
2 changes: 2 additions & 0 deletions ReactiveUI.Tests/ReactiveUI.Tests_Monodroid.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
<AndroidSupportedAbis>armeabi%3barmeabi-v7a%3bx86</AndroidSupportedAbis>
<MandroidI18n />
<AndroidLinkMode>None</AndroidLinkMode>
<AndroidManifest>Properties\AndroidManifest.xml</AndroidManifest>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
Expand Down Expand Up @@ -101,6 +102,7 @@
</ItemGroup>
<ItemGroup>
<None Include="Resources\AboutResources.txt" />
<None Include="Properties\AndroidManifest.xml" />
</ItemGroup>
<ItemGroup>
<AndroidResource Include="Resources\drawable\Icon.png" />
Expand Down
6 changes: 3 additions & 3 deletions ReactiveUI/AutoPersistHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ public static class AutoPersistHelper
return type.GetProperties()
.Where(x => x.CustomAttributes.Any(y => typeof(DataMemberAttribute).IsAssignableFrom(y.AttributeType)))
.ToDictionary(k => k.Name, v => true);
}, 32);
}, RxApp.SmallCacheLimit);

static MemoizingMRUCache<Type, bool> dataContractCheckCache = new MemoizingMRUCache<Type, bool>((t, _) => {
return t.GetCustomAttributes(typeof(DataContractAttribute), true).Any();
}, 64);
}, RxApp.SmallCacheLimit);

public static IDisposable AutoPersist<T>(this T This, Func<T, IObservable<Unit>> doPersist, TimeSpan? interval = null)
where T : IReactiveNotifyPropertyChanged
Expand Down Expand Up @@ -131,4 +131,4 @@ public static IDisposable ActOnEveryObject<T>(this ReactiveList<T> This, Action<
});
}
}
}
}
4 changes: 2 additions & 2 deletions ReactiveUI/BindingTypeConverters.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public int GetAffinityForObjects(Type lhs, Type rhs)
genericMi = genericMi ??
typeof (EqualityTypeConverter).GetMethod("DoReferenceCast", BindingFlags.Public | BindingFlags.Static);
return genericMi.MakeGenericMethod(new[] {t});
}, 25);
}, RxApp.SmallCacheLimit);

public bool TryConvert(object from, Type toType, object conversionHint, out object result)
{
Expand Down Expand Up @@ -103,4 +103,4 @@ public bool TryConvert(object from, Type toType, object conversionHint, out obje
return true;
}
}
}
}
4 changes: 2 additions & 2 deletions ReactiveUI/CommandBinding.cs
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,7 @@ class CreatesCommandBinding
int score = x.GetAffinityForObject(t, false);
return (score > acc.Item1) ? Tuple.Create(score, x) : acc;
}).Item2;
}, 50);
}, RxApp.SmallCacheLimit);

static readonly MemoizingMRUCache<Type, ICreatesCommandBinding> bindCommandEventCache =
new MemoizingMRUCache<Type, ICreatesCommandBinding>((t, _) => {
Expand All @@ -356,7 +356,7 @@ class CreatesCommandBinding
int score = x.GetAffinityForObject(t, true);
return (score > acc.Item1) ? Tuple.Create(score, x) : acc;
}).Item2;
}, 50);
}, RxApp.SmallCacheLimit);

public static IDisposable BindCommandToObject(ICommand command, object target, IObservable<object> commandParameter)
{
Expand Down
2 changes: 1 addition & 1 deletion ReactiveUI/Logging.cs
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ public DefaultLogManager(IDependencyResolver dependencyResolver = null)
}

return new WrappingFullLogger(ret, type);
}, 30);
}, RxApp.BigCacheLimit);
}

static readonly IFullLogger nullLogger = new WrappingFullLogger(new NullLogger(), typeof(MemoizingMRUCache<Type, IFullLogger>));
Expand Down
2 changes: 1 addition & 1 deletion ReactiveUI/PropertyBinding.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1038,7 +1038,7 @@ bool evalBindingHooks<TViewModel, TView>(TViewModel viewModel, TView view, strin
return score > acc.Item1 && score > 0 ?
Tuple.Create(score, x) : acc;
}).Item2;
}, 25);
}, RxApp.SmallCacheLimit);

internal IBindingTypeConverter getConverterForTypes(Type lhs, Type rhs)
{
Expand Down
2 changes: 1 addition & 1 deletion ReactiveUI/ReactiveNotifyPropertyChangedMixin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ public static IObservable<IObservedChange<TSender, TValue>> SubscribeToExpressio
int score = x.GetAffinityForObject(t.Item1, t.Item2, t.Item3);
return (score > acc.Item1) ? Tuple.Create(score, x) : acc;
}).Item2;
}, 50);
}, RxApp.BigCacheLimit);

static IObservable<IObservedChange<object, object>> notifyForProperty(object sender, string propertyName, bool beforeChange)
{
Expand Down
6 changes: 3 additions & 3 deletions ReactiveUI/Reflection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public static class Reflection
}

return null;
}, 15);
}, RxApp.BigCacheLimit);

static readonly MemoizingMRUCache<Tuple<Type, string>, Action<object, object>> propWriterCache =
new MemoizingMRUCache<Tuple<Type, string>, Action<object, object>>((x,_) => {
Expand All @@ -39,7 +39,7 @@ public static class Reflection
}

return null;
}, 15);
}, RxApp.BigCacheLimit);

public static string SimpleExpressionToPropertyName<TObj, TRet>(Expression<Func<TObj, TRet>> property)
{
Expand Down Expand Up @@ -331,4 +331,4 @@ internal static string[] getDefaultViewPropChain(object view, string[] vmPropCha
return new[] {vmPropertyName, defaultProperty};
}
}
}
}
8 changes: 8 additions & 0 deletions ReactiveUI/RxApp.cs
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,14 @@ static void initializeDependencyResolver()
}

static internal bool suppressLogging { get; set; }

#if ANDROID || SILVERLIGHT || IOS
public const int SmallCacheLimit = 4;
public const int BigCacheLimit = 8;
#else
public const int SmallCacheLimit = 32;
public const int BigCacheLimit = 64;
#endif
}
}

Expand Down