mirror of
https://github.com/mirror/processhacker
synced 2026-06-08 16:03:24 +00:00
renamed IReferenceCountedObject to IRefCounted
git-svn-id: svn://svn.code.sf.net/p/processhacker/code@1529 21ef857c-d57f-4fe0-8362-d861dc6d29cd
This commit is contained in:
@@ -50,7 +50,7 @@ namespace ProcessHacker.Common.Objects
|
||||
/// the object will be freed.
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
public abstract class BaseObject : IDisposable, IReferenceCountedObject
|
||||
public abstract class BaseObject : IDisposable, IRefCounted
|
||||
{
|
||||
private static int _createdCount = 0;
|
||||
private static int _freedCount = 0;
|
||||
|
||||
@@ -27,7 +27,7 @@ namespace ProcessHacker.Common.Objects
|
||||
public class HandleTableEntry
|
||||
{
|
||||
private int _handle;
|
||||
private IReferenceCountedObject _object;
|
||||
private IRefCounted _object;
|
||||
|
||||
public int Handle
|
||||
{
|
||||
@@ -35,7 +35,7 @@ namespace ProcessHacker.Common.Objects
|
||||
internal set { _handle = value; }
|
||||
}
|
||||
|
||||
public IReferenceCountedObject Object
|
||||
public IRefCounted Object
|
||||
{
|
||||
get { return _object; }
|
||||
internal set { _object = value; }
|
||||
@@ -81,7 +81,7 @@ namespace ProcessHacker.Common.Objects
|
||||
/// </summary>
|
||||
/// <param name="obj">The object to reference.</param>
|
||||
/// <returns>The new handle.</returns>
|
||||
public int Allocate(IReferenceCountedObject obj)
|
||||
public int Allocate(IRefCounted obj)
|
||||
{
|
||||
TEntry entry = new TEntry();
|
||||
|
||||
@@ -94,7 +94,7 @@ namespace ProcessHacker.Common.Objects
|
||||
/// <param name="obj">The object to reference.</param>
|
||||
/// <param name="entry">The handle table entry to use.</param>
|
||||
/// <returns>The new handle.</returns>
|
||||
public int Allocate(IReferenceCountedObject obj, TEntry entry)
|
||||
public int Allocate(IRefCounted obj, TEntry entry)
|
||||
{
|
||||
int handle = _handleGenerator.Pop();
|
||||
|
||||
@@ -142,7 +142,7 @@ namespace ProcessHacker.Common.Objects
|
||||
/// <returns>Whether the handle was closed.</returns>
|
||||
public bool Free(int handle)
|
||||
{
|
||||
IReferenceCountedObject obj;
|
||||
IRefCounted obj;
|
||||
|
||||
lock (_handles)
|
||||
{
|
||||
@@ -187,7 +187,7 @@ namespace ProcessHacker.Common.Objects
|
||||
/// An object. This object has not been referenced and is
|
||||
/// not guaranteed to be valid.
|
||||
/// </returns>
|
||||
public IReferenceCountedObject LookupObject(int handle)
|
||||
public IRefCounted LookupObject(int handle)
|
||||
{
|
||||
return this.LookupEntry(handle).Object;
|
||||
}
|
||||
@@ -202,7 +202,7 @@ namespace ProcessHacker.Common.Objects
|
||||
/// not guaranteed to be valid.
|
||||
/// </returns>
|
||||
public T LookupObject<T>(int handle)
|
||||
where T : class, IReferenceCountedObject
|
||||
where T : class, IRefCounted
|
||||
{
|
||||
return this.LookupObject(handle) as T;
|
||||
}
|
||||
@@ -215,7 +215,7 @@ namespace ProcessHacker.Common.Objects
|
||||
/// An object. This object has been referenced and must be
|
||||
/// dereferenced once it is no longer needed.
|
||||
/// </returns>
|
||||
public IReferenceCountedObject ReferenceByHandle(int handle)
|
||||
public IRefCounted ReferenceByHandle(int handle)
|
||||
{
|
||||
TEntry entry;
|
||||
return this.ReferenceByHandle(handle, out entry);
|
||||
@@ -230,13 +230,13 @@ namespace ProcessHacker.Common.Objects
|
||||
/// An object. This object has been referenced and must be
|
||||
/// dereferenced once it is no longer needed.
|
||||
/// </returns>
|
||||
public IReferenceCountedObject ReferenceByHandle(int handle, out TEntry entry)
|
||||
public IRefCounted ReferenceByHandle(int handle, out TEntry entry)
|
||||
{
|
||||
lock (_handles)
|
||||
{
|
||||
if (_handles.ContainsKey(handle))
|
||||
{
|
||||
IReferenceCountedObject obj = _handles[handle].Object;
|
||||
IRefCounted obj = _handles[handle].Object;
|
||||
|
||||
obj.Reference();
|
||||
entry = _handles[handle];
|
||||
@@ -261,7 +261,7 @@ namespace ProcessHacker.Common.Objects
|
||||
/// dereferenced once it is no longer needed.
|
||||
/// </returns>
|
||||
public T ReferenceByHandle<T>(int handle)
|
||||
where T : class, IReferenceCountedObject
|
||||
where T : class, IRefCounted
|
||||
{
|
||||
TEntry entry;
|
||||
return this.ReferenceByHandle<T>(handle, out entry);
|
||||
@@ -278,9 +278,9 @@ namespace ProcessHacker.Common.Objects
|
||||
/// dereferenced once it is no longer needed.
|
||||
/// </returns>
|
||||
public T ReferenceByHandle<T>(int handle, out TEntry entry)
|
||||
where T : class, IReferenceCountedObject
|
||||
where T : class, IRefCounted
|
||||
{
|
||||
IReferenceCountedObject obj = this.ReferenceByHandle(handle, out entry);
|
||||
IRefCounted obj = this.ReferenceByHandle(handle, out entry);
|
||||
|
||||
if (obj == null)
|
||||
return null;
|
||||
|
||||
+1
-1
@@ -2,7 +2,7 @@
|
||||
|
||||
namespace ProcessHacker.Common.Objects
|
||||
{
|
||||
public interface IReferenceCountedObject : IDisposable
|
||||
public interface IRefCounted : IDisposable
|
||||
{
|
||||
/// <summary>
|
||||
/// Decrements the reference count of the object.
|
||||
@@ -77,7 +77,7 @@ namespace ProcessHacker.Common.Objects
|
||||
/// <param name="obj">The object to reference.</param>
|
||||
/// <param name="grantedAccess">The granted access to the object.</param>
|
||||
/// <returns>The new handle.</returns>
|
||||
public int Allocate<TAccess>(IReferenceCountedObject obj, TAccess grantedAccess)
|
||||
public int Allocate<TAccess>(IRefCounted obj, TAccess grantedAccess)
|
||||
where TAccess : struct
|
||||
{
|
||||
TEntry entry = new TEntry();
|
||||
@@ -97,7 +97,7 @@ namespace ProcessHacker.Common.Objects
|
||||
/// An object. This object has been referenced and must be
|
||||
/// dereferenced once it is no longer needed.
|
||||
/// </returns>
|
||||
public IReferenceCountedObject ReferenceByHandle<TAccess>(int handle, TAccess access)
|
||||
public IRefCounted ReferenceByHandle<TAccess>(int handle, TAccess access)
|
||||
where TAccess : struct
|
||||
{
|
||||
return this.ReferenceByHandle<TAccess>(handle, access, false);
|
||||
@@ -116,11 +116,11 @@ namespace ProcessHacker.Common.Objects
|
||||
/// An object. This object has been referenced and must be
|
||||
/// dereferenced once it is no longer needed.
|
||||
/// </returns>
|
||||
public IReferenceCountedObject ReferenceByHandle<TAccess>(int handle, TAccess access, bool throwOnAccessDenied)
|
||||
public IRefCounted ReferenceByHandle<TAccess>(int handle, TAccess access, bool throwOnAccessDenied)
|
||||
where TAccess : struct
|
||||
{
|
||||
TEntry entry;
|
||||
IReferenceCountedObject obj;
|
||||
IRefCounted obj;
|
||||
|
||||
// Reference the object.
|
||||
obj = this.ReferenceByHandle(handle, out entry);
|
||||
@@ -158,7 +158,7 @@ namespace ProcessHacker.Common.Objects
|
||||
/// dereferenced once it is no longer needed.
|
||||
/// </returns>
|
||||
public T ReferenceByHandle<T, TAccess>(int handle, TAccess access)
|
||||
where T : class, IReferenceCountedObject
|
||||
where T : class, IRefCounted
|
||||
where TAccess : struct
|
||||
{
|
||||
return this.ReferenceByHandle<T, TAccess>(handle, access, false);
|
||||
@@ -179,10 +179,10 @@ namespace ProcessHacker.Common.Objects
|
||||
/// dereferenced once it is no longer needed.
|
||||
/// </returns>
|
||||
public T ReferenceByHandle<T, TAccess>(int handle, TAccess access, bool throwOnAccessDenied)
|
||||
where T : class, IReferenceCountedObject
|
||||
where T : class, IRefCounted
|
||||
where TAccess : struct
|
||||
{
|
||||
IReferenceCountedObject obj = this.ReferenceByHandle<TAccess>(handle, access, throwOnAccessDenied);
|
||||
IRefCounted obj = this.ReferenceByHandle<TAccess>(handle, access, throwOnAccessDenied);
|
||||
|
||||
if (obj == null)
|
||||
return null;
|
||||
|
||||
@@ -64,7 +64,7 @@
|
||||
<Compile Include="HistoryManager.cs" />
|
||||
<Compile Include="IdGenerator.cs" />
|
||||
<Compile Include="Objects\BaseObject.cs" />
|
||||
<Compile Include="Objects\IReferenceCountedObject.cs" />
|
||||
<Compile Include="Objects\IRefCounted.cs" />
|
||||
<Compile Include="IResettable.cs" />
|
||||
<Compile Include="Logging.cs" />
|
||||
<Compile Include="Messaging\MessageQueue.cs" />
|
||||
|
||||
Reference in New Issue
Block a user