mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-13 03:28:33 -05:00
Merge VS Code 1.21 source code (#1067)
* Initial VS Code 1.21 file copy with patches * A few more merges * Post npm install * Fix batch of build breaks * Fix more build breaks * Fix more build errors * Fix more build breaks * Runtime fixes 1 * Get connection dialog working with some todos * Fix a few packaging issues * Copy several node_modules to package build to fix loader issues * Fix breaks from master * A few more fixes * Make tests pass * First pass of license header updates * Second pass of license header updates * Fix restore dialog issues * Remove add additional themes menu items * fix select box issues where the list doesn't show up * formatting * Fix editor dispose issue * Copy over node modules to correct location on all platforms
This commit is contained in:
@@ -11,7 +11,6 @@
|
||||
// Because we want both instances to use the same perf-data
|
||||
// we store them globally
|
||||
// stores data as 'type','name','startTime','duration'
|
||||
global._performanceEntries = global._performanceEntries || [];
|
||||
|
||||
if (typeof define !== "function" && typeof module === "object" && typeof module.exports === "object") {
|
||||
// this is commonjs, fake amd
|
||||
@@ -23,6 +22,12 @@ if (typeof define !== "function" && typeof module === "object" && typeof module.
|
||||
|
||||
define([], function () {
|
||||
|
||||
var _global = this;
|
||||
if (typeof global !== 'undefined') {
|
||||
_global = global;
|
||||
}
|
||||
_global._performanceEntries = _global._performanceEntries || [];
|
||||
|
||||
// const _now = global.performance && performance.now ? performance.now : Date.now
|
||||
const _now = Date.now;
|
||||
|
||||
@@ -31,14 +36,14 @@ define([], function () {
|
||||
}
|
||||
|
||||
function exportEntries() {
|
||||
return global._performanceEntries.splice(0);
|
||||
return global._performanceEntries.slice(0);
|
||||
}
|
||||
|
||||
function getEntries(type) {
|
||||
function getEntries(type, name) {
|
||||
const result = [];
|
||||
const entries = global._performanceEntries;
|
||||
for (let i = 0; i < entries.length; i += 4) {
|
||||
if (entries[i] === type) {
|
||||
if (entries[i] === type && (name === void 0 || entries[i + 1] === name)) {
|
||||
result.push({
|
||||
type: entries[i],
|
||||
name: entries[i + 1],
|
||||
@@ -53,6 +58,39 @@ define([], function () {
|
||||
});
|
||||
}
|
||||
|
||||
function getEntry(type, name) {
|
||||
const entries = global._performanceEntries;
|
||||
for (let i = 0; i < entries.length; i += 4) {
|
||||
if (entries[i] === type && entries[i + 1] === name) {
|
||||
return {
|
||||
type: entries[i],
|
||||
name: entries[i + 1],
|
||||
startTime: entries[i + 2],
|
||||
duration: entries[i + 3],
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function getDuration(from, to) {
|
||||
const entries = global._performanceEntries;
|
||||
let name = from;
|
||||
let startTime = 0;
|
||||
for (let i = 0; i < entries.length; i += 4) {
|
||||
if (entries[i + 1] === name) {
|
||||
if (name === from) {
|
||||
// found `from` (start of interval)
|
||||
name = to;
|
||||
startTime = entries[i + 2];
|
||||
} else {
|
||||
// from `to` (end of interval)
|
||||
return entries[i + 2] - startTime;
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
function mark(name) {
|
||||
global._performanceEntries.push('mark', name, _now(), 0);
|
||||
if (typeof console.timeStamp === 'function') {
|
||||
@@ -103,6 +141,8 @@ define([], function () {
|
||||
measure: measure,
|
||||
time: time,
|
||||
getEntries: getEntries,
|
||||
getEntry: getEntry,
|
||||
getDuration: getDuration,
|
||||
importEntries: importEntries,
|
||||
exportEntries: exportEntries
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user