using Xamarin.Forms.Platform.Android;
using Xamarin.Forms.Platform.Android.AppLinks;
using System.Linq;
+using Xamarin.Forms.Internals;
namespace Xamarin.Forms.ControlGallery.Android
{
{
protected override void OnCreate(Bundle bundle)
{
+ Profile.Start();
+
ToolbarResource = Resource.Layout.Toolbar;
TabLayoutResource = Resource.Layout.Tabbar;
}
}
-
+ protected override void OnResume()
+ {
+ base.OnResume();
+ Profile.Stop();
+ }
+
[Export("IsPreAppCompat")]
public bool IsPreAppCompat()
{
public static void FrameBegin(
[CallerMemberName] string name = "",
- string id = null,
[CallerLineNumber] int line = 0)
{
if (!Running)
return;
- FrameBeginBody(name, id, line);
+ FrameBeginBody(name, null, line);
}
- public static void FrameEnd()
+ public static void FrameEnd(
+ [CallerMemberName] string name = "")
{
if (!Running)
return;
- FrameEndBody();
+ FrameEndBody(name);
}
public static void FramePartition(
Stack.Push(new Profile(name, id, line));
}
- static void FrameEndBody()
+ static void FrameEndBody(string name)
{
var profile = Stack.Pop();
+ if (profile._name != name)
+ throw new InvalidOperationException(
+ $"Expected to end frame '{profile._name}', not '{name}'.");
profile.Dispose();
}
var name = profile._name;
profile.Dispose();
- FrameBegin(name, id, line);
+ FrameBeginBody(name, id, line);
}
Profile(
Profile.FramePartition("Reflect");
foreach (Assembly assembly in assemblies)
{
- Profile.FrameBegin(assembly.GetName().Name);
+ var assemblyName = assembly.GetName().Name;
+ Profile.FrameBegin(assemblyName);
foreach (Type attrType in attrTypes)
{
Array.Copy(effectAttributes, typedEffectAttributes, effectAttributes.Length);
RegisterEffects(resolutionName, typedEffectAttributes);
- Profile.FrameEnd();
+ Profile.FrameEnd(assemblyName);
}
if ((flags & InitializationFlags.DisableCss) == 0)
Profile.FrameBegin("Assembly.GetCallingAssembly");
resourceAssembly = Assembly.GetCallingAssembly();
- Profile.FrameEnd();
+ Profile.FrameEnd("Assembly.GetCallingAssembly");
Profile.FrameBegin();
SetupInit(activity, resourceAssembly, null);
Profile.FramePartition("UpdateFlyoutBackground");
UpdateFlyoutBackground();
- Profile.FrameEnd();
-
Profile.FramePartition(nameof(UpdateVerticalScrollMode));
UpdateVerticalScrollMode();
Profile.FrameEnd();
decorView.SetBackground(split);
}
- Profile.FrameEnd();
+ Profile.FrameEnd("UpdtStatBarClr");
}
class SplitDrawable : Drawable