Save BlobStore only in the first window

This commit is contained in:
Antonio Scandurra
2015-11-02 10:46:11 +01:00
parent 887864a98b
commit a8b5bb243f
3 changed files with 9 additions and 2 deletions

View File

@@ -212,6 +212,7 @@ class AtomApplication
@openPathOnEvent('application:open-license', path.join(process.resourcesPath, 'LICENSE.md'))
app.on 'before-quit', =>
@saveBlobStore()
@saveState(false)
@quitting = true
@@ -433,6 +434,9 @@ class AtomApplication
console.log("Killing process #{pid} failed: #{error.code ? error.message}")
delete @pidsToOpenWindows[pid]
saveBlobStore: ->
@windows[0]?.saveBlobStore()
saveState: (allowEmpty=false) ->
return if @quitting
states = []

View File

@@ -75,6 +75,9 @@ class AtomWindow
hasPathToOpen = not (locationsToOpen.length is 1 and not locationsToOpen[0].pathToOpen?)
@openLocations(locationsToOpen) if hasPathToOpen and not @isSpecWindow()
saveBlobStore: ->
@browserWindow.webContents?.send('save-blob-store')
setLoadSettings: (loadSettingsObj) ->
# Ignore the windowState when passing loadSettings via URL, since it could
# be quite large.

View File

@@ -1,15 +1,15 @@
(function () {
var app = require('remote').require('app')
var fs = require('fs-plus')
var path = require('path')
var FileSystemBlobStore = require('../src/file-system-blob-store')
var NativeCompileCache = require('../src/native-compile-cache')
var ipc = require('ipc')
var loadSettings = null
var loadSettingsError = null
var blobStore = null
app.on('before-quit', function () {
ipc.on('save-blob-store', function () {
if (blobStore) {
blobStore.save()
}