Merge pull request #1201 from marco-c/dont_wait_fs_jarstore_to_start_vm

Start the VM before the MIDlet JAR and the filesystem are loaded
This commit is contained in:
Myk Melez 2015-03-08 14:19:13 -07:00
Родитель 97c641cb04 6bc0429d64
Коммит 4166a55a98
3 изменённых файлов: 10 добавлений и 4 удалений

Просмотреть файл

@ -24,6 +24,7 @@ module J2ME {
* at the right spots.
*/
export var yieldMap = {
"com/sun/midp/main/MIDletSuiteUtils.vmBeginStartUp.(I)V": YieldReason.Root,
"com/sun/midp/lcdui/DisplayDevice.gainedForeground0.(II)V": YieldReason.Root,
"com/sun/cdc/io/j2me/file/DefaultFileHandler.openForRead.()V": YieldReason.Root,
"com/sun/cdc/io/j2me/file/DefaultFileHandler.openForWrite.()V": YieldReason.Root,

10
main.js
Просмотреть файл

@ -33,7 +33,9 @@ var getMobileInfo = new Promise(function(resolve, reject) {
});
});
var loadingPromises = [initFS, getMobileInfo];
var loadingMIDletPromises = [initFS, getMobileInfo];
var loadingPromises = [];
loadingPromises.push(load("java/classes.jar", "arraybuffer").then(function(data) {
JARStore.addBuiltIn("java/classes.jar", data);
@ -41,7 +43,7 @@ loadingPromises.push(load("java/classes.jar", "arraybuffer").then(function(data)
}));
jars.forEach(function(jar) {
loadingPromises.push(load(jar, "arraybuffer").then(function(data) {
loadingMIDletPromises.push(load(jar, "arraybuffer").then(function(data) {
JARStore.addBuiltIn(jar, data);
}));
});
@ -67,7 +69,7 @@ function processJAD(data) {
}
if (config.jad) {
loadingPromises.push(load(config.jad, "text").then(processJAD).then(backgroundCheck));
loadingMIDletPromises.push(load(config.jad, "text").then(processJAD).then(backgroundCheck));
}
function performDownload(url, dialog, callback) {
@ -118,7 +120,7 @@ function performDownload(url, dialog, callback) {
}
if (config.downloadJAD) {
loadingPromises.push(new Promise(function(resolve, reject) {
loadingMIDletPromises.push(new Promise(function(resolve, reject) {
JARStore.loadJAR("midlet.jar").then(function(loaded) {
if (loaded) {
processJAD(JARStore.getJAD());

Просмотреть файл

@ -425,6 +425,7 @@ var MIDP = (function() {
return AMSIsolateId == $.ctx.runtime.isolate.id ? 1 : 0;
};
// This function is called before a MIDlet is created (in MIDletStateListener::midletPreStart).
Native["com/sun/midp/main/MIDletSuiteUtils.vmBeginStartUp.(I)V"] = function(midletIsolateId) {
// See DisplayContainer::createDisplayId, called by the LCDUIEnvironment constructor,
// called by CldcMIDletSuiteLoader::createSuiteEnvironment.
@ -432,6 +433,8 @@ var MIDP = (function() {
// the same isolate that calls vmBeginStartUp. So this is a good place to calculate
// the display ID.
displayId = ((midletIsolateId & 0xff)<<24) | (1 & 0x00ffffff);
asyncImpl("V", Promise.all(loadingMIDletPromises));
};
Native["com/sun/midp/main/MIDletSuiteUtils.vmEndStartUp.(I)V"] = function(midletIsolateId) {