upgrade-dev v2.2.3

This commit is contained in:
杨红岩 2023-03-13 12:07:31 +08:00
parent d35d24135d
commit f3eff60da9
5 changed files with 30 additions and 19 deletions

View File

@ -186,8 +186,6 @@ func (m *mainRun) ipcEmitMessage(browser *ICefBrowser, frame *ICefFrame, sourceP
}
ipcContext.ArgumentList().Free()
ipcContext.Result(nil)
frame.Free()
browser.Free()
return
}

View File

@ -194,39 +194,41 @@ func init() {
case GlobalCEFAppEventOnBrowserDestroyed:
fn.(GlobalCEFAppEventOnBrowserDestroyed)(&ICefBrowser{instance: getPtr(0)})
case GlobalCEFAppEventOnRenderLoadStart:
browser := &ICefBrowser{instance: getPtr(0)}
browse := &ICefBrowser{instance: getPtr(0)}
frame := &ICefFrame{instance: getPtr(1)}
fn.(GlobalCEFAppEventOnRenderLoadStart)(browser, frame, TCefTransitionType(getVal(2)))
fn.(GlobalCEFAppEventOnRenderLoadStart)(browse, frame, TCefTransitionType(getVal(2)))
case GlobalCEFAppEventOnRenderLoadEnd:
browser := &ICefBrowser{instance: getPtr(0)}
browse := &ICefBrowser{instance: getPtr(0)}
frame := &ICefFrame{instance: getPtr(1)}
fn.(GlobalCEFAppEventOnRenderLoadEnd)(browser, frame, int32(getVal(2)))
fn.(GlobalCEFAppEventOnRenderLoadEnd)(browse, frame, int32(getVal(2)))
case GlobalCEFAppEventOnRenderLoadError:
browser := &ICefBrowser{instance: getPtr(0)}
browse := &ICefBrowser{instance: getPtr(0)}
frame := &ICefFrame{instance: getPtr(1)}
fn.(GlobalCEFAppEventOnRenderLoadError)(browser, frame, TCefErrorCode(getVal(2)), api.GoStr(getVal(3)), api.GoStr(getVal(4)))
fn.(GlobalCEFAppEventOnRenderLoadError)(browse, frame, TCefErrorCode(getVal(2)), api.GoStr(getVal(3)), api.GoStr(getVal(4)))
case GlobalCEFAppEventOnRenderLoadingStateChange:
browser := &ICefBrowser{instance: getPtr(0)}
browse := &ICefBrowser{instance: getPtr(0)}
frame := &ICefFrame{instance: getPtr(1)}
fn.(GlobalCEFAppEventOnRenderLoadingStateChange)(browser, frame, api.GoBool(getVal(2)), api.GoBool(getVal(3)), api.GoBool(getVal(4)))
fn.(GlobalCEFAppEventOnRenderLoadingStateChange)(browse, frame, api.GoBool(getVal(2)), api.GoBool(getVal(3)), api.GoBool(getVal(4)))
case RenderProcessMessageReceived:
browser := &ICefBrowser{instance: getPtr(0)}
browse := &ICefBrowser{instance: getPtr(0)}
frame := &ICefFrame{instance: getPtr(1)}
processId := CefProcessId(getVal(2))
message := &ICefProcessMessage{instance: getPtr(3)}
var result = (*bool)(getPtr(4))
*result = fn.(RenderProcessMessageReceived)(browser, frame, processId, message)
*result = fn.(RenderProcessMessageReceived)(browse, frame, processId, message)
if !*result {
*result = renderProcessMessageReceived(browser, frame, processId, message)
*result = renderProcessMessageReceived(browse, frame, processId, message)
}
frame.Free()
browse.Free()
message.Free()
case GlobalCEFAppEventOnContextCreated:
browser := &ICefBrowser{instance: getPtr(0)}
browse := &ICefBrowser{instance: getPtr(0)}
frame := &ICefFrame{instance: getPtr(1)}
ctx := &ICefV8Context{instance: getPtr(2)}
var result = fn.(GlobalCEFAppEventOnContextCreated)(browser, frame, ctx)
var result = fn.(GlobalCEFAppEventOnContextCreated)(browse, frame, ctx)
if !result {
appOnContextCreated(browser, frame, ctx)
appOnContextCreated(browse, frame, ctx)
}
case GlobalCEFAppEventOnWebKitInitialized:
fn.(GlobalCEFAppEventOnWebKitInitialized)()

View File

@ -86,8 +86,8 @@ func init() {
if !*result {
*result = mainProcessMessageReceived(browse, frame, processId, message)
}
//frame.Free()
//browse.Free()
frame.Free()
browse.Free()
message.Free()
case ChromiumEventOnResourceLoadComplete:
sender, browse, frame, request, response := resourceEventGet(fn, getVal, true)

View File

@ -7,6 +7,7 @@ import (
"github.com/energye/energy/common/assetserve"
"github.com/energye/energy/example/dev-test/ipc-event/src"
"github.com/energye/energy/ipc"
"github.com/energye/golcl/lcl"
//_ "net/http/pprof"
)
@ -146,6 +147,16 @@ func main() {
var boolField = true
cef.VariableBind.Bind("boolField", &boolField)
cef.VariableBind.Bind("structField", src.StructField)
cef.BrowserWindow.SetBrowserInit(func(event *cef.BrowserEvent, window cef.IBrowserWindow) {
window.AsLCLBrowserWindow().BrowserWindow().SetOnConstrainedResize(func(sender lcl.IObject, minWidth, minHeight, maxWidth, maxHeight *int32) {
//Browser是在chromium加载完之后创建, 窗口创建时该对象还不存在
if window.AsLCLBrowserWindow().Browser() != nil {
fmt.Println("SetOnConstrainedResize Identifier", window.AsLCLBrowserWindow().Browser().Identifier())
fmt.Println("SetOnConstrainedResize MainFrame", window.AsLCLBrowserWindow().Browser().MainFrame())
}
})
})
//运行应用
cef.Run(cefApp)
}

View File

@ -142,7 +142,7 @@
</head>
<body style="margin: 0px;padding: 0px;">
<p>
<h3>process-message</h3></p>
<h3 style="-webkit-app-region: drag;">process-message</h3></p>
<p><a target="_blank" href="ipc-event.html">open</a></p>
<p>
<button onclick="ipcEmit()">ipcEmit</button>