Merge VS Code 1.31.1 (#4283)

This commit is contained in:
Matt Irvine
2019-03-15 13:09:45 -07:00
committed by GitHub
parent 7d31575149
commit 86bac90001
1716 changed files with 53308 additions and 48375 deletions

View File

@@ -10,11 +10,11 @@
// This module can be loaded in an amd and commonjs-context.
// Because we want both instances to use the same perf-data
// we store them globally
// stores data as 'type','name','startTime','duration'
// stores data as: 'name','timestamp'
if (typeof define !== "function" && typeof module === "object" && typeof module.exports === "object") {
// this is commonjs, fake amd
global.define = function (dep, callback) {
global.define = function (_dep, callback) {
module.exports = callback();
global.define = undefined;
};
@@ -22,14 +22,10 @@ if (typeof define !== "function" && typeof module === "object" && typeof module.
define([], function () {
var _global = this;
if (typeof global !== 'undefined') {
_global = global;
}
_global._performanceEntries = _global._performanceEntries || [];
global._performanceEntries = global._performanceEntries || [];
// const _now = global.performance && performance.now ? performance.now : Date.now
const _now = Date.now;
const _dataLen = 2;
const _timeStamp = typeof console.timeStamp === 'function' ? console.timeStamp.bind(console) : () => { };
function importEntries(entries) {
global._performanceEntries.splice(0, 0, ...entries);
@@ -39,36 +35,25 @@ define([], function () {
return global._performanceEntries.slice(0);
}
function getEntries(type, name) {
function getEntries() {
const result = [];
const entries = global._performanceEntries;
for (let i = 0; i < entries.length; i += 5) {
if (entries[i] === type && (name === void 0 || entries[i + 1] === name)) {
result.push({
type: entries[i],
name: entries[i + 1],
startTime: entries[i + 2],
duration: entries[i + 3],
seq: entries[i + 4],
});
}
for (let i = 0; i < entries.length; i += _dataLen) {
result.push({
name: entries[i],
timestamp: entries[i + 1],
});
}
return result.sort((a, b) => {
return a.startTime - b.startTime || a.seq - b.seq;
});
return result;
}
function getEntry(type, name) {
function getEntry(name) {
const entries = global._performanceEntries;
for (let i = 0; i < entries.length; i += 5) {
if (entries[i] === type && entries[i + 1] === name) {
for (let i = 0; i < entries.length; i += _dataLen) {
if (entries[i] === name) {
return {
type: entries[i],
name: entries[i + 1],
startTime: entries[i + 2],
duration: entries[i + 3],
seq: entries[i + 4],
name: entries[i],
timestamp: entries[i + 1],
};
}
}
@@ -77,65 +62,29 @@ define([], function () {
function getDuration(from, to) {
const entries = global._performanceEntries;
let target = to;
let endTime = 0;
for (let i = entries.length - 1; i >= 0; i -= 5) {
if (entries[i - 3] === target) {
let endIndex = 0;
for (let i = entries.length - _dataLen; i >= 0; i -= _dataLen) {
if (entries[i] === target) {
if (target === to) {
// found `to` (end of interval)
endTime = entries[i - 2];
endIndex = i;
target = from;
} else {
return endTime - entries[i - 2];
// found `from` (start of interval)
return entries[endIndex + 1] - entries[i + 1];
}
}
}
return 0;
}
let seq = 0;
function mark(name) {
global._performanceEntries.push('mark', name, _now(), 0, seq++);
if (typeof console.timeStamp === 'function') {
console.timeStamp(name);
}
}
function measure(name, from, to) {
let startTime;
let duration;
let now = _now();
if (!from) {
startTime = now;
} else {
startTime = _getLastStartTime(from);
}
if (!to) {
duration = now - startTime;
} else {
duration = _getLastStartTime(to) - startTime;
}
global._performanceEntries.push('measure', name, startTime, duration);
}
function _getLastStartTime(name) {
const entries = global._performanceEntries;
for (let i = entries.length - 1; i >= 0; i -= 5) {
if (entries[i - 3] === name) {
return entries[i - 2];
}
}
throw new Error(name + ' not found');
global._performanceEntries.push(name, Date.now());
_timeStamp(name);
}
var exports = {
mark: mark,
measure: measure,
getEntries: getEntries,
getEntry: getEntry,
getDuration: getDuration,