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

Unified Diff: Source/devtools/front_end/timeline/TimelineUIUtilsImpl.js

Issue 339493006: Move divider detection and creation onto TimelineUIUtils instance (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 6 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: Source/devtools/front_end/timeline/TimelineUIUtilsImpl.js
diff --git a/Source/devtools/front_end/timeline/TimelineUIUtilsImpl.js b/Source/devtools/front_end/timeline/TimelineUIUtilsImpl.js
index 9a133a84b033c061d4ad0afa4edb5a6a1ca348d9..eb775f11ec50fe4d8f269d5da7399b02455f55e4 100644
--- a/Source/devtools/front_end/timeline/TimelineUIUtilsImpl.js
+++ b/Source/devtools/front_end/timeline/TimelineUIUtilsImpl.js
@@ -39,6 +39,15 @@ WebInspector.TimelineUIUtilsImpl.prototype = {
/**
* @param {!WebInspector.TimelineModel.Record} record
+ * @return {boolean}
+ */
+ isEventDivider: function(record)
+ {
+ return WebInspector.TimelineUIUtilsImpl.isEventDivider(record);
+ },
+
+ /**
+ * @param {!WebInspector.TimelineModel.Record} record
* @return {?Object}
*/
countersForRecord: function(record)
@@ -86,6 +95,16 @@ WebInspector.TimelineUIUtilsImpl.prototype = {
WebInspector.TimelineUIUtilsImpl.generateDetailsContent(record, model, linkifier, callback, loadedFromFile);
},
+ /**
+ * @param {string} recordType
+ * @param {string=} title
+ * @return {!Element}
+ */
+ createEventDivider: function(recordType, title)
+ {
+ return WebInspector.TimelineUIUtilsImpl._createEventDivider(recordType, title);
+ },
+
__proto__: WebInspector.TimelineUIUtils.prototype
}
@@ -100,6 +119,22 @@ WebInspector.TimelineUIUtilsImpl._coalescableRecordTypes[WebInspector.TimelineMo
/**
* @param {!WebInspector.TimelineModel.Record} record
+ * @return {boolean}
+ */
+WebInspector.TimelineUIUtilsImpl.isEventDivider = function(record)
+{
+ var recordTypes = WebInspector.TimelineModel.RecordType;
+ if (record.type() === recordTypes.TimeStamp)
+ return true;
+ if (record.type() === recordTypes.MarkFirstPaint)
+ return true;
+ if (record.type() === recordTypes.MarkDOMContent || record.type() === recordTypes.MarkLoad)
+ return record.data()["isMainFrame"];
+ return false;
+}
+
+/**
+ * @param {!WebInspector.TimelineModel.Record} record
* @param {!WebInspector.Linkifier} linkifier
* @param {boolean} loadedFromFile
* @return {?Node}
@@ -437,3 +472,31 @@ WebInspector.TimelineUIUtilsImpl._generateDetailsContentSynchronously = function
fragment.appendChild(contentHelper.element);
return fragment;
}
+
+/**
+ * @param {string} recordType
+ * @param {string=} title
+ * @return {!Element}
+ */
+WebInspector.TimelineUIUtilsImpl._createEventDivider = function(recordType, title)
+{
+ var eventDivider = document.createElement("div");
+ eventDivider.className = "resources-event-divider";
+ var recordTypes = WebInspector.TimelineModel.RecordType;
+
+ if (recordType === recordTypes.MarkDOMContent)
+ eventDivider.className += " resources-blue-divider";
+ else if (recordType === recordTypes.MarkLoad)
+ eventDivider.className += " resources-red-divider";
+ else if (recordType === recordTypes.MarkFirstPaint)
+ eventDivider.className += " resources-green-divider";
+ else if (recordType === recordTypes.TimeStamp)
+ eventDivider.className += " resources-orange-divider";
+ else if (recordType === recordTypes.BeginFrame)
+ eventDivider.className += " timeline-frame-divider";
+
+ if (title)
+ eventDivider.title = title;
+
+ return eventDivider;
+}
« no previous file with comments | « Source/devtools/front_end/timeline/TimelineUIUtils.js ('k') | Source/devtools/front_end/timeline/TimelineView.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698