pFad - Phone/Frame/Anonymizer/Declutterfier! Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

URL: http://github.com/ClearFoundry/ClearScript/pull/290/files

eet" href="https://github.githubassets.com/assets/code-6756960bc12d5d38.css" /> Android V8 Support by KurtGokhan · Pull Request #290 · ClearFoundry/ClearScript · GitHub
Skip to content
Draft
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
9 changes: 9 additions & 0 deletions ClearScript/HostSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,15 @@ public static class HostSettings
//github.com/ </remarks>
public static string AuxiliarySearchPath { get; set; }

//github.com/ <summary>
//github.com/ Sets the runtime platform to android and loads android native binaries.
//github.com/ </summary>
//github.com/ <remarks>
//github.com/ This property allows ClearScript to load android native assemblies instead of
//github.com/ linux assemblies on Android Mono
//github.com/ </remarks>
public static bool IsAndroid { get; set; }

//github.com/ <summary>
//github.com/ Gets or sets the custom attribute loader for ClearScript.
//github.com/ </summary>
Expand Down
7 changes: 6 additions & 1 deletion ClearScript/Util/MiscHelpers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -554,7 +554,12 @@ public static bool PlatformIsWindows()

public static bool PlatformIsLinux()
{
return RuntimeInformation.IsOSPlatform(OSPlatform.Linux);
return !HostSettings.IsAndroid && RuntimeInformation.IsOSPlatform(OSPlatform.Linux);
}

public static bool PlatformIsAndroid()
{
return HostSettings.IsAndroid;
}

public static bool PlatformIsOSX()
Expand Down
64 changes: 59 additions & 5 deletions ClearScript/Util/NativeMethods.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@ public static IntPtr LoadLibrary(string path)
return NativeWindowsMethods.LoadLibraryW(path);
}

if (MiscHelpers.PlatformIsAndroid())
{
return NativeAndroidMethods.LoadLibrary(path);
}

if (MiscHelpers.PlatformIsLinux())
{
return NativeLinuxMethods.LoadLibrary(path);
Expand All @@ -34,6 +39,11 @@ public static bool FreeLibrary(IntPtr hLibrary)
if (MiscHelpers.PlatformIsWindows())
{
return NativeWindowsMethods.FreeLibrary(hLibrary);
}

if (MiscHelpers.PlatformIsAndroid())
{
return NativeAndroidMethods.FreeLibrary(hLibrary) == 0;
}

if (MiscHelpers.PlatformIsLinux())
Expand All @@ -54,6 +64,11 @@ public static string GetLoadLibraryErrorMessage()
if (MiscHelpers.PlatformIsWindows())
{
return new Win32Exception().Message;
}

if (MiscHelpers.PlatformIsAndroid())
{
return Marshal.PtrToStringAnsi(NativeAndroidMethods.GetLoadLibraryErrorMessage());
}

if (MiscHelpers.PlatformIsLinux())
Expand Down Expand Up @@ -254,12 +269,12 @@ [Out] out uint oldProtect
);

// ReSharper restore MemberHidesStaticFromOuterClass
}

}
#endregion

#region Nested type: NativeLinuxMethods

private static class NativeLinuxMethods
{
// ReSharper disable MemberHidesStaticFromOuterClass
Expand All @@ -284,7 +299,46 @@ public enum LoadLibraryFlags

[DllImport("libdl.so.2", EntryPoint = "dlopen")]
public static extern IntPtr LoadLibrary(
[In] [MarshalAs(UnmanagedType.LPStr)] string path,
[In][MarshalAs(UnmanagedType.LPStr)] string path,
[In] LoadLibraryFlags flags = LoadLibraryFlags.Now | LoadLibraryFlags.Global
);

[DllImport("libdl.so", EntryPoint = "dlclose")]
public static extern int FreeLibrary(
[In] IntPtr hLibrary
);

[DllImport("libdl.so", EntryPoint = "dlerror")]
public static extern IntPtr GetLoadLibraryErrorMessage();

// ReSharper restore MemberHidesStaticFromOuterClass
}

#endregion

#region Nested type: NativeLinuxMethods

private static class NativeAndroidMethods
{
// ReSharper disable MemberHidesStaticFromOuterClass

[Flags]
public enum LoadLibraryFlags
{
// ReSharper disable UnusedMember.Local

None = 0,
Now = 0,
Lazy = 1,
Local = 0,
Global = 2,

// ReSharper restore UnusedMember.Local
}

[DllImport("libdl.so", EntryPoint = "dlopen")]
public static extern IntPtr LoadLibrary(
[In][MarshalAs(UnmanagedType.LPStr)] string path,
[In] LoadLibraryFlags flags = LoadLibraryFlags.Now | LoadLibraryFlags.Global
);

Expand Down
6 changes: 2 additions & 4 deletions ClearScript/V8/SplitProxy/V8SplitProxyNative.Common.tt
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,19 @@ namespace Microsoft.ClearScript.V8.SplitProxy
{
private static IV8SplitProxyNative CreateInstance()
{
var architecture = RuntimeInformation.ProcessArchitecture;

<#
foreach (var osPlatform in platforms.Select(testPlatform => testPlatform.Item1).Distinct())
{
#>

if (RuntimeInformation.IsOSPlatform(OSPlatform.<#= osPlatform #>))
if (IsOSPlatform("<#= osPlatform #>"))
{
<#
foreach (var platform in platforms.Where(testPlatform => testPlatform.Item1 == osPlatform))
{
#>

if (architecture == Architecture.<#= platform.Item2 #>)
if (IsArchitecture("<#= osPlatform #>", "<#= platform.Item2 #>"))
{
return new <#= $"Impl_{osPlatform}_{platform.Item2}" #>();
}
Expand Down
Loading
pFad - Phonifier reborn

Pfad - The Proxy pFad © 2024 Your Company Name. All rights reserved.





Check this box to remove all script contents from the fetched content.



Check this box to remove all images from the fetched content.


Check this box to remove all CSS styles from the fetched content.


Check this box to keep images inefficiently compressed and original size.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy