mirror of
https://gitee.com/energye/energy.git
synced 2024-11-30 10:47:57 +08:00
升级和优化,绑定和进程通信 v6
This commit is contained in:
parent
7a71aadcda
commit
eb08af0b28
@ -663,8 +663,11 @@ func init() {
|
||||
dllimports.NewEnergyImport("CefV8ArrayBufferReleaseCallback_ReleaseBuffer", 0),
|
||||
//ICefProcessMessage
|
||||
dllimports.NewEnergyImport("CefProcessMessageRef_New", 0),
|
||||
dllimports.NewEnergyImport("CefProcessMessageRef_ArgumentList", 0),
|
||||
dllimports.NewEnergyImport("CefProcessMessageRef_Free", 0),
|
||||
dllimports.NewEnergyImport("CefProcessMessage_ArgumentList", 0),
|
||||
dllimports.NewEnergyImport("CefProcessMessage_IsValid", 0),
|
||||
dllimports.NewEnergyImport("CefProcessMessage_Copy", 0),
|
||||
dllimports.NewEnergyImport("CefProcessMessage_Name", 0),
|
||||
dllimports.NewEnergyImport("CefProcessMessage_Free", 0),
|
||||
//ICefListValu
|
||||
dllimports.NewEnergyImport("CefListValue_IsValid", 0),
|
||||
dllimports.NewEnergyImport("CefListValue_IsOwned", 0),
|
||||
@ -1343,8 +1346,11 @@ const (
|
||||
internale_CefV8ArrayBufferReleaseCallback_ReleaseBuffer
|
||||
//ICefProcessMessage
|
||||
internale_CefProcessMessageRef_New
|
||||
internale_CefProcessMessageRef_ArgumentList
|
||||
internale_CefProcessMessageRef_Free
|
||||
internale_CefProcessMessage_ArgumentList
|
||||
internale_CefProcessMessage_IsValid
|
||||
internale_CefProcessMessage_Copy
|
||||
internale_CefProcessMessage_Name
|
||||
internale_CefProcessMessage_Free
|
||||
//ICefListValue
|
||||
internale_CefListValue_IsValid
|
||||
internale_CefListValue_IsOwned
|
||||
|
@ -1,11 +1,55 @@
|
||||
package cef
|
||||
|
||||
// TCefProcessMessageRef
|
||||
import (
|
||||
"github.com/energye/energy/common/imports"
|
||||
"github.com/energye/golcl/lcl/api"
|
||||
"unsafe"
|
||||
)
|
||||
|
||||
// TCefProcessMessageRef -> ICefProcessMessage
|
||||
type TCefProcessMessageRef uintptr
|
||||
|
||||
// ProcessMessageRef -> ICefProcessMessage
|
||||
var ProcessMessageRef TCefProcessMessageRef
|
||||
|
||||
func (*TCefProcessMessageRef) New(name string) *ICefProcessMessage {
|
||||
|
||||
return nil
|
||||
var result uintptr
|
||||
imports.Proc(internale_CefProcessMessageRef_New).Call(api.PascalStr(name), uintptr(unsafe.Pointer(&result)))
|
||||
return &ICefProcessMessage{
|
||||
instance: unsafe.Pointer(result),
|
||||
}
|
||||
}
|
||||
func (m *ICefProcessMessage) Instance() uintptr {
|
||||
return uintptr(m.instance)
|
||||
}
|
||||
|
||||
func (m *ICefProcessMessage) ArgumentList() *ICefListValue {
|
||||
var result uintptr
|
||||
imports.Proc(internale_CefProcessMessage_ArgumentList).Call(m.Instance(), uintptr(unsafe.Pointer(&result)))
|
||||
return &ICefListValue{
|
||||
instance: unsafe.Pointer(result),
|
||||
}
|
||||
}
|
||||
|
||||
func (m *ICefProcessMessage) IsValid() bool {
|
||||
r1, _, _ := imports.Proc(internale_CefProcessMessage_Name).Call(m.Instance())
|
||||
return api.GoBool(r1)
|
||||
}
|
||||
|
||||
func (m *ICefProcessMessage) Copy() *ICefProcessMessage {
|
||||
var result uintptr
|
||||
imports.Proc(internale_CefProcessMessage_Copy).Call(m.Instance(), uintptr(unsafe.Pointer(&result)))
|
||||
return &ICefProcessMessage{
|
||||
instance: unsafe.Pointer(result),
|
||||
}
|
||||
}
|
||||
|
||||
func (m *ICefProcessMessage) Name() string {
|
||||
r1, _, _ := imports.Proc(internale_CefProcessMessage_Name).Call(m.Instance())
|
||||
return api.GoStr(r1)
|
||||
}
|
||||
|
||||
func (m *ICefProcessMessage) Free() {
|
||||
imports.Proc(internale_CefProcessMessage_Free).Call(m.Instance())
|
||||
m.instance = nil
|
||||
}
|
||||
|
@ -454,7 +454,7 @@ type TCefV8ValueRef uintptr
|
||||
|
||||
var V8ValueRef TCefV8ValueRef
|
||||
|
||||
func (m *TCefV8ValueRef) NewUndefined() *ICefV8Value {
|
||||
func (*TCefV8ValueRef) NewUndefined() *ICefV8Value {
|
||||
var result uintptr
|
||||
imports.Proc(internale_CefV8ValueRef_NewUndefined).Call(uintptr(unsafe.Pointer(&result)))
|
||||
return &ICefV8Value{
|
||||
@ -462,7 +462,7 @@ func (m *TCefV8ValueRef) NewUndefined() *ICefV8Value {
|
||||
}
|
||||
}
|
||||
|
||||
func (m *TCefV8ValueRef) NewNull() *ICefV8Value {
|
||||
func (*TCefV8ValueRef) NewNull() *ICefV8Value {
|
||||
var result uintptr
|
||||
imports.Proc(internale_CefV8ValueRef_NewNull).Call(uintptr(unsafe.Pointer(&result)))
|
||||
return &ICefV8Value{
|
||||
@ -470,14 +470,14 @@ func (m *TCefV8ValueRef) NewNull() *ICefV8Value {
|
||||
}
|
||||
}
|
||||
|
||||
func (m *TCefV8ValueRef) NewBool(value bool) *ICefV8Value {
|
||||
func (*TCefV8ValueRef) NewBool(value bool) *ICefV8Value {
|
||||
var result uintptr
|
||||
imports.Proc(internale_CefV8ValueRef_NewBool).Call(api.PascalBool(value), uintptr(unsafe.Pointer(&result)))
|
||||
return &ICefV8Value{
|
||||
instance: unsafe.Pointer(result),
|
||||
}
|
||||
}
|
||||
func (m *TCefV8ValueRef) NewInt(value int32) *ICefV8Value {
|
||||
func (*TCefV8ValueRef) NewInt(value int32) *ICefV8Value {
|
||||
var result uintptr
|
||||
imports.Proc(internale_CefV8ValueRef_NewInt).Call(uintptr(value), uintptr(unsafe.Pointer(&result)))
|
||||
return &ICefV8Value{
|
||||
@ -485,7 +485,7 @@ func (m *TCefV8ValueRef) NewInt(value int32) *ICefV8Value {
|
||||
}
|
||||
}
|
||||
|
||||
func (m *TCefV8ValueRef) NewUInt(value uint32) *ICefV8Value {
|
||||
func (*TCefV8ValueRef) NewUInt(value uint32) *ICefV8Value {
|
||||
var result uintptr
|
||||
imports.Proc(internale_CefV8ValueRef_NewUInt).Call(uintptr(value), uintptr(unsafe.Pointer(&result)))
|
||||
return &ICefV8Value{
|
||||
@ -493,7 +493,7 @@ func (m *TCefV8ValueRef) NewUInt(value uint32) *ICefV8Value {
|
||||
}
|
||||
}
|
||||
|
||||
func (m *TCefV8ValueRef) NewDouble(value float64) *ICefV8Value {
|
||||
func (*TCefV8ValueRef) NewDouble(value float64) *ICefV8Value {
|
||||
var result uintptr
|
||||
imports.Proc(internale_CefV8ValueRef_NewDouble).Call(uintptr(unsafe.Pointer(&value)), uintptr(unsafe.Pointer(&result)))
|
||||
return &ICefV8Value{
|
||||
@ -501,7 +501,7 @@ func (m *TCefV8ValueRef) NewDouble(value float64) *ICefV8Value {
|
||||
}
|
||||
}
|
||||
|
||||
func (m *TCefV8ValueRef) NewDate(value time.Time) *ICefV8Value {
|
||||
func (*TCefV8ValueRef) NewDate(value time.Time) *ICefV8Value {
|
||||
var result uintptr
|
||||
val := common.GoDateTimeToDDateTime(value)
|
||||
imports.Proc(internale_CefV8ValueRef_NewDate).Call(uintptr(unsafe.Pointer(&val)), uintptr(unsafe.Pointer(&result)))
|
||||
@ -510,7 +510,7 @@ func (m *TCefV8ValueRef) NewDate(value time.Time) *ICefV8Value {
|
||||
}
|
||||
}
|
||||
|
||||
func (m *TCefV8ValueRef) NewString(value string) *ICefV8Value {
|
||||
func (*TCefV8ValueRef) NewString(value string) *ICefV8Value {
|
||||
var result uintptr
|
||||
imports.Proc(internale_CefV8ValueRef_NewString).Call(api.PascalStr(value), uintptr(unsafe.Pointer(&result)))
|
||||
return &ICefV8Value{
|
||||
@ -518,7 +518,7 @@ func (m *TCefV8ValueRef) NewString(value string) *ICefV8Value {
|
||||
}
|
||||
}
|
||||
|
||||
func (m *TCefV8ValueRef) NewObject(accessor *ICefV8Accessor, interceptor *ICefV8Interceptor) *ICefV8Value {
|
||||
func (*TCefV8ValueRef) NewObject(accessor *ICefV8Accessor, interceptor *ICefV8Interceptor) *ICefV8Value {
|
||||
var result uintptr
|
||||
imports.Proc(internale_CefV8ValueRef_NewObject).Call(accessor.Instance(), interceptor.Instance(), uintptr(unsafe.Pointer(&result)))
|
||||
return &ICefV8Value{
|
||||
@ -526,7 +526,7 @@ func (m *TCefV8ValueRef) NewObject(accessor *ICefV8Accessor, interceptor *ICefV8
|
||||
}
|
||||
}
|
||||
|
||||
func (m *TCefV8ValueRef) NewArray(len int32) *ICefV8Value {
|
||||
func (*TCefV8ValueRef) NewArray(len int32) *ICefV8Value {
|
||||
var result uintptr
|
||||
imports.Proc(internale_CefV8ValueRef_NewArray).Call(uintptr(len), uintptr(unsafe.Pointer(&result)))
|
||||
return &ICefV8Value{
|
||||
@ -534,7 +534,7 @@ func (m *TCefV8ValueRef) NewArray(len int32) *ICefV8Value {
|
||||
}
|
||||
}
|
||||
|
||||
func (m *TCefV8ValueRef) NewArrayBuffer(buffer []byte, callback *ICefV8ArrayBufferReleaseCallback) *ICefV8Value {
|
||||
func (*TCefV8ValueRef) NewArrayBuffer(buffer []byte, callback *ICefV8ArrayBufferReleaseCallback) *ICefV8Value {
|
||||
var bufLen = len(buffer)
|
||||
if bufLen == 0 {
|
||||
return nil
|
||||
@ -549,7 +549,7 @@ func (m *TCefV8ValueRef) NewArrayBuffer(buffer []byte, callback *ICefV8ArrayBuff
|
||||
}
|
||||
}
|
||||
|
||||
func (m *TCefV8ValueRef) NewFunction(name string, handler *ICefV8Handler) *ICefV8Value {
|
||||
func (*TCefV8ValueRef) NewFunction(name string, handler *ICefV8Handler) *ICefV8Value {
|
||||
var result uintptr
|
||||
imports.Proc(internale_CefV8ValueRef_NewFunction).Call(api.PascalStr(name), handler.Instance(), uintptr(unsafe.Pointer(&result)))
|
||||
return &ICefV8Value{
|
||||
@ -557,7 +557,7 @@ func (m *TCefV8ValueRef) NewFunction(name string, handler *ICefV8Handler) *ICefV
|
||||
}
|
||||
}
|
||||
|
||||
func (m *TCefV8ValueRef) NewPromise() *ICefV8Value {
|
||||
func (*TCefV8ValueRef) NewPromise() *ICefV8Value {
|
||||
var result uintptr
|
||||
imports.Proc(internale_CefV8ValueRef_NewPromise).Call(uintptr(unsafe.Pointer(&result)))
|
||||
return &ICefV8Value{
|
||||
|
@ -40,6 +40,8 @@ func main() {
|
||||
handler.Execute(func(name string, object *cef.ICefV8Value, arguments *cef.TCefV8ValueArray, retVal *cef.ResultV8Value, exception *cef.Exception) bool {
|
||||
fmt.Println("handler.Execute", name)
|
||||
retVal.SetResult(cef.V8ValueRef.NewString("函数返回值?"))
|
||||
message := cef.ProcessMessageRef.New("testname")
|
||||
fmt.Println("ProcessMessageRef IsValid", message.IsValid(), message.Name())
|
||||
return true
|
||||
})
|
||||
object := cef.V8ValueRef.NewObject(nil, nil)
|
||||
|
Loading…
Reference in New Issue
Block a user