| OLD | NEW |
| 1 # Copyright 2015 The Chromium Authors. All rights reserved. | 1 # Copyright 2015 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 """Models for loading in chrome. | 5 """Models for loading in chrome. |
| 6 | 6 |
| 7 (Redirect the following to the general model module once we have one) | 7 (Redirect the following to the general model module once we have one) |
| 8 A model is an object with the following methods. | 8 A model is an object with the following methods. |
| 9 CostMs(): return the cost of the model in milliseconds. | 9 CostMs(): return the cost of the model in milliseconds. |
| 10 Set(): set model-specific parameters. | 10 Set(): set model-specific parameters. |
| (...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 240 """) | 240 """) |
| 241 for n in sorted_nodes: | 241 for n in sorted_nodes: |
| 242 if not n.Successors() and not n.Predecessors(): | 242 if not n.Successors() and not n.Predecessors(): |
| 243 continue | 243 continue |
| 244 output.write(self._GraphvizNode(n.Index(), highlight)) | 244 output.write(self._GraphvizNode(n.Index(), highlight)) |
| 245 | 245 |
| 246 for n in sorted_nodes: | 246 for n in sorted_nodes: |
| 247 for s in n.Successors(): | 247 for s in n.Successors(): |
| 248 style = 'color = orange' | 248 style = 'color = orange' |
| 249 annotations = self._EdgeAnnotation(n, s) | 249 annotations = self._EdgeAnnotation(n, s) |
| 250 if 'parser' in annotations: | 250 if 'redirect' in annotations: |
| 251 style = 'color = black' |
| 252 elif 'parser' in annotations: |
| 251 style = 'color = red' | 253 style = 'color = red' |
| 252 elif 'stack' in annotations: | 254 elif 'stack' in annotations: |
| 253 style = 'color = blue' | 255 style = 'color = blue' |
| 254 elif 'script_inferred' in annotations: | 256 elif 'script_inferred' in annotations: |
| 255 style = 'color = purple' | 257 style = 'color = purple' |
| 256 if 'timing' in annotations: | 258 if 'timing' in annotations: |
| 257 style += '; style=dashed' | 259 style += '; style=dashed' |
| 258 arrow = '[%s; label="%s"]' % (style, self._EdgeCost(n, s)) | 260 arrow = '[%s; label="%s"]' % (style, self._EdgeCost(n, s)) |
| 259 output.write('%d -> %d %s;\n' % (n.Index(), s.Index(), arrow)) | 261 output.write('%d -> %d %s;\n' % (n.Index(), s.Index(), arrow)) |
| 260 output.write('}\n}\n') | 262 output.write('}\n}\n') |
| (...skipping 464 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 725 Dict of image url + short name to NodeInfo. | 727 Dict of image url + short name to NodeInfo. |
| 726 """ | 728 """ |
| 727 image_to_info = {} | 729 image_to_info = {} |
| 728 for n in self._node_info: | 730 for n in self._node_info: |
| 729 if (n.ContentType().startswith('image') and | 731 if (n.ContentType().startswith('image') and |
| 730 not self._IsAdUrl(n.Url())): | 732 not self._IsAdUrl(n.Url())): |
| 731 key = str((n.Url(), n.ShortName(), n.StartTime())) | 733 key = str((n.Url(), n.ShortName(), n.StartTime())) |
| 732 assert key not in image_to_info, n.Url() | 734 assert key not in image_to_info, n.Url() |
| 733 image_to_info[key] = n | 735 image_to_info[key] = n |
| 734 return image_to_info | 736 return image_to_info |
| OLD | NEW |