B2G/gaia/apps/email/js/ext/mailapi/worker-bootstrap.js
// (info now definitely exists and is definitely in blockInfoList)
(info now definitely exists and is definitely in blockInfoList)
( info now definitely exists and is definitely in blockInfoList )
function processBlock(block) { 
      info.estSize += estSizeCost;
      info.count++;
      insertInBlock(thing, uid, info, block);
      if (info.count > 1 && info.estSize >= MAX_BLOCK_SIZE) {
        var firstBlockTarget;
        if (iInfo === 0)
          firstBlockTarget = BLOCK_SPLIT_SMALL_PART;
        else if (iInfo === blockInfoList.length - 1)
          firstBlockTarget = BLOCK_SPLIT_LARGE_PART;
        else
          firstBlockTarget = BLOCK_SPLIT_EQUAL_PART;
        var olderInfo;
        olderInfo = splitBlock(info, block, firstBlockTarget);
        blockInfoList.splice(iInfo + 1, 0, olderInfo);
        loadedBlockInfoList.push(olderInfo);
        if (BEFORE(date, olderInfo.endTS) ||
            ((date === olderInfo.endTS) && (uid <= olderInfo.endUID))) {
          iInfo++;
          info = olderInfo;
          block = blockMap[info.blockId];
        }
      }
      if (serverIdBlockMapping && srvid)
        serverIdBlockMapping[srvid] = info.blockId;
      if (blockPickedCallback) {
        blockPickedCallback(info, block);
      }
    }
function processBlock ( block ) { info . estSize += estSizeCost ; info . count ++ ; insertInBlock ( thing , uid , info , block ) ; if ( info . count > 1 && info . estSize >= MAX_BLOCK_SIZE ) { var firstBlockTarget ; if ( iInfo === 0 ) firstBlockTarget = BLOCK_SPLIT_SMALL_PART ; else if ( iInfo === blockInfoList . length - 1 ) firstBlockTarget = BLOCK_SPLIT_LARGE_PART ; else firstBlockTarget = BLOCK_SPLIT_EQUAL_PART ; var olderInfo ; olderInfo = splitBlock ( info , block , firstBlockTarget ) ; blockInfoList . splice ( iInfo + 1 , 0 , olderInfo ) ; loadedBlockInfoList . push ( olderInfo ) ; if ( BEFORE ( date , olderInfo . endTS ) || ( ( date === olderInfo . endTS ) && ( uid <= olderInfo . endUID ) ) ) { iInfo ++ ; info = olderInfo ; block = blockMap [ info . blockId ] ; } } if ( serverIdBlockMapping && srvid ) serverIdBlockMapping [ srvid ] = info . blockId ; if ( blockPickedCallback ) { blockPickedCallback ( info , block ) ; } }
(info now definitely exists and is definitely in blockInfoList)
( info now definitely exists and is definitely in blockInfoList )
// 'this' gets explicitly bound // -- perform the insertion // We could do this after the split, but this makes things simpler if // we want to factor in the newly inserted thing's size in the // distribution of bytes. // -- split if necessary // - figure the desired resulting sizes // big part to the center at the edges (favoring front edge) // otherwise equal split // - split // - figure which of the blocks our insertion went in // otherwise, no split necessary, just use it