Upstream version 9.37.197.0
[platform/framework/web/crosswalk.git] / src / third_party / trace-viewer / trace_viewer / tracing / analysis / stub_analysis_table.js
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 'use strict';
6
7 tvcm.exportTo('tracing.analysis', function() {
8
9   function StubAnalysisTable() {
10     this.ownerDocument_ = document;
11     this.nodes_ = [];
12   }
13
14   StubAnalysisTable.prototype = {
15     __proto__: Object.protoype,
16
17     get ownerDocument() {
18       return this.ownerDocument_;
19     },
20
21     appendChild: function(node) {
22       if (node.tagName == 'TFOOT' || node.tagName == 'THEAD' ||
23               node.tagName == 'TBODY') {
24         node.__proto__ = StubAnalysisTable.prototype;
25         node.nodes_ = [];
26         this.ownerDocument_ = document;
27       }
28       this.nodes_.push(node);
29     },
30
31     get lastNode() {
32       return this.nodes_.pop();
33     },
34
35     get nodeCount() {
36       return this.nodes_.length;
37     }
38   };
39
40   return {
41     StubAnalysisTable: StubAnalysisTable
42   };
43 });