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

Commit

Permalink
use shared mem ipc to transfer history and bookmarks to about pages
Browse files Browse the repository at this point in the history
fix #10024
  • Loading branch information
bridiver committed Jul 17, 2017
1 parent a00d614 commit f94d8ed
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
6 changes: 4 additions & 2 deletions app/browser/tabs.js
Original file line number Diff line number Diff line change
Expand Up @@ -199,13 +199,15 @@ const updateAboutDetails = (tab, tabValue) => {
} else if (location === 'about:bookmarks') {
const bookmarksData = getBookmarksData(appState)
if (bookmarksData.bookmarks) {
tab.send(messages.BOOKMARKS_UPDATED, bookmarksData)
const handle = muon.shared_memory.create(bookmarksData)
tab.sendShared(messages.BOOKMARKS_UPDATED, handle)
}
} else if (location === 'about:history') {
if (!history) {
appActions.populateHistory()
} else {
tab.send(messages.HISTORY_UPDATED, history.toJS())
const handle = muon.shared_memory.create(history.toJS())
tab.sendShared(messages.HISTORY_UPDATED, handle)
}
tab.send(messages.SETTINGS_UPDATED, appSettings.toJS())
} else if (location === 'about:extensions' && extensions) {
Expand Down
3 changes: 2 additions & 1 deletion js/about/bookmarks.js
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,8 @@ class AboutBookmarks extends React.Component {
selectedFolderId: 0,
search: ''
}
ipc.on(messages.BOOKMARKS_UPDATED, (e, detail) => {
ipc.on(messages.BOOKMARKS_UPDATED, (e, handle) => {
const detail = handle.memory()
this.setState({
bookmarks: Immutable.fromJS((detail && detail.bookmarks) || {}),
bookmarkFolders: Immutable.fromJS((detail && detail.bookmarkFolders) || {})
Expand Down
3 changes: 2 additions & 1 deletion js/about/history.js
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,8 @@ class AboutHistory extends React.Component {
selection: Immutable.Set(),
updatedStamp: undefined
}
ipc.on(messages.HISTORY_UPDATED, (e, detail) => {
ipc.on(messages.HISTORY_UPDATED, (e, handle) => {
const detail = handle.memory()
const aboutHistory = Immutable.fromJS(detail || {})
const updatedStamp = aboutHistory.get('updatedStamp')
// Only update if the data has changed.
Expand Down

0 comments on commit f94d8ed

Please sign in to comment.