Skip to content

Commit

Permalink
[Java.Interop] Rename IJniHandleManager to IJniObjectReferenceManager
Browse files Browse the repository at this point in the history
Fixes: #20

"Handles" are out; "References" are in. See 25de1f3.

Also rename JniHandleManager to JniObjectReferenceManager.
  • Loading branch information
jonpryor committed Oct 22, 2015
1 parent 05122d1 commit 33ebcb8
Show file tree
Hide file tree
Showing 10 changed files with 20 additions and 19 deletions.
4 changes: 2 additions & 2 deletions src/Android.Interop/Android.Interop.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@
<ItemGroup>
<Compile Include="Resources\Resource.designer.cs" />
<Compile Include="Java.Interop\AndroidVM.cs" />
<Compile Include="..\Java.Interop\Tests\Java.Interop\LoggingJniHandleManagerDecorator.cs">
<Link>LoggingJniHandleManagerDecorator.cs</Link>
<Compile Include="..\Java.Interop\Tests\Java.Interop\LoggingJniObjectReferenceManagerDecorator.cs">
<Link>LoggingJniObjectReferenceManagerDecorator.cs</Link>
</Compile>
</ItemGroup>
<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion src/Android.Interop/Java.Interop/AndroidVM.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public AndroidVMBuilder ()
throw new InvalidOperationException ("JNIEnv::GetJavaVM() returned: " + r);
InvocationPointer = vm;
}
JniHandleManager = Java.InteropTests.LoggingJniHandleManagerDecorator.GetHandleManager (new JniHandleManager ());
JniHandleManager = Java.InteropTests.LoggingJniObjectReferenceManagerDecorator.GetObjectReferenceManager (new JniObjectReferenceManager ());
}

