1
0
mirror of https://github.com/salvadordf/CEF4Delphi.git synced 2024-11-24 08:02:15 +02:00
CEF4Delphi/source/uCEFSharedMemoryRegion.pas

54 lines
1.1 KiB
ObjectPascal
Raw Permalink Normal View History

2022-08-06 12:00:28 +02:00
unit uCEFSharedMemoryRegion;
{$IFDEF FPC}
{$MODE OBJFPC}{$H+}
{$ENDIF}
{$I cef.inc}
{$IFNDEF TARGET_64BITS}{$ALIGN ON}{$ENDIF}
{$MINENUMSIZE 4}
interface
uses
uCEFBaseRefCounted, uCEFInterfaces, uCEFTypes;
type
TCefSharedMemoryRegionRef = class(TCefBaseRefCountedRef, ICefSharedMemoryRegion)
protected
function IsValid: boolean;
function Size: NativeUInt;
function Memory: pointer;
public
class function UnWrap(data: Pointer): ICefSharedMemoryRegion;
end;
implementation
function TCefSharedMemoryRegionRef.IsValid: Boolean;
begin
Result := PCefSharedMemoryRegion(FData)^.is_valid(PCefSharedMemoryRegion(FData)) <> 0;
end;
function TCefSharedMemoryRegionRef.Size: NativeUInt;
begin
Result := PCefSharedMemoryRegion(FData)^.Size(PCefSharedMemoryRegion(FData));
end;
function TCefSharedMemoryRegionRef.Memory: pointer;
begin
Result := PCefSharedMemoryRegion(FData)^.Memory(PCefSharedMemoryRegion(FData));
end;
class function TCefSharedMemoryRegionRef.UnWrap(data: Pointer): ICefSharedMemoryRegion;
begin
if (data <> nil) then
Result := Create(data) as ICefSharedMemoryRegion
else
Result := nil;
end;
end.