1<!DOCTYPE html> 2<!-- 3Copyright (c) 2015 The Chromium Authors. All rights reserved. 4Use of this source code is governed by a BSD-style license that can be 5found in the LICENSE file. 6--> 7<link rel="import" href="/tracing/base/color_scheme.html"> 8 9<script> 10'use strict'; 11 12/** 13 * @fileoverview Class representing a user activity that is running 14 * in the process. 15 * On the Android platform, activities are mapped to Android Activities 16 * running in the foreground of the process. 17 * On Windows/OS X this could for example represent 18 * the currently active window of the process. 19 */ 20tr.exportTo('tr.model', function() { 21 var ColorScheme = tr.b.ColorScheme; 22 23 /** 24 * @constructor 25 * @param {String} name Name of the activity 26 * @param {String} category Category of the activities 27 * @param {String} range The time range where the activity was running 28 * @param {String} args Additional arguments 29 */ 30 function Activity(name, category, range, args) { 31 tr.model.TimedEvent.call(this, range.min); 32 this.title = name; 33 this.category = category; 34 this.colorId = ColorScheme.getColorIdForGeneralPurposeString(name); 35 this.duration = range.duration; 36 this.args = args; 37 this.name = name; 38 }; 39 40 Activity.prototype = { 41 __proto__: tr.model.TimedEvent.prototype, 42 43 shiftTimestampsForward: function(amount) { 44 this.start += amount; 45 }, 46 47 addBoundsToRange: function(range) { 48 range.addValue(this.start); 49 range.addValue(this.end); 50 } 51 }; 52 return { 53 Activity: Activity 54 }; 55}); 56</script> 57