upgrade-dev v2.2.7

This commit is contained in:
杨红岩 2023-03-13 17:43:22 +08:00
parent 1d1f42519a
commit 549d754b6d
2 changed files with 26 additions and 14 deletions

View File

@ -59,9 +59,11 @@ func Run(app *TCEFApplication) {
logger.Debug("application process [", common.Args.ProcessType(), "] run end")
api.EnergyLibRelease()
}()
//ipc初始化
ipcInit()
//MacOSX 多进程时需要调用StartSubProcess来启动子进程
if common.IsDarwin() && !consts.SingleProcess && !common.Args.IsMain() {
// mac os 启动子进程
// 启动子进程
app.StartSubProcess()
app.Free()
} else {
@ -70,25 +72,26 @@ func Run(app *TCEFApplication) {
mtml := app.MultiThreadedMessageLoop()
consts.IsMessageLoop = !emp && !mtml
if consts.IsMessageLoop {
//启用VF窗口组件
// 启用VF窗口组件
BrowserWindow.appContextInitialized(app)
}
//启动主进程
// 启动主进程
success := app.StartMainProcess()
//主进程启动成功之后回调
// 主进程启动成功之后回调
if browserProcessStartAfterCallback != nil {
browserProcessStartAfterCallback(success)
}
if success {
appMainRunCallback()
if consts.IsMessageLoop {
//VF窗口消息轮询
// VF窗口消息轮询
app.RunMessageLoop()
} else {
//LCL窗口组件
// 创建LCL窗口组件
if BrowserWindow.mainBrowserWindow == nil {
BrowserWindow.mainBrowserWindow = &lclBrowserWindow{}
}
// 运行主窗口
lcl.RunApp(&BrowserWindow.mainBrowserWindow)
}
}

View File

@ -55,14 +55,23 @@ type ipcCallback struct {
function *ICefV8Value
}
func init() {
if common.Args.IsMain() {
} else if common.Args.IsRender() {
}
ipcBrowser = &ipcBrowserProcess{}
ipcRender = &ipcRenderProcess{
ipcEmit: &ipcEmitHandler{callbackList: make(map[int32]*ipcCallback, 256)},
ipcOn: &ipcOnHandler{callbackList: make(map[string]*ipcCallback)},
// ipcInit 初始化
func ipcInit() {
if application.SingleProcess() {
ipcBrowser = &ipcBrowserProcess{}
ipcRender = &ipcRenderProcess{
ipcEmit: &ipcEmitHandler{callbackList: make(map[int32]*ipcCallback)},
ipcOn: &ipcOnHandler{callbackList: make(map[string]*ipcCallback)},
}
} else {
if common.Args.IsMain() {
ipcBrowser = &ipcBrowserProcess{}
} else if common.Args.IsRender() {
ipcRender = &ipcRenderProcess{
ipcEmit: &ipcEmitHandler{callbackList: make(map[int32]*ipcCallback)},
ipcOn: &ipcOnHandler{callbackList: make(map[string]*ipcCallback)},
}
}
}
}