Merge branch 'AlexVallat/Keepass2AndroidPerfOpt' into Release085

Conflicts:
	src/keepass2android/search/SearchResults.cs
This commit is contained in:
Philipp Crocoll 2013-08-30 23:10:43 +02:00
commit df875f959e
4 changed files with 17 additions and 1 deletions

View File

@ -15,6 +15,14 @@ namespace KeePassLib.Serialization
{ {
public const string FileNameExtension = "kdbp"; public const string FileNameExtension = "kdbp";
/// <summary>
/// Precompiles the serializer classes for faster first-run execution
/// </summary>
public static void PrepareSerializer()
{
RuntimeTypeModel.Default[typeof(PwDatabaseBuffer)].CompileInPlace();
}
/// <summary> /// <summary>
/// Determines whether the database pointed to by the specified ioc should be (de)serialised in default (xml) or protocol buffers format. /// Determines whether the database pointed to by the specified ioc should be (de)serialised in default (xml) or protocol buffers format.
/// </summary> /// </summary>

View File

@ -375,6 +375,12 @@ namespace keepass2android
private MemoryStream LoadDbFile() private MemoryStream LoadDbFile()
{ {
if (KdbpFile.GetFormatToUse(_ioConnection) == KdbxFormat.ProtocolBuffers)
{
Kp2aLog.Log("Preparing kdbp serializer");
KdbpFile.PrepareSerializer();
}
Kp2aLog.Log("Pre-loading database file starting"); Kp2aLog.Log("Pre-loading database file starting");
var fileStorage = App.Kp2a.GetFileStorage(_ioConnection); var fileStorage = App.Kp2a.GetFileStorage(_ioConnection);
var stream = fileStorage.OpenFileForRead(_ioConnection); var stream = fileStorage.OpenFileForRead(_ioConnection);

View File

@ -29,6 +29,7 @@ using Android.Content.PM;
namespace keepass2android namespace keepass2android
{ {
[Activity (Label = "@string/kp2a_findUrl", ConfigurationChanges=ConfigChanges.Orientation|ConfigChanges.KeyboardHidden, Theme="@style/Base")] [Activity (Label = "@string/kp2a_findUrl", ConfigurationChanges=ConfigChanges.Orientation|ConfigChanges.KeyboardHidden, Theme="@style/Base")]
[MetaData("android.app.default_searchable", Value = "keepass2android.search.SearchResults")]
public class ShareUrlResults : GroupBaseActivity public class ShareUrlResults : GroupBaseActivity
{ {

View File

@ -31,6 +31,7 @@ namespace keepass2android.search
/// </summary> /// </summary>
[Activity (Label = "@string/app_name", Theme="@style/NoTitleBar", LaunchMode=Android.Content.PM.LaunchMode.SingleTop)] [Activity (Label = "@string/app_name", Theme="@style/NoTitleBar", LaunchMode=Android.Content.PM.LaunchMode.SingleTop)]
[MetaData("android.app.searchable",Resource=AppNames.Searchable)] [MetaData("android.app.searchable",Resource=AppNames.Searchable)]
[MetaData("android.app.default_searchable", Value = "keepass2android.search.SearchResults")]
[IntentFilter(new[]{Intent.ActionSearch}, Categories=new[]{Intent.CategoryDefault})] [IntentFilter(new[]{Intent.ActionSearch}, Categories=new[]{Intent.CategoryDefault})]
public class SearchResults : GroupBaseActivity public class SearchResults : GroupBaseActivity
{ {