| OLD | NEW |
| 1 # Copyright 2016 The Chromium Authors. All rights reserved. | 1 # Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 | 4 |
| 5 """Visualize a loading_model.ResourceGraph.""" | 5 """Visualize a loading_model.ResourceGraph.""" |
| 6 | 6 |
| 7 import dag | 7 import dag |
| 8 import itertools | 8 import itertools |
| 9 | 9 |
| 10 import loading_model | 10 import loading_model |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 | 30 |
| 31 _CONTENT_TYPE_TO_COLOR = { | 31 _CONTENT_TYPE_TO_COLOR = { |
| 32 'html': 'red', | 32 'html': 'red', |
| 33 'css': 'green', | 33 'css': 'green', |
| 34 'script': 'blue', | 34 'script': 'blue', |
| 35 'javascript': 'blue', | 35 'javascript': 'blue', |
| 36 'json': 'purple', | 36 'json': 'purple', |
| 37 'gif': 'grey', | 37 'gif': 'grey', |
| 38 'image': 'orange', | 38 'image': 'orange', |
| 39 'jpeg': 'orange', | 39 'jpeg': 'orange', |
| 40 'ping': 'cyan', # Empty response |
| 41 'redirect': 'forestgreen', |
| 40 'png': 'orange', | 42 'png': 'orange', |
| 41 'plain': 'brown3', | 43 'plain': 'brown3', |
| 42 'octet-stream': 'brown3', | 44 'octet-stream': 'brown3', |
| 43 'other': 'white', | 45 'other': 'white', |
| 44 'synthetic': 'yellow', | 46 'synthetic': 'yellow', |
| 45 } | 47 } |
| 46 | 48 |
| 47 _EDGE_KIND_TO_COLOR = { | 49 _EDGE_KIND_TO_COLOR = { |
| 48 'redirect': 'black', | 50 'redirect': 'black', |
| 49 'parser': 'red', | 51 'parser': 'red', |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 173 styles = ['filled'] | 175 styles = ['filled'] |
| 174 if node.IsAd() or node.IsTracking(): | 176 if node.IsAd() or node.IsTracking(): |
| 175 styles += ['bold', 'diagonals'] | 177 styles += ['bold', 'diagonals'] |
| 176 return ('%d [label = "%s\\n%.2f->%.2f (%.2f)"; style = "%s"; ' | 178 return ('%d [label = "%s\\n%.2f->%.2f (%.2f)"; style = "%s"; ' |
| 177 'fillcolor = %s; shape = %s];\n' | 179 'fillcolor = %s; shape = %s];\n' |
| 178 % (node.Index(), node.ShortName(), | 180 % (node.Index(), node.ShortName(), |
| 179 node.StartTime() - self._global_start, | 181 node.StartTime() - self._global_start, |
| 180 node.EndTime() - self._global_start, | 182 node.EndTime() - self._global_start, |
| 181 node.EndTime() - node.StartTime(), | 183 node.EndTime() - node.StartTime(), |
| 182 ','.join(styles), color, shape)) | 184 ','.join(styles), color, shape)) |
| OLD | NEW |