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 8<link rel="import" href="/tracing/model/user_model/user_expectation.html"> 9 10<script> 11'use strict'; 12 13tr.exportTo('tr.model.um', function() { 14 var LOAD_SUBTYPE_NAMES = { 15 SUCCESSFUL: 'Successful', 16 FAILED: 'Failed', 17 STARTUP: 'Startup' 18 }; 19 20 var DOES_LOAD_SUBTYPE_NAME_EXIST = {}; 21 for (var key in LOAD_SUBTYPE_NAMES) { 22 DOES_LOAD_SUBTYPE_NAME_EXIST[LOAD_SUBTYPE_NAMES[key]] = true;; 23 } 24 25 function LoadExpectation(parentModel, initiatorTitle, start, duration) { 26 if (!DOES_LOAD_SUBTYPE_NAME_EXIST[initiatorTitle]) 27 throw new Error(initiatorTitle + ' is not in LOAD_SUBTYPE_NAMES'); 28 29 tr.model.um.UserExpectation.call( 30 this, parentModel, initiatorTitle, start, duration); 31 32 // |renderProcess| is the renderer process that contains the loading 33 // RenderFrame. 34 this.renderProcess = undefined; 35 36 // |renderMainThread| is the CrRendererMain thread in the |renderProcess| 37 // that contains the loading RenderFrame. 38 this.renderMainThread = undefined; 39 40 // |routingId| identifies the loading RenderFrame within the renderer 41 // process. 42 this.routingId = undefined; 43 44 // |parentRoutingId| identifies the RenderFrame that created and contains 45 // the loading RenderFrame. 46 this.parentRoutingId = undefined; 47 48 // |loadFinishedEvent|, if present, signals that this is a main frame. 49 this.loadFinishedEvent = undefined; 50 51 // Startup LoadIRs do not have renderProcess, routingId, or 52 // parentRoutingId. Maybe RenderLoadIR should be a separate class? 53 } 54 55 LoadExpectation.prototype = { 56 __proto__: tr.model.um.UserExpectation.prototype, 57 constructor: LoadExpectation 58 }; 59 60 tr.model.um.UserExpectation.register(LoadExpectation, { 61 stageTitle: 'Load', 62 colorId: tr.b.ColorScheme.getColorIdForReservedName('rail_load') 63 }); 64 65 return { 66 LOAD_SUBTYPE_NAMES: LOAD_SUBTYPE_NAMES, 67 LoadExpectation: LoadExpectation 68 }; 69}); 70</script> 71