1<!DOCTYPE html>
2<!--
3Copyright 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/base/base.html">
9
10<script>
11'use strict';
12
13tr.exportTo('tr.model.source_info', function() {
14  function SourceInfo(file, opt_line, opt_column) {
15    this.file_ = file;
16    this.line_ = opt_line || -1;
17    this.column_ = opt_column || -1;
18  }
19
20  SourceInfo.prototype = {
21    get file() {
22      return this.file_;
23    },
24
25    get line() {
26      return this.line_;
27    },
28
29    get column() {
30      return this.column_;
31    },
32
33    get domain() {
34      if (!this.file_)
35        return undefined;
36      var domain = this.file_.match(/(.*:\/\/[^:\/]*)/i);
37      return domain ? domain[1] : undefined;
38    },
39
40    toString: function() {
41      var str = '';
42
43      if (this.file_)
44        str += this.file_;
45      if (this.line_ > 0)
46        str += ':' + this.line_;
47      if (this.column_ > 0)
48        str += ':' + this.column_;
49      return str;
50    }
51  };
52
53  return {
54    SourceInfo: SourceInfo
55  };
56});
57</script>
58
59