Sampling Profiler to return urls that open file in nuclide
Reviewed By: cwdick Differential Revision: D4422768 fbshipit-source-id: 2e8c4af6e6fae4256fe886b79f5ea6c87986d581
This commit is contained in:
parent
2e8683b150
commit
bbd5750bb4
|
@ -43,6 +43,37 @@ class TreeTransformator {
|
|||
};
|
||||
}
|
||||
|
||||
// private
|
||||
getFileUrl(source, lineNumber) {
|
||||
if (!source) {
|
||||
return '';
|
||||
}
|
||||
|
||||
const url = urlLib.parse(
|
||||
'https://our.intern.facebook.com/intern/nuclide/open/arc/',
|
||||
true);
|
||||
let project = '';
|
||||
let root = '';
|
||||
|
||||
if (source.includes('fbsource/fbandroid/')) {
|
||||
project = 'facebook-fbandroid';
|
||||
root = 'fbsource/fbandroid/';
|
||||
} else if (source.includes('fbsource/fbobjc/')) {
|
||||
project = 'fbobjc';
|
||||
root = 'fbsource/fbobjc/';
|
||||
} else {
|
||||
return 'file://' + source;
|
||||
}
|
||||
|
||||
url.query = {
|
||||
'project' : project,
|
||||
'paths[0]' : source.substring(source.indexOf(root) + root.length),
|
||||
'lines[0]' : [lineNumber],
|
||||
};
|
||||
|
||||
return urlLib.format(url);
|
||||
}
|
||||
|
||||
// private
|
||||
transformNode(tree) {
|
||||
if (tree.url in this.urlResults) {
|
||||
|
@ -58,7 +89,7 @@ class TreeTransformator {
|
|||
tree.functionName = tree.functionName || functionName;
|
||||
}
|
||||
tree.scriptId = tree.id;
|
||||
tree.url = 'file://' + original.source;
|
||||
tree.url = this.getFileUrl(original.source, original.line);
|
||||
tree.lineNumber = original.line;
|
||||
tree.columnNumber = original.column;
|
||||
} else if (tree.deoptReason === 'outside_vm') {
|
||||
|
|
Loading…
Reference in New Issue