summaryrefslogtreecommitdiff
path: root/src/bindings/mono/eo_mono/WrapperSupervisor.cs
diff options
context:
space:
mode:
Diffstat (limited to 'src/bindings/mono/eo_mono/WrapperSupervisor.cs')
-rw-r--r--src/bindings/mono/eo_mono/WrapperSupervisor.cs34
1 files changed, 22 insertions, 12 deletions
diff --git a/src/bindings/mono/eo_mono/WrapperSupervisor.cs b/src/bindings/mono/eo_mono/WrapperSupervisor.cs
index 21ef052..31cdaa9 100644
--- a/src/bindings/mono/eo_mono/WrapperSupervisor.cs
+++ b/src/bindings/mono/eo_mono/WrapperSupervisor.cs
@@ -1,14 +1,26 @@
1/*
2 * Copyright 2019 by its authors. See AUTHORS.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
1using System; 16using System;
2using EventDictionary = System.Collections.Generic.Dictionary<(System.IntPtr desc, object evtDelegate), (System.IntPtr evtCallerPtr, Efl.EventCb evtCaller)>; 17using EventDictionary = System.Collections.Generic.Dictionary<(System.IntPtr desc, object evtDelegate), (System.IntPtr evtCallerPtr, Efl.EventCb evtCaller)>;
3 18
4namespace Efl 19namespace Efl.Eo
5{
6
7namespace Eo
8{ 20{
9 21
10/// <summary>Observe the ownership state of an Eo wrapper and control its life-cycle.</summary> 22/// <summary>Observe the ownership state of an Eo wrapper and control its life-cycle.</summary>
11public class WrapperSupervisor 23internal class WrapperSupervisor
12{ 24{
13 private System.WeakReference weakRef; 25 private System.WeakReference weakRef;
14#pragma warning disable CS0414 26#pragma warning disable CS0414
@@ -18,7 +30,7 @@ public class WrapperSupervisor
18 30
19 /// <summary>Create a new supervisor for the given.</summary> 31 /// <summary>Create a new supervisor for the given.</summary>
20 /// <param name="obj">Efl object to be supervised.</param> 32 /// <param name="obj">Efl object to be supervised.</param>
21 public WrapperSupervisor(Efl.Eo.IWrapper obj) 33 internal WrapperSupervisor(Efl.Eo.IWrapper obj)
22 { 34 {
23 weakRef = new WeakReference(obj); 35 weakRef = new WeakReference(obj);
24 sharedRef = null; 36 sharedRef = null;
@@ -26,7 +38,7 @@ public class WrapperSupervisor
26 } 38 }
27 39
28 /// <summary>Efl object being supervised.</summary> 40 /// <summary>Efl object being supervised.</summary>
29 public Efl.Eo.IWrapper Target 41 internal Efl.Eo.IWrapper Target
30 { 42 {
31 get 43 get
32 { 44 {
@@ -35,7 +47,7 @@ public class WrapperSupervisor
35 } 47 }
36 48
37 /// <summary>Dictionary that holds the events related with the supervised object.</summary> 49 /// <summary>Dictionary that holds the events related with the supervised object.</summary>
38 public EventDictionary EoEvents 50 internal EventDictionary EoEvents
39 { 51 {
40 get 52 get
41 { 53 {
@@ -44,13 +56,13 @@ public class WrapperSupervisor
44 } 56 }
45 57
46 /// <summary>To be called when the object is uniquely owned by C#, removing its strong reference and making it available to garbage collection.</summary> 58 /// <summary>To be called when the object is uniquely owned by C#, removing its strong reference and making it available to garbage collection.</summary>
47 public void MakeUnique() 59 internal void MakeUnique()
48 { 60 {
49 sharedRef = null; 61 sharedRef = null;
50 } 62 }
51 63
52 /// <summary>To be called when the object is owned in the native library too, adding a strong reference to it and making it unavailable for garbage collection.</summary> 64 /// <summary>To be called when the object is owned in the native library too, adding a strong reference to it and making it unavailable for garbage collection.</summary>
53 public void MakeShared() 65 internal void MakeShared()
54 { 66 {
55 if (this.Target == null) 67 if (this.Target == null)
56 throw new InvalidOperationException("Tried to make a null reference shared."); 68 throw new InvalidOperationException("Tried to make a null reference shared.");
@@ -60,5 +72,3 @@ public class WrapperSupervisor
60 72
61} 73}
62 74
63}
64