Exemplo n.º 1
0
            public UnmanagedBlob(StandardRuntimePlatform plat, int size)
            {
                _plat   = plat;
                Address = plat.Alloc(size);
                GC.AddMemoryPressure(size);
                Size = size;
#if DEBUG
                _backtrace = Environment.StackTrace;
                Backtraces.Add(_backtrace);
#endif
            }
            public UnmanagedBlob(StandardRuntimePlatform plat, int size)
            {
                if (size <= 0)
                {
                    throw new ArgumentException("Positive number required", nameof(size));
                }
                _plat    = plat;
                _address = plat.Alloc(size);
                GC.AddMemoryPressure(size);
                Size = size;
#if DEBUG
                _backtrace = Environment.StackTrace;
                lock (_btlock)
                    Backtraces.Add(_backtrace);
#endif
            }
Exemplo n.º 3
0
        public static void Register(Assembly assembly = null)
        {
            var standardPlatform = new StandardRuntimePlatform();

            AvaloniaLocator.CurrentMutable
            .Bind <IRuntimePlatform>().ToConstant(standardPlatform)
            .Bind <IAssetLoader>().ToConstant(new AssetLoader(assembly))
            .Bind <IDynamicLibraryLoader>().ToConstant(
#if __IOS__
                new IOSLoader()
#else
                RuntimeInformation.IsOSPlatform(OSPlatform.Windows)
                        ? (IDynamicLibraryLoader) new Win32Loader()
                        : new UnixLoader()
#endif
                );
        }