upgrade-dev v2.1.39

This commit is contained in:
杨红岩 2023-03-08 23:32:52 +08:00
parent c4f13c52fb
commit 2a86cadfda
6 changed files with 30 additions and 63 deletions

View File

@ -43,6 +43,7 @@ type contextCreate struct {
ipc *ICefV8Value
ipcEmitHandler *ICefV8Handler
ipcOnHandler *ICefV8Handler
ipcEmitMessage *ICefProcessMessage
ipcCallbackList *list.List
bind *ICefV8Value
}
@ -239,11 +240,11 @@ func (m *contextCreate) ipcEmitExecute(name string, object *ICefV8Value, argumen
}
//入参
if emitArgs != nil {
ipcEmitMessage := ProcessMessageRef.new(internalProcessMessageIPCEmit)
argument := ipcEmitMessage.ArgumentList()
defer func() {
ipcEmitMessage.Free()
}()
if m.ipcEmitMessage == nil {
m.ipcEmitMessage = ProcessMessageRef.new(internalProcessMessageIPCEmit)
}
argument := m.ipcEmitMessage.ArgumentList()
argument.Clear()
args, err := convertV8ValueToProcessMessage(emitArgs)
if err != nil {
return
@ -262,7 +263,7 @@ func (m *contextCreate) ipcEmitExecute(name string, object *ICefV8Value, argumen
argument.SetString(1, emitNameValue) // 事件名
argument.SetList(2, args) // args
frame := v8ctx.Frame()
frame.SendProcessMessage(consts.PID_BROWSER, ipcEmitMessage)
frame.SendProcessMessage(consts.PID_BROWSER, m.ipcEmitMessage)
}
retVal.SetResult(V8ValueRef.NewBool(true))
return

View File

@ -58,36 +58,13 @@ func RemoveGoForm(windowId int32) {
imports.Proc(internale_CEF_RemoveGoForm).Call(uintptr(windowId))
}
// TCEFBaseRefCountedOwn
func (m *TCEFBaseRefCountedOwn) Destroy(data uintptr) {
imports.Proc(internale_CefBaseRefCountedOwn_Destroy).Call(data)
}
func (m *TCEFBaseRefCountedOwn) DestroyOtherRefs(data uintptr) {
imports.Proc(internale_CefBaseRefCountedOwn_DestroyOtherRefs).Call(data)
}
func (m *TCEFBaseRefCountedOwn) Wrap(data uintptr) unsafe.Pointer {
// ICefBaseRefCounted
func (m *ICefBaseRefCounted) Wrap(data uintptr) unsafe.Pointer {
var result uintptr
imports.Proc(internale_CefBaseRefCountedOwn_Wrap).Call(data, uintptr(unsafe.Pointer(&result)))
imports.Proc(internale_CefBaseRefCounted_Wrap).Call(data, uintptr(unsafe.Pointer(&result)))
return unsafe.Pointer(result)
}
func (m *TCEFBaseRefCountedOwn) Free(data uintptr) {
imports.Proc(internale_CefBaseRefCountedOwn_Free).Call(data)
}
// TCEFBaseRefCountedRef
func (m *TCEFBaseRefCountedRef) Destroy(data uintptr) {
imports.Proc(internale_CefBaseRefCountedRef_Destroy).Call(data)
}
func (m *TCEFBaseRefCountedRef) Wrap(data uintptr) unsafe.Pointer {
var result uintptr
imports.Proc(internale_CefBaseRefCountedRef_Wrap).Call(data, uintptr(unsafe.Pointer(&result)))
return unsafe.Pointer(result)
}
func (m *TCEFBaseRefCountedRef) Free(data uintptr) {
imports.Proc(internale_CefBaseRefCountedRef_Free).Call(data)
func (m *ICefBaseRefCounted) Free(data uintptr) {
imports.Proc(internale_CefBaseRefCounted_Free).Call(uintptr(unsafe.Pointer(&data)))
}

View File

@ -38,15 +38,9 @@ func init() {
dllimports.NewEnergyImport("CEF_Win_SetCursor", 0),
dllimports.NewEnergyImport("CEF_Win_LoadCursor", 0),
dllimports.NewEnergyImport("CEF_Win_OnPaint", 0),
//TCEFBaseRefCountedOwn
dllimports.NewEnergyImport("CefBaseRefCountedOwn_Destroy", 0),
dllimports.NewEnergyImport("CefBaseRefCountedOwn_DestroyOtherRefs", 0),
dllimports.NewEnergyImport("CefBaseRefCountedOwn_Wrap", 0),
dllimports.NewEnergyImport("CefBaseRefCountedOwn_Free", 0),
//TCEFBaseRefCountedRef
dllimports.NewEnergyImport("CefBaseRefCountedRef_Destroy", 0),
dllimports.NewEnergyImport("CefBaseRefCountedRef_Wrap", 0),
dllimports.NewEnergyImport("CefBaseRefCountedRef_Free", 0),
dllimports.NewEnergyImport("CefBaseRefCounted_Wrap", 0),
dllimports.NewEnergyImport("CefBaseRefCounted_Free", 0),
//ApplicationQueueAsyncCallFunc
dllimports.NewEnergyImport("SetApplicationQueueAsyncCallFunc", 0),
dllimports.NewEnergyImport("CEFApplication_QueueAsyncCall", 0),
@ -876,6 +870,7 @@ func init() {
dllimports.NewEnergyImport("CefV8Value_ExecuteFunctionWithContext", 0),
dllimports.NewEnergyImport("CefV8Value_ResolvePromise", 0),
dllimports.NewEnergyImport("CefV8Value_RejectPromise", 0),
dllimports.NewEnergyImport("CefV8Value_Free", 0),
//TCefV8ValueRef
dllimports.NewEnergyImport("CefV8ValueRef_NewUndefined", 0),
dllimports.NewEnergyImport("CefV8ValueRef_NewNull", 0),
@ -1104,15 +1099,9 @@ const (
internale_CEF_Win_SetCursor
internale_CEF_Win_LoadCursor
internale_CEF_Win_OnPaint
//TCEFBaseRefCountedOwn
internale_CefBaseRefCountedOwn_Destroy
internale_CefBaseRefCountedOwn_DestroyOtherRefs
internale_CefBaseRefCountedOwn_Wrap
internale_CefBaseRefCountedOwn_Free
//TCEFBaseRefCountedRef
internale_CefBaseRefCountedRef_Destroy
internale_CefBaseRefCountedRef_Wrap
internale_CefBaseRefCountedRef_Free
//ICefBaseRefCounted
internale_CefBaseRefCounted_Wrap
internale_CefBaseRefCounted_Free
//ApplicationQueueAsyncCallFunc
internale_SetApplicationQueueAsyncCallFunc
internale_CEFApplication_QueueAsyncCall
@ -1943,6 +1932,7 @@ const (
internale_CefV8Value_ExecuteFunctionWithContext
internale_CefV8Value_ResolvePromise
internale_CefV8Value_RejectPromise
internale_CefV8Value_Free
//TCefV8ValueRef
internale_CefV8ValueRef_NewUndefined
internale_CefV8ValueRef_NewNull

View File

@ -308,8 +308,8 @@ func (m *ICefV8Value) DeleteValueByKey(key string) bool {
return m.deleteValueByKey(key)
}
func (m *ICefV8Value) DeleteValueByIndex(index int32) bool {
r1, _, _ := imports.Proc(internale_CefV8Value_DeleteValueByIndex).Call(m.Instance(), uintptr(index))
func (m *ICefV8Value) DeleteValueByIndex(index int) bool {
r1, _, _ := imports.Proc(internale_CefV8Value_DeleteValueByIndex).Call(m.Instance(), uintptr(int32(index)))
return api.GoBool(r1)
}
@ -512,6 +512,7 @@ func (m *ICefV8Value) RejectPromise(errorMsg string) bool {
}
func (m *ICefV8Value) Free() {
m.base.Free(m.Instance())
m.instance = nil
if m.valueByKeyMap != nil {
m.valueByKeyMap = nil
@ -579,8 +580,8 @@ func (m *TCefV8ValueArray) Free() {
return
}
m.instance = nil
m.argumentsCollect = nil
m.arguments = 0
m.argumentsCollect = nil
m.argumentsLength = 0
}

View File

@ -176,12 +176,9 @@ type TCefPoint struct {
Y int32
}
// TCEFBaseRefCountedOwn
type TCEFBaseRefCountedOwn struct {
}
// TCEFBaseRefCountedRef
type TCEFBaseRefCountedRef struct {
// ICefBaseRefCounted
type ICefBaseRefCounted struct {
instance unsafe.Pointer
}
// ICefBrowser main
@ -330,6 +327,7 @@ type ICefV8Exception struct {
// 1. 在回调函数中有效
// 2. 回调函数外使用 cef.V8ContextRef.Current() 获取上下文对象
type ICefV8Context struct {
base ICefBaseRefCounted
instance unsafe.Pointer
browser *ICefBrowser
frame *ICefFrame
@ -338,7 +336,7 @@ type ICefV8Context struct {
// ICefV8Value
type ICefV8Value struct {
TCEFBaseRefCountedRef
base ICefBaseRefCounted
instance unsafe.Pointer
valueType V8ValueType
valueByIndexArray []*ICefV8Value

View File

@ -36,7 +36,7 @@
100, 200, "数组里的字符串", 66996.99, objectValue, true, false
]
let ok = ipc.emit("testEmitName", ["stringValue", 100 + idx, true, 1999.66 + idx, "字符串?", 29999.66 + idx, objectValue, arrayValue, 8888888 + idx, null, undefined],
function (result1, result2, result3, result4, result5, result6, result7, result8, result9, result10, result11, result12, result13) {
/*function (result1, result2, result3, result4, result5, result6, result7, result8, result9, result10, result11, result12, result13) {
//msg('testEmitName 回调函数执行了', result1, result2, result3, result4, result5, result6, result7, result8, result9, result10, result11, result12);
//第2个返回值是 ArrayBuffer 类型,字节数组
@ -70,7 +70,7 @@
console.log('result11', result11)
console.log('result12', result12)
console.log('result13', result13)
});
}*/);
//msg('ipc.emit ok?', ok);
//let ok1 = ipc.emit([]);