Update PlatformInfo.cs (#23647)
* Update PlatformInfo.cs * Simplify ComponentsProfiling initialization
This commit is contained in:
parent
64c143cd9c
commit
035ab19f31
|
|
@ -11,7 +11,7 @@ namespace Microsoft.AspNetCore.Components
|
||||||
|
|
||||||
static PlatformInfo()
|
static PlatformInfo()
|
||||||
{
|
{
|
||||||
IsWebAssembly = RuntimeInformation.IsOSPlatform(OSPlatform.Create("WEBASSEMBLY"));
|
IsWebAssembly = RuntimeInformation.IsOSPlatform(OSPlatform.Browser);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -13,14 +13,9 @@ namespace Microsoft.AspNetCore.Components.Profiling
|
||||||
// is so that if we later have two different implementations (one for WebAssembly, one for
|
// is so that if we later have two different implementations (one for WebAssembly, one for
|
||||||
// Server), the execution characteristics of calling Start/End will be unchanged and historical
|
// Server), the execution characteristics of calling Start/End will be unchanged and historical
|
||||||
// perf data will still be comparable to newer data.
|
// perf data will still be comparable to newer data.
|
||||||
public static readonly ComponentsProfiling Instance;
|
public static readonly ComponentsProfiling Instance = PlatformInfo.IsWebAssembly
|
||||||
|
? new WebAssemblyComponentsProfiling()
|
||||||
static ComponentsProfiling()
|
: (ComponentsProfiling)new NoOpComponentsProfiling();
|
||||||
{
|
|
||||||
Instance = RuntimeInformation.IsOSPlatform(OSPlatform.Create("BROWSER"))
|
|
||||||
? new WebAssemblyComponentsProfiling()
|
|
||||||
: (ComponentsProfiling)new NoOpComponentsProfiling();
|
|
||||||
}
|
|
||||||
|
|
||||||
public abstract void Start([CallerMemberName] string? name = null);
|
public abstract void Start([CallerMemberName] string? name = null);
|
||||||
public abstract void End([CallerMemberName] string? name = null);
|
public abstract void End([CallerMemberName] string? name = null);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue