| <!DOCTYPE html> |
| <!-- |
| Copyright (c) 2013 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. |
| --> |
| |
| <link rel="import" href="/tracing/base/base.html"> |
| <link rel="import" href="/tracing/base/math/range_utils.html"> |
| <link rel="import" href="/tracing/core/auditor.html"> |
| <link rel="import" |
| href="/tracing/extras/chrome/cc/input_latency_async_slice.html"> |
| <link rel="import" |
| href="/tracing/extras/chrome/chrome_user_friendly_category_driver.html"> |
| <link rel="import" href="/tracing/model/constants.html"> |
| <link rel="import" href="/tracing/model/event_info.html"> |
| <link rel="import" href="/tracing/model/helpers/chrome_model_helper.html"> |
| |
| <script> |
| 'use strict'; |
| |
| /** |
| * @fileoverview Base class for trace data Auditors. |
| */ |
| tr.exportTo('tr.e.audits', function() { |
| var Auditor = tr.c.Auditor; |
| |
| /** |
| * Auditor for Chrome-specific traces. |
| * @constructor |
| */ |
| function ChromeAuditor(model) { |
| Auditor.call(this, model); |
| |
| var modelHelper = this.model.getOrCreateHelper( |
| tr.model.helpers.ChromeModelHelper); |
| if (modelHelper && modelHelper.browserHelper) { |
| // Must be a browserHelper in order to do audits. |
| this.modelHelper = modelHelper; |
| } else { |
| this.modelHelper = undefined; |
| } |
| } |
| |
| ChromeAuditor.prototype = { |
| __proto__: Auditor.prototype, |
| |
| runAnnotate: function() { |
| if (!this.modelHelper) |
| return; |
| |
| for (var pid in this.modelHelper.rendererHelpers) { |
| var rendererHelper = this.modelHelper.rendererHelpers[pid]; |
| |
| if (rendererHelper.isChromeTracingUI) |
| rendererHelper.process.important = false; |
| } |
| }, |
| |
| /** |
| * Called by import to install userFriendlyCategoryDriver. |
| */ |
| installUserFriendlyCategoryDriverIfNeeded: function() { |
| this.model.addUserFriendlyCategoryDriver( |
| tr.e.chrome.ChromeUserFriendlyCategoryDriver); |
| }, |
| |
| runAudit: function() { |
| if (!this.modelHelper) |
| return; |
| |
| this.model.replacePIDRefsInPatchups( |
| tr.model.BROWSER_PROCESS_PID_REF, |
| this.modelHelper.browserProcess.pid); |
| this.model.applyObjectRefPatchups(); |
| } |
| }; |
| |
| Auditor.register(ChromeAuditor); |
| |
| return { |
| ChromeAuditor, |
| }; |
| }); |
| </script> |