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

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

Issue 344443007: Encapsulate implementation-specific timeline record handling in TimelineUIUtils (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
new file mode 100644
index 0000000000000000000000000000000000000000..d662b3b6ba61f653193020d102dd16d8bdcb585b
--- /dev/null
+++ b/Source/devtools/front_end/timeline/TimelineUIUtilsImpl.js
@@ -0,0 +1,75 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+/**
+ * @constructor
+ * @extends {WebInspector.TimelineUIUtils}
+ */
+WebInspector.TimelineUIUtilsImpl = function()
+{
+ WebInspector.TimelineUIUtils.call(this);
+}
+
+WebInspector.TimelineUIUtilsImpl.prototype = {
+ /**
+ * @param {!WebInspector.TimelineModel.Record} record
+ * @return {boolean}
+ */
+ isBeginFrame: function(record)
+ {
+ return record.type() === WebInspector.TimelineModel.RecordType.BeginFrame;
+ },
+ /**
+ * @param {!WebInspector.TimelineModel.Record} record
+ * @return {boolean}
+ */
+ isProgram: function(record)
+ {
+ return record.type() === WebInspector.TimelineModel.RecordType.Program;
+ },
+ /**
+ * @param {string} recordType
+ * @return {boolean}
+ */
+ isCoalescable: function(recordType)
+ {
+ return !!WebInspector.TimelineUIUtilsImpl._coalescableRecordTypes[recordType];
+ },
+
+ /**
+ * @param {!WebInspector.TimelineModel.Record} record
+ * @return {?Object}
+ */
+ countersForRecord: function(record)
+ {
+ return record.type() === WebInspector.TimelineModel.RecordType.UpdateCounters ? record.data() : null;
+ },
+
+ /**
+ * @param {!WebInspector.TimelineModel.Record} record
+ * @return {?Object}
+ */
+ highlightQuadForRecord: function(record)
+ {
+ var recordTypes = WebInspector.TimelineModel.RecordType;
+ switch(record.type()) {
+ case recordTypes.Layout:
+ return record.data().root;
+ case recordTypes.Paint:
+ return record.data().clip;
+ default:
+ return null;
+ }
+ },
+
+ __proto__: WebInspector.TimelineUIUtils.prototype
+}
+
+
+WebInspector.TimelineUIUtilsImpl._coalescableRecordTypes = {};
+WebInspector.TimelineUIUtilsImpl._coalescableRecordTypes[WebInspector.TimelineModel.RecordType.Layout] = 1;
+WebInspector.TimelineUIUtilsImpl._coalescableRecordTypes[WebInspector.TimelineModel.RecordType.Paint] = 1;
+WebInspector.TimelineUIUtilsImpl._coalescableRecordTypes[WebInspector.TimelineModel.RecordType.Rasterize] = 1;
+WebInspector.TimelineUIUtilsImpl._coalescableRecordTypes[WebInspector.TimelineModel.RecordType.DecodeImage] = 1;
+WebInspector.TimelineUIUtilsImpl._coalescableRecordTypes[WebInspector.TimelineModel.RecordType.ResizeImage] = 1;
« 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