Skip to content
This repository has been archived by the owner on Dec 11, 2019. It is now read-only.

Commit

Permalink
Merge pull request #10266 from brave/0.18.x-shared-mem
Browse files Browse the repository at this point in the history
Merge shared mem to 0.18.x
  • Loading branch information
bsclifton committed Aug 4, 2017
2 parents 5641179 + 74a5a30 commit f08acea
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
8 changes: 5 additions & 3 deletions js/entry.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,12 @@ window.addEventListener('beforeunload', function (e) {
ipc.send(messages.LAST_WINDOW_STATE, windowStore.getState().toJS())
})

ipc.on(messages.INITIALIZE_WINDOW, (e, windowValue, appState, frames, initWindowState) => {
ipc.on(messages.INITIALIZE_WINDOW, (e, mem) => {
const message = mem.memory()
const windowValue = message.windowValue
currentWindow.setWindowId(windowValue.id)
appStoreRenderer.state = Immutable.fromJS(appState)
appStoreRenderer.state = Immutable.fromJS(message.appState)
ReactDOM.render(
<Window frames={frames} initWindowState={initWindowState} />,
<Window frames={message.frames} initWindowState={message.windowState} />,
document.getElementById('appContainer'))
})
11 changes: 7 additions & 4 deletions js/stores/appStore.js
Original file line number Diff line number Diff line change
Expand Up @@ -238,14 +238,17 @@ const createWindow = (action) => {
mainWindow.webContents.on('did-finish-load', (e) => {
lastEmittedState = appState
mainWindow.webContents.setZoomLevel(zoomLevel[toolbarUserInterfaceScale] || 0.0)
e.sender.send(messages.INITIALIZE_WINDOW,
{

const mem = muon.shared_memory.create({
windowValue: {
disposition: frameOpts.disposition,
id: mainWindow.id
},
appState.toJS(),
appState: appState.toJS(),
frames,
action.restoredState)
windowState: action.restoredState})

e.sender.sendShared(messages.INITIALIZE_WINDOW, mem)
if (action.cb) {
action.cb()
}
Expand Down

0 comments on commit f08acea

Please sign in to comment.