Bug 917163 - [MMS] MMS Data call is not released immediately. r=vyang

This commit is contained in:
Chia-hung Tai 2013-09-18 11:04:16 +08:00
Родитель a567947cc2
Коммит e88bb95a64
2 изменённых файлов: 12 добавлений и 2 удалений

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

@ -389,6 +389,9 @@ pref("dom.sms.strict7BitEncoding", false); // Disabled by default.
pref("dom.sms.requestStatusReport", true); // Enabled by default. pref("dom.sms.requestStatusReport", true); // Enabled by default.
pref("dom.mms.requestStatusReport", true); // Enabled by default. pref("dom.mms.requestStatusReport", true); // Enabled by default.
//The waiting time in network manager.
pref("network.gonk.ms-release-mms-connection", 30000);
// WebContacts // WebContacts
pref("dom.mozContacts.enabled", true); pref("dom.mozContacts.enabled", true);
pref("dom.navigator-property.disable.mozContacts", false); pref("dom.navigator-property.disable.mozContacts", false);

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

@ -60,7 +60,8 @@ const CONFIG_SEND_REPORT_DEFAULT_YES = 2;
const CONFIG_SEND_REPORT_ALWAYS = 3; const CONFIG_SEND_REPORT_ALWAYS = 3;
const TIME_TO_BUFFER_MMS_REQUESTS = 30000; const TIME_TO_BUFFER_MMS_REQUESTS = 30000;
const TIME_TO_RELEASE_MMS_CONNECTION = 30000; const PREF_TIME_TO_RELEASE_MMS_CONNECTION =
Services.prefs.getIntPref("network.gonk.ms-release-mms-connection");
const PREF_RETRIEVAL_MODE = 'dom.mms.retrieval_mode'; const PREF_RETRIEVAL_MODE = 'dom.mms.retrieval_mode';
const RETRIEVAL_MODE_MANUAL = "manual"; const RETRIEVAL_MODE_MANUAL = "manual";
@ -293,11 +294,17 @@ XPCOMUtils.defineLazyGetter(this, "gMmsConnection", function () {
if (this.refCount <= 0) { if (this.refCount <= 0) {
this.refCount = 0; this.refCount = 0;
// The waiting is too small, just skip the timer creation.
if (PREF_TIME_TO_RELEASE_MMS_CONNECTION < 1000) {
this.onDisconnectTimerTimeout();
return;
}
// Set a timer to delay the release of MMS network connection, // Set a timer to delay the release of MMS network connection,
// since the MMS requests often come consecutively in a short time. // since the MMS requests often come consecutively in a short time.
this.disconnectTimer. this.disconnectTimer.
initWithCallback(this.onDisconnectTimerTimeout.bind(this), initWithCallback(this.onDisconnectTimerTimeout.bind(this),
TIME_TO_RELEASE_MMS_CONNECTION, PREF_TIME_TO_RELEASE_MMS_CONNECTION,
Ci.nsITimer.TYPE_ONE_SHOT); Ci.nsITimer.TYPE_ONE_SHOT);
} }
}, },