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 #10025 from brave/issue-10024
Browse files Browse the repository at this point in the history
use shared mem ipc to transfer history and bookmarks to about pages
  • Loading branch information
bbondy authored Jul 17, 2017
2 parents a00d614 + f94d8ed commit 5e37a1d
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 5e37a1d

Please sign in to comment.