public AndroidVM CreateAndroidVM ()
Expand Down
4 changes: 2 additions & 2 deletions src/Java.Interop/Java.Interop.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
</PropertyGroup>
<ItemGroup>
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Java.Interop\IJniHandleManager.cs" />
<Compile Include="Java.Interop\JavaPeerableExtensions.cs" />
<Compile Include="Java.Interop\JavaVM.cs" />
<Compile Include="Java.Interop\JniAllocObjectRef.cs" />
Expand All @@ -46,7 +45,6 @@
<Compile Include="Java.Interop\JniEnvironment.Strings.cs" />
<Compile Include="Java.Interop\JniEnvironment.Types.cs" />
<Compile Include="Java.Interop\JniFieldInfo.cs" />
<Compile Include="Java.Interop\JniHandleManager.cs" />
<Compile Include="Java.Interop\JniInstanceFieldInfo.cs" />
<Compile Include="Java.Interop\JniInstanceMethodInfo.cs" />
<Compile Include="Java.Interop\JniMethodInfo.cs" />
Expand All @@ -67,13 +65,15 @@
<Compile Include="Java.Interop\IExportedMemberBuilder.cs" />
<Compile Include="Java.Interop\IJavaPeerable.cs" />
<Compile Include="Java.Interop\IJavaPeerableEx.cs" />
<Compile Include="Java.Interop\IJniObjectReferenceManager.cs" />
<Compile Include="Java.Interop\JavaObjectArray.cs" />
<Compile Include="Java.Interop\JniTypeInfoAttribute.cs" />
<Compile Include="Java.Interop\JniTypeInfo.cs" />
<Compile Include="Java.Interop\JavaProxyObject.cs" />
<Compile Include="Java.Interop\JniMarshal.cs" />
<Compile Include="Java.Interop\JniMarshalInfo.cs" />
<Compile Include="Java.Interop\JniObjectReference.cs" />
<Compile Include="Java.Interop\JniObjectReferenceManager.cs" />
<Compile Include="Java.Interop\JniObjectReferenceType.cs" />
<Compile Include="Java.Interop\JniPeerInstanceMethods.cs" />
<Compile Include="Java.Interop\JniPeerInstanceFields.cs" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
namespace Java.Interop {

// Implementations MUST be thread safe!
public interface IJniHandleManager : IDisposable {
public interface IJniObjectReferenceManager : IDisposable {

int GlobalReferenceCount {get;}
int WeakGlobalReferenceCount {get;}
Expand Down
6 changes: 3 additions & 3 deletions src/Java.Interop/Java.Interop/JavaVM.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public class JavaVMOptions {

public IntPtr InvocationPointer {get; set;}
public IntPtr EnvironmentPointer {get; set;}
public IJniHandleManager JniHandleManager {get; set;}
public IJniObjectReferenceManager JniHandleManager {get; set;}

public JavaVMOptions ()
{
Expand Down Expand Up @@ -122,7 +122,7 @@ protected JavaVM (JavaVMOptions options)
TrackIDs = options.TrackIDs;
DestroyVM = options.DestroyVMOnDispose;

JniHandleManager = options.JniHandleManager ?? new JniHandleManager ();
JniHandleManager = options.JniHandleManager ?? new JniObjectReferenceManager ();
NewObjectRequired = options.NewObjectRequired;

InvocationPointer = options.InvocationPointer;
Expand Down Expand Up @@ -242,7 +242,7 @@ public int WeakGlobalReferenceCount {
get {return JniHandleManager.WeakGlobalReferenceCount;}
}

public IJniHandleManager JniHandleManager {get; private set;}
public IJniObjectReferenceManager JniHandleManager {get; private set;}

public bool TrackIDs {get; private set;}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

namespace Java.Interop {

public class JniHandleManager : IJniHandleManager {
public class JniObjectReferenceManager : IJniObjectReferenceManager {

int grefc;
public int GlobalReferenceCount {
Expand Down
2 changes: 1 addition & 1 deletion src/Java.Interop/Tests/Interop-Tests.projitems
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,10 @@
<Compile Include="$(MSBuildThisFileDirectory)Java.Interop\JniTypeInfoAttributeTest.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Java.Interop\JniTypeInfoTest.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Java.Interop\JniTypeTest.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Java.Interop\LoggingJniHandleManagerDecorator.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Java.Interop\MethodBindingTests.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Java.Interop\TestType.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Java.Interop\TestTypeTests.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Java.Interop\LoggingJniObjectReferenceManagerDecorator.cs" />
</ItemGroup>
<ItemGroup>
<JavaInteropTestJar Include="$(MSBuildThisFileDirectory)java\com\xamarin\interop\CallNonvirtualBase.java" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,14 @@

namespace Java.InteropTests {

class LoggingJniHandleManagerDecorator : IJniHandleManager {
class LoggingJniObjectReferenceManagerDecorator : IJniObjectReferenceManager {

TextWriter grefLog;
TextWriter lrefLog;
IJniHandleManager manager;

public LoggingJniHandleManagerDecorator (IJniHandleManager manager, TextWriter lrefOutput = null, TextWriter grefOutput = null)
IJniObjectReferenceManager manager;

public LoggingJniObjectReferenceManagerDecorator (IJniObjectReferenceManager manager, TextWriter lrefOutput = null, TextWriter grefOutput = null)
{
if (manager == null)
throw new ArgumentNullException ("manager");
Expand All @@ -32,7 +33,7 @@ public int WeakGlobalReferenceCount {
get {return manager.WeakGlobalReferenceCount;}
}

public static IJniHandleManager GetHandleManager (IJniHandleManager manager)
public static IJniObjectReferenceManager GetObjectReferenceManager (IJniObjectReferenceManager manager)
{
TextWriter grefLog = null;
TextWriter lrefLog = null;;
Expand All @@ -59,7 +60,7 @@ public static IJniHandleManager GetHandleManager (IJniHandleManager manager)

if (grefLog == null && lrefLog == null)
return manager;
return new LoggingJniHandleManagerDecorator (manager, lrefLog, grefLog);
return new LoggingJniObjectReferenceManagerDecorator (manager, lrefLog, grefLog);
}

static string GetLogPath (string value)
Expand Down
2 changes: 1 addition & 1 deletion tests/TestJVM/TestJVM.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ static JreVMBuilder CreateBuilder (string[] jars)
builder.ClassPath.Add (jar);
}
builder.AddOption ("-Xcheck:jni");
builder.JniHandleManager = LoggingJniHandleManagerDecorator.GetHandleManager (new Java.Interop.JniHandleManager ());
builder.JniHandleManager = LoggingJniObjectReferenceManagerDecorator.GetObjectReferenceManager (new Java.Interop.JniObjectReferenceManager ());

return builder;
}
Expand Down
4 changes: 2 additions & 2 deletions tests/TestJVM/TestJVM.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<ItemGroup>
<Compile Include="TestJVM.cs" />
<Compile Include="..\..\src\Java.Interop\Tests\Java.Interop\LoggingJniHandleManagerDecorator.cs">
<Link>LoggingJniHandleManagerDecorator.cs</Link>
<Compile Include="..\..\src\Java.Interop\Tests\Java.Interop\LoggingJniObjectReferenceManagerDecorator.cs">
<Link>LoggingJniObjectReferenceManagerDecorator.cs</Link>
</Compile>
</ItemGroup>
<ItemGroup>
Expand Down

0 comments on commit 33ebcb8

Please sign in to comment.