mirror of
https://github.com/salvadordf/CEF4Delphi.git
synced 2024-11-15 07:45:56 +01:00
54 lines
1.1 KiB
ObjectPascal
54 lines
1.1 KiB
ObjectPascal
|
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.
|