mirror of
https://gitee.com/energye/energy.git
synced 2024-11-30 10:47:57 +08:00
upgrade-dev v2.1.13
This commit is contained in:
parent
1ce735d86b
commit
b57e4cc77a
@ -85,7 +85,7 @@ func (m *contextCreate) makeIPC(context *ICefV8Context) {
|
||||
func (m *contextCreate) ipcEmitExecute(name string, object *ICefV8Value, arguments *TCefV8ValueArray, retVal *ResultV8Value, exception *Exception) bool {
|
||||
fmt.Println("emit handler name:", name, "arguments-size:", arguments.Size())
|
||||
for i := 0; i < arguments.Size(); i++ {
|
||||
fmt.Println("\t", arguments.Get(i))
|
||||
fmt.Println("\t", i, arguments.Get(i).IsString(), arguments.Get(i).IsArray(), arguments.Get(i).IsFunction(), arguments.Get(i).Instance(), arguments.Get(i).Instance())
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
@ -70,7 +70,7 @@ func init() {
|
||||
object := &ICefV8Value{instance: getPtr(1)}
|
||||
argumentsPtr := getVal(2)
|
||||
argumentsLength := int32(getVal(3))
|
||||
arguments := &TCefV8ValueArray{instance: unsafe.Pointer(argumentsPtr), arguments: argumentsPtr, argumentsLength: int(argumentsLength)}
|
||||
arguments := &TCefV8ValueArray{instance: unsafe.Pointer(argumentsPtr), arguments: argumentsPtr, argumentsLength: int(argumentsLength), argumentsCollect: make([]*ICefV8Value, int(argumentsLength))}
|
||||
retValPtr := (*uintptr)(getPtr(4))
|
||||
retVal := &ResultV8Value{}
|
||||
exceptionPtr := (*uintptr)(getPtr(5))
|
||||
@ -86,7 +86,7 @@ func init() {
|
||||
*exceptionPtr = 0
|
||||
}
|
||||
*resultPtr = result
|
||||
arguments.instance = nil
|
||||
arguments.Free()
|
||||
object.Free()
|
||||
default:
|
||||
return false
|
||||
|
@ -357,7 +357,12 @@ func (m *ResultV8Value) SetResult(v8value *ICefV8Value) {
|
||||
// Get 根据下标获取 ICefV8Value
|
||||
func (m *TCefV8ValueArray) Get(index int) *ICefV8Value {
|
||||
if index < m.argumentsLength {
|
||||
return &ICefV8Value{instance: unsafe.Pointer(common.GetParamOf(index, m.arguments))}
|
||||
value := m.argumentsCollect[index]
|
||||
if value == nil {
|
||||
value = &ICefV8Value{instance: unsafe.Pointer(common.GetParamOf(index, m.arguments))}
|
||||
m.argumentsCollect[index] = value
|
||||
}
|
||||
return value
|
||||
}
|
||||
return nil
|
||||
}
|
||||
@ -367,6 +372,13 @@ func (m *TCefV8ValueArray) Size() int {
|
||||
return m.argumentsLength
|
||||
}
|
||||
|
||||
func (m *TCefV8ValueArray) Free() {
|
||||
m.instance = nil
|
||||
m.argumentsCollect = nil
|
||||
m.arguments = 0
|
||||
m.argumentsLength = 0
|
||||
}
|
||||
|
||||
// V8ValueRef -> ICefV8Value
|
||||
var V8ValueRef cefV8Value
|
||||
|
||||
|
@ -320,9 +320,10 @@ type ICefV8Value struct {
|
||||
|
||||
// TCefV8ValueArray ICefV8Value 数组的替代结构
|
||||
type TCefV8ValueArray struct {
|
||||
instance unsafe.Pointer
|
||||
arguments uintptr
|
||||
argumentsLength int
|
||||
instance unsafe.Pointer
|
||||
arguments uintptr
|
||||
argumentsLength int
|
||||
argumentsCollect []*ICefV8Value
|
||||
}
|
||||
|
||||
// ICefV8Handler
|
||||
|
Loading…
Reference in New Issue
Block a user