Bug 847838 - Part 2: cache record size. r=vicamo
authorYoshi Huang <allstars.chh@mozilla.com>
Tue, 05 Mar 2013 14:24:37 +0800
changeset 124059 c8b219f93e32d712e0119bd5e329c4bdfabab4af
parent 124058 997c93376e857de03a2174b752cc3e1760c01b22
child 124060 cdb28e023b26f114dc4a498e572be0e2242e7507
push id24406
push userryanvm@gmail.com
push dateThu, 07 Mar 2013 17:19:02 +0000
treeherdermozilla-central@71395a927025 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersvicamo
bugs847838
milestone22.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 847838 - Part 2: cache record size. r=vicamo
dom/system/gonk/ril_worker.js
--- a/dom/system/gonk/ril_worker.js
+++ b/dom/system/gonk/ril_worker.js
@@ -10266,60 +10266,73 @@ let ICCRecordHelper = {
     }
 
     ICCIOHelper.loadLinearFixedEF({fileId : ICC_EF_PBR,
                                    callback: callback.bind(this),
                                    onerror: onerror});
   },
 
   /**
+   * Cache EF_IAP record size.
+   */
+  _iapRecordSize: null,
+
+  /**
    * Read ICC EF_IAP. (Index Administration Phonebook)
    *
    * @see TS 131.102, clause 4.4.2.2
    *
    * @param fileId       EF id of the IAP.
    * @param recordNumber The number of the record shall be loaded.
    * @param onsuccess    Callback to be called when success.
    * @param onerror      Callback to be called when error.
    */
   readIAP: function readIAP(fileId, recordNumber, onsuccess, onerror) {
     function callback(options) {
       let strLen = Buf.readUint32();
       let octetLen = strLen / 2;
+      this._iapRecordSize = options.recordSize;
 
       let iap = GsmPDUHelper.readHexOctetArray(octetLen);
       Buf.readStringDelimiter(strLen);
 
       if (onsuccess) {
         onsuccess(iap);
       }
     }
 
     ICCIOHelper.loadLinearFixedEF({fileId: fileId,
                                    recordNumber: recordNumber,
+                                   recordSize: this._iapRecordSize,
                                    callback: callback.bind(this),
                                    onerror: onerror});
   },
 
   /**
+   * Cache EF_Email record size.
+   */
+  _emailRecordSize: null,
+
+  /**
    * Read USIM Phonebook EF_EMAIL.
    *
    * @see TS 131.102, clause 4.4.2.13
    *
    * @param fileId       EF id of the EMAIL.
    * @param fileType     The type of the EMAIL, one of the ICC_USIM_TYPE* constants.
    * @param recordNumber The number of the record shall be loaded.
    * @param onsuccess    Callback to be called when success.
    * @param onerror      Callback to be called when error.
    */
   readEmail: function readEmail(fileId, fileType, recordNumber, onsuccess, onerror) {
     function callback(options) {
       let strLen = Buf.readUint32();
       let octetLen = strLen / 2;
       let email = null;
+      this._emailRecordSize = options.recordSize;
 
       // Read contact's email
       //
       // | Byte     | Description                 | Length | M/O
       // | 1 ~ X    | E-mail Address              |   X    |  M
       // | X+1      | ADN file SFI                |   1    |  C
       // | X+2      | ADN file Record Identifier  |   1    |  C
       // Note: The fields marked as C above are mandatort if the file
@@ -10337,36 +10350,43 @@ let ICCRecordHelper = {
 
       if (onsuccess) {
         onsuccess(email);
       }
     }
 
     ICCIOHelper.loadLinearFixedEF({fileId: fileId,
                                    recordNumber: recordNumber,
+                                   recordSize: this._emailRecordSize,
                                    callback: callback.bind(this),
                                    onerror: onerror});
   },
 
   /**
+   * Cache EF_ANR record size.
+   */
+  _anrRecordSize: null,
+
+  /**
    * Read USIM Phonebook EF_ANR.
    *
    * @see TS 131.102, clause 4.4.2.9
    *
    * @param fileId       EF id of the ANR.
    * @param fileType     One of the ICC_USIM_TYPE* constants.
    * @param recordNumber The number of the record shall be loaded.
    * @param onsuccess    Callback to be called when success.
    * @param onerror      Callback to be called when error.
    */
   readANR: function readANR(fileId, fileType, recordNumber, onsuccess, onerror) {
     function callback(options) {
       let strLen = Buf.readUint32();
       let octetLen = strLen / 2;
       let number = null;
+      this._anrRecordSize = options.recordSize;
 
       // Skip ANR Record ID.
       Buf.seekIncoming(1 * PDU_HEX_OCTET_SIZE);
 
       let numLen = GsmPDUHelper.readHexOctet();
       if (numLen != 0xff) {
         if (numLen > ADN_MAX_BCD_NUMBER_BYTES) {
           throw new Error("invalid length of BCD number/SSC contents - " + numLen);
@@ -10389,16 +10409,17 @@ let ICCRecordHelper = {
 
       if (onsuccess) {
         onsuccess(number);
       }
     }
 
     ICCIOHelper.loadLinearFixedEF({fileId: fileId,
                                    recordNumber: recordNumber,
+                                   recordSize: this._anrRecordSize,
                                    callback: callback.bind(this),
                                    onerror: onerror});
   },
 
   /**
    * Read the PLMNsel (Public Land Mobile Network) from the ICC.
    *
    * See ETSI TS 100.977 section 10.3.4 EF_PLMNsel