add apps.getMemoryLimit
This commit is contained in:
15
src/apps.js
15
src/apps.js
@@ -63,6 +63,7 @@ exports = module.exports = {
|
||||
|
||||
getDataDir,
|
||||
getIconPath,
|
||||
getMemoryLimit,
|
||||
|
||||
downloadFile,
|
||||
uploadFile,
|
||||
@@ -445,6 +446,20 @@ function getIconPath(app, options, callback) {
|
||||
callback(new BoxError(BoxError.NOT_FOUND, 'No icon'));
|
||||
}
|
||||
|
||||
function getMemoryLimit(app) {
|
||||
assert.strictEqual(typeof app, 'object');
|
||||
|
||||
let memoryLimit = app.memoryLimit || app.manifest.memoryLimit || 0;
|
||||
|
||||
if (memoryLimit === -1) { // unrestricted
|
||||
memoryLimit = 0;
|
||||
} else if (memoryLimit === 0 || memoryLimit < constants.DEFAULT_MEMORY_LIMIT) { // ensure we never go below minimum (in case we change the default)
|
||||
memoryLimit = constants.DEFAULT_MEMORY_LIMIT;
|
||||
}
|
||||
|
||||
return memoryLimit;
|
||||
}
|
||||
|
||||
function postProcess(app, domainObjectMap) {
|
||||
let result = {};
|
||||
for (let portName in app.portBindings) {
|
||||
|
||||
Reference in New Issue
Block a user