energy/cef/cef-base-ref-counted.go

35 lines
844 B
Go
Raw Normal View History

2023-03-08 23:34:17 +08:00
//----------------------------------------
//
// Copyright © yanghy. All Rights Reserved.
//
// Licensed under Apache License Version 2.0, January 2004
//
// https://www.apache.org/licenses/LICENSE-2.0
//
//----------------------------------------
package cef
import (
"github.com/energye/energy/common/imports"
"unsafe"
)
2023-03-09 23:17:55 +08:00
type ICefBaseRefCounted interface {
Wrap(data uintptr) unsafe.Pointer
Free(data uintptr)
}
2023-03-09 19:27:00 +08:00
// Wrap 指针引用包裹
2023-03-09 23:17:55 +08:00
func (m *TCefBaseRefCounted) Wrap(data uintptr) unsafe.Pointer {
2023-03-08 23:34:17 +08:00
var result uintptr
imports.Proc(internale_CefBaseRefCounted_Wrap).Call(data, uintptr(unsafe.Pointer(&result)))
return unsafe.Pointer(result)
}
2023-03-09 19:27:00 +08:00
// Free 释放底层指针
2023-03-09 23:17:55 +08:00
func (m *TCefBaseRefCounted) Free(data uintptr) {
2023-03-08 23:34:17 +08:00
imports.Proc(internale_CefBaseRefCounted_Free).Call(uintptr(unsafe.Pointer(&data)))
2023-03-09 16:35:38 +08:00
m.instance = nil
2023-03-08 23:34:17 +08:00
}