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

View File

@ -58,36 +58,13 @@ func RemoveGoForm(windowId int32) {
imports.Proc(internale_CEF_RemoveGoForm).Call(uintptr(windowId)) imports.Proc(internale_CEF_RemoveGoForm).Call(uintptr(windowId))
} }
// TCEFBaseRefCountedOwn // ICefBaseRefCounted
func (m *TCEFBaseRefCountedOwn) Destroy(data uintptr) { func (m *ICefBaseRefCounted) Wrap(data uintptr) unsafe.Pointer {
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 {
var result uintptr 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) return unsafe.Pointer(result)
} }
func (m *TCEFBaseRefCountedOwn) Free(data uintptr) { func (m *ICefBaseRefCounted) Free(data uintptr) {
imports.Proc(internale_CefBaseRefCountedOwn_Free).Call(data) imports.Proc(internale_CefBaseRefCounted_Free).Call(uintptr(unsafe.Pointer(&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)
} }

View File

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

View File

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

View File

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

View File

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