animation_expectation.html revision cef7893435aa41160dd1255c43cb8498279738cc
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  function AnimationExpectation(
15      parentModel, initiatorTitle, start, duration) {
16    tr.model.um.UserExpectation.call(
17        this, parentModel, initiatorTitle, start, duration);
18    this.frameEvents_ = undefined;
19  }
20
21  AnimationExpectation.prototype = {
22    __proto__: tr.model.um.UserExpectation.prototype,
23    constructor: AnimationExpectation,
24
25    get frameEvents() {
26      if (this.frameEvents_)
27        return this.frameEvents_;
28
29      this.frameEvents_ = new tr.model.EventSet();
30
31      this.associatedEvents.forEach(function(event) {
32        if (event.title === tr.model.helpers.IMPL_RENDERING_STATS)
33          this.frameEvents_.push(event);
34      }, this);
35
36      return this.frameEvents_;
37    }
38  };
39
40  tr.model.um.UserExpectation.register(AnimationExpectation, {
41    stageTitle: 'Animation',
42    colorId: tr.b.ColorScheme.getColorIdForReservedName('rail_animation')
43  });
44
45  return {
46    AnimationExpectation: AnimationExpectation
47  };
48});
49</script>
50