mirror of
https://gitee.com/energye/energy.git
synced 2024-11-30 02:37:46 +08:00
upgrade-dev v2.3.15
This commit is contained in:
parent
c08a312623
commit
7f56f8a2fb
@ -109,7 +109,7 @@ func (m *browserChannel) Close() {
|
||||
}
|
||||
}
|
||||
|
||||
func (m *browserChannel) onConnect(context IPCContext) {
|
||||
func (m *browserChannel) onConnect(context IIPCContext) {
|
||||
logger.Info("IPC browser on connect channelId:", context.ChannelId())
|
||||
if chn := m.Channel(context.ChannelId()); chn != nil {
|
||||
chn.IPCType = m.ipcType
|
||||
@ -200,6 +200,7 @@ func (m *browserChannel) ipcReadHandler(conn net.Conn) {
|
||||
if context.Message().Type() == mt_connection {
|
||||
message := json.NewJSONObject(context.Message().Data())
|
||||
id = int64(message.GetIntByKey(channelId))
|
||||
m.onConnect(context)
|
||||
} else {
|
||||
if m.handler != nil {
|
||||
m.handler(context)
|
||||
|
@ -20,7 +20,6 @@ import (
|
||||
)
|
||||
|
||||
type renderChannel struct {
|
||||
browserId int32
|
||||
channelId int64
|
||||
ipcType IPC_TYPE
|
||||
connect net.Conn
|
||||
@ -29,7 +28,7 @@ type renderChannel struct {
|
||||
handler IPCCallback
|
||||
}
|
||||
|
||||
func (m *ipcChannel) NewRenderChannel(browserId int32, channelId int64, memoryAddresses ...string) *renderChannel {
|
||||
func (m *ipcChannel) NewRenderChannel(channelId int64, memoryAddresses ...string) *renderChannel {
|
||||
if useNetIPCChannel {
|
||||
address := fmt.Sprintf("localhost:%d", IPC.Port())
|
||||
conn, err := net.Dial("tcp", address)
|
||||
@ -55,7 +54,6 @@ func (m *ipcChannel) NewRenderChannel(browserId int32, channelId int64, memoryAd
|
||||
m.render.ipcType = IPCT_UNIX
|
||||
m.render.connect = unixConn
|
||||
}
|
||||
m.render.browserId = browserId
|
||||
m.render.channelId = channelId
|
||||
go m.render.receive()
|
||||
m.render.onConnection()
|
||||
|
@ -126,7 +126,6 @@ type messageCallback func(context IMessage)
|
||||
type IIPCContext interface {
|
||||
Connect() net.Conn //IPC 链接
|
||||
ChannelId() int64 //render channel channelId
|
||||
BrowserId() int32 //render channel browserId
|
||||
Message() IMessage //
|
||||
Free() //
|
||||
}
|
||||
@ -154,8 +153,7 @@ type ipcMessage struct {
|
||||
|
||||
// IPC 上下文
|
||||
type IPCContext struct {
|
||||
browserId int32 //render channel browserId
|
||||
frameId int64 //render channel frameId
|
||||
channelId int64 //render channelId
|
||||
ipcType IPC_TYPE //
|
||||
connect net.Conn //
|
||||
message IMessage //
|
||||
@ -185,11 +183,7 @@ func (m *IPCContext) Free() {
|
||||
}
|
||||
|
||||
func (m *IPCContext) ChannelId() int64 {
|
||||
return m.frameId
|
||||
}
|
||||
|
||||
func (m *IPCContext) BrowserId() int32 {
|
||||
return m.browserId
|
||||
return m.channelId
|
||||
}
|
||||
|
||||
func (m *IPCContext) Message() IMessage {
|
||||
|
Loading…
Reference in New Issue
Block a user