function sequentiallyRun(functionItems, opt_onStart) {
  var onStart = opt_onStart || null;

  return new Promise(function(resolve, reject) {
    var results = new Array(functionItems.length);
    var i = 0;

    var runner = function() {
      var functionItem = functionItems[i];
      if (onStart != null) {
        onStart(functionItem);
      }
      functionItem.fn().then(function(result) {
        results[i] = result;
        if (i < functionItems.length - 1) {
          i++;
          runner();
        } else {
          resolve(results);
        }
      }, reject);
    };
    runner();
  });
}
@param {!Array<!FunctionItem_>} functionItems
@param {!function(!FunctionItem_):void=} opt_onStart A function to call right
    before starting executing the next function.
@return {!IThenable}