Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1333)

Unified Diff: chrome/tools/test/reference_build/chrome_linux/resources/inspector/profile_view.js

Issue 177049: On Linux, move the passing of filedescriptors to a dedicated socketpair(). (Closed)
Patch Set: Removed *.d files from reference build Created 11 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/tools/test/reference_build/chrome_linux/resources/inspector/profile_view.js
diff --git a/chrome/tools/test/reference_build/chrome_linux/resources/inspector/profile_view.js b/chrome/tools/test/reference_build/chrome_linux/resources/inspector/profile_view.js
index 9d196a37af4c3733b0a1c27c1ecef763d8f001c6..bdea6319db7a2f20f90b1671790e98085bbc0138 100644
--- a/chrome/tools/test/reference_build/chrome_linux/resources/inspector/profile_view.js
+++ b/chrome/tools/test/reference_build/chrome_linux/resources/inspector/profile_view.js
@@ -53,6 +53,7 @@ devtools.profiler.ViewBuilder.prototype.buildView = function(
callTree, opt_bottomUpViewWeights) {
var head;
var samplingRate = this.samplingRate;
+ var createViewNode = this.createViewNode;
callTree.traverse(function(node, viewParent) {
var totalWeight = node.totalWeight * samplingRate;
var selfWeight = node.selfWeight * samplingRate;
@@ -63,8 +64,7 @@ devtools.profiler.ViewBuilder.prototype.buildView = function(
selfWeight = 0;
}
}
- var viewNode = new devtools.profiler.ProfileView.Node(
- node.label, totalWeight, selfWeight, head);
+ var viewNode = createViewNode(node.label, totalWeight, selfWeight, head);
if (viewParent) {
viewParent.addChild(viewNode);
} else {
@@ -72,26 +72,50 @@ devtools.profiler.ViewBuilder.prototype.buildView = function(
}
return viewNode;
});
- var view = new devtools.profiler.ProfileView(head);
+ var view = this.createView(head);
return view;
};
/**
+ * Factory method for a profile view.
+ *
+ * @param {devtools.profiler.ProfileView.Node} head View head node.
+ * @return {devtools.profiler.ProfileView} Profile view.
+ */
+devtools.profiler.ViewBuilder.prototype.createView = function(head) {
+ return new devtools.profiler.ProfileView(head);
+};
+
+
+/**
+ * Factory method for a profile view node.
+ *
+ * @param {string} internalFuncName A fully qualified function name.
+ * @param {number} totalTime Amount of time that application spent in the
+ * corresponding function and its descendants (not that depending on
+ * profile they can be either callees or callers.)
+ * @param {number} selfTime Amount of time that application spent in the
+ * corresponding function only.
+ * @param {devtools.profiler.ProfileView.Node} head Profile view head.
+ * @return {devtools.profiler.ProfileView.Node} Profile view node.
+ */
+devtools.profiler.ViewBuilder.prototype.createViewNode = function(
+ funcName, totalTime, selfTime, head) {
+ return new devtools.profiler.ProfileView.Node(
+ funcName, totalTime, selfTime, head);
+};
+
+
+/**
* Creates a Profile View object. It allows to perform sorting
- * and filtering actions on the profile. Profile View mimicks
- * the Profile object from WebKit's JSC profiler.
+ * and filtering actions on the profile.
*
* @param {devtools.profiler.ProfileView.Node} head Head (root) node.
* @constructor
*/
devtools.profiler.ProfileView = function(head) {
this.head = head;
- this.title = '';
- this.uid = '';
- this.heavyProfile = null;
- this.treeProfile = null;
- this.flatProfile = null;
};
@@ -140,63 +164,12 @@ devtools.profiler.ProfileView.prototype.traverse = function(f) {
*/
devtools.profiler.ProfileView.Node = function(
internalFuncName, totalTime, selfTime, head) {
- this.callIdentifier = 0;
this.internalFuncName = internalFuncName;
- this.initFuncInfo();
this.totalTime = totalTime;
this.selfTime = selfTime;
this.head = head;
this.parent = null;
this.children = [];
- this.visible = true;
-};
-
-
-/**
- * RegEx for stripping V8's prefixes of compiled functions.
- */
-devtools.profiler.ProfileView.Node.FUNC_NAME_STRIP_RE =
- /^(?:LazyCompile|Function): (.*)$/;
-
-
-/**
- * RegEx for extracting script source URL and line number.
- */
-devtools.profiler.ProfileView.Node.FUNC_NAME_PARSE_RE = /^([^ ]+) (.*):(\d+)$/;
-
-
-/**
- * RegEx for removing protocol name from URL.
- */
-devtools.profiler.ProfileView.Node.URL_PARSE_RE = /^(?:http:\/)?.*\/([^/]+)$/;
-
-
-/**
- * Inits 'functionName', 'url', and 'lineNumber' fields using 'internalFuncName'
- * field.
- */
-devtools.profiler.ProfileView.Node.prototype.initFuncInfo = function() {
- var nodeAlias = devtools.profiler.ProfileView.Node;
- this.functionName = this.internalFuncName;
-
- var strippedName = nodeAlias.FUNC_NAME_STRIP_RE.exec(this.functionName);
- if (strippedName) {
- this.functionName = strippedName[1];
- }
-
- var parsedName = nodeAlias.FUNC_NAME_PARSE_RE.exec(this.functionName);
- if (parsedName) {
- this.url = parsedName[2];
- var parsedUrl = nodeAlias.URL_PARSE_RE.exec(this.url);
- if (parsedUrl) {
- this.url = parsedUrl[1];
- }
- this.functionName = parsedName[1];
- this.lineNumber = parsedName[3];
- } else {
- this.url = '';
- this.lineNumber = 0;
- }
};

Powered by Google App Engine
This is Rietveld 408576698