mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 960894 - 2.a/4: move ril_worker init code out of RadioInterfaceLayer ctor. r=hsinyi
This commit is contained in:
parent
af1963d849
commit
963b9a5225
@ -1557,47 +1557,11 @@ DataConnectionHandler.prototype = {
|
||||
};
|
||||
|
||||
function RadioInterfaceLayer() {
|
||||
let options = {
|
||||
debug: debugPref,
|
||||
cellBroadcastDisabled: false,
|
||||
clirMode: RIL.CLIR_DEFAULT,
|
||||
quirks: {
|
||||
callstateExtraUint32:
|
||||
libcutils.property_get("ro.moz.ril.callstate_extra_int", "false") === "true",
|
||||
v5Legacy:
|
||||
libcutils.property_get("ro.moz.ril.v5_legacy", "true") === "true",
|
||||
requestUseDialEmergencyCall:
|
||||
libcutils.property_get("ro.moz.ril.dial_emergency_call", "false") === "true",
|
||||
simAppStateExtraFields:
|
||||
libcutils.property_get("ro.moz.ril.simstate_extra_field", "false") === "true",
|
||||
extraUint2ndCall:
|
||||
libcutils.property_get("ro.moz.ril.extra_int_2nd_call", "false") == "true",
|
||||
haveQueryIccLockRetryCount:
|
||||
libcutils.property_get("ro.moz.ril.query_icc_count", "false") == "true",
|
||||
sendStkProfileDownload:
|
||||
libcutils.property_get("ro.moz.ril.send_stk_profile_dl", "false") == "true",
|
||||
dataRegistrationOnDemand:
|
||||
libcutils.property_get("ro.moz.ril.data_reg_on_demand", "false") == "true"
|
||||
},
|
||||
rilEmergencyNumbers: libcutils.property_get("ril.ecclist") ||
|
||||
libcutils.property_get("ro.ril.ecclist")
|
||||
};
|
||||
|
||||
try {
|
||||
options.cellBroadcastDisabled =
|
||||
Services.prefs.getBoolPref(kPrefCellBroadcastDisabled);
|
||||
} catch(e) {}
|
||||
|
||||
try {
|
||||
options.clirMode = Services.prefs.getIntPref(kPrefClirModePreference);
|
||||
} catch(e) {}
|
||||
|
||||
let numIfaces = this.numRadioInterfaces;
|
||||
if (DEBUG) debug(numIfaces + " interfaces");
|
||||
this.radioInterfaces = [];
|
||||
for (let clientId = 0; clientId < numIfaces; clientId++) {
|
||||
options.clientId = clientId;
|
||||
this.radioInterfaces.push(new RadioInterface(options));
|
||||
this.radioInterfaces.push(new RadioInterface(clientId));
|
||||
}
|
||||
|
||||
Services.obs.addObserver(this, NS_XPCOM_SHUTDOWN_OBSERVER_ID, false);
|
||||
@ -1672,7 +1636,7 @@ XPCOMUtils.defineLazyGetter(RadioInterfaceLayer.prototype,
|
||||
return 1;
|
||||
});
|
||||
|
||||
function WorkerMessenger(radioInterface, options) {
|
||||
function WorkerMessenger(radioInterface) {
|
||||
// Initial owning attributes.
|
||||
this.radioInterface = radioInterface;
|
||||
this.tokenCallbackMap = {};
|
||||
@ -1680,14 +1644,9 @@ function WorkerMessenger(radioInterface, options) {
|
||||
// Add a convenient alias to |radioInterface.debug()|.
|
||||
this.debug = radioInterface.debug.bind(radioInterface);
|
||||
|
||||
if (DEBUG) this.debug("Starting RIL Worker[" + options.clientId + "]");
|
||||
this.worker = new ChromeWorker("resource://gre/modules/ril_worker.js");
|
||||
this.worker.onerror = this.onerror.bind(this);
|
||||
this.worker.onmessage = this.onmessage.bind(this);
|
||||
|
||||
this.send("setInitialOptions", options);
|
||||
|
||||
gSystemWorkerManager.registerRilWorker(options.clientId, this.worker);
|
||||
}
|
||||
WorkerMessenger.prototype = {
|
||||
radioInterface: null,
|
||||
@ -1699,6 +1658,49 @@ WorkerMessenger.prototype = {
|
||||
// Maps tokens we send out with messages to the message callback.
|
||||
tokenCallbackMap: null,
|
||||
|
||||
init: function() {
|
||||
let options = {
|
||||
debug: DEBUG,
|
||||
cellBroadcastDisabled: false,
|
||||
clirMode: RIL.CLIR_DEFAULT,
|
||||
quirks: {
|
||||
callstateExtraUint32:
|
||||
libcutils.property_get("ro.moz.ril.callstate_extra_int", "false") === "true",
|
||||
v5Legacy:
|
||||
libcutils.property_get("ro.moz.ril.v5_legacy", "true") === "true",
|
||||
requestUseDialEmergencyCall:
|
||||
libcutils.property_get("ro.moz.ril.dial_emergency_call", "false") === "true",
|
||||
simAppStateExtraFields:
|
||||
libcutils.property_get("ro.moz.ril.simstate_extra_field", "false") === "true",
|
||||
extraUint2ndCall:
|
||||
libcutils.property_get("ro.moz.ril.extra_int_2nd_call", "false") == "true",
|
||||
haveQueryIccLockRetryCount:
|
||||
libcutils.property_get("ro.moz.ril.query_icc_count", "false") == "true",
|
||||
sendStkProfileDownload:
|
||||
libcutils.property_get("ro.moz.ril.send_stk_profile_dl", "false") == "true",
|
||||
dataRegistrationOnDemand:
|
||||
libcutils.property_get("ro.moz.ril.data_reg_on_demand", "false") == "true"
|
||||
},
|
||||
rilEmergencyNumbers: libcutils.property_get("ril.ecclist") ||
|
||||
libcutils.property_get("ro.ril.ecclist")
|
||||
};
|
||||
|
||||
try {
|
||||
options.cellBroadcastDisabled =
|
||||
Services.prefs.getBoolPref(kPrefCellBroadcastDisabled);
|
||||
} catch(e) {}
|
||||
|
||||
try {
|
||||
options.clirMode = Services.prefs.getIntPref(kPrefClirModePreference);
|
||||
} catch(e) {}
|
||||
|
||||
if (DEBUG) this.debug("Starting RIL Worker");
|
||||
let clientId = this.radioInterface.clientId;
|
||||
options.clientId = clientId;
|
||||
this.send("setInitialOptions", options);
|
||||
gSystemWorkerManager.registerRilWorker(clientId, this.worker);
|
||||
},
|
||||
|
||||
onerror: function(event) {
|
||||
if (DEBUG) {
|
||||
this.debug("Got an error: " + event.filename + ":" +
|
||||
@ -1801,9 +1803,10 @@ WorkerMessenger.prototype = {
|
||||
}
|
||||
};
|
||||
|
||||
function RadioInterface(options) {
|
||||
this.clientId = options.clientId;
|
||||
this.workerMessenger = new WorkerMessenger(this, options);
|
||||
function RadioInterface(aClientId) {
|
||||
this.clientId = aClientId;
|
||||
this.workerMessenger = new WorkerMessenger(this);
|
||||
this.workerMessenger.init();
|
||||
|
||||
this.supportedNetworkTypes = this.getSupportedNetworkTypes();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user