Chromium Code Reviews| 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 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 237 """) | 237 """) |
| 238 for n in sorted_nodes: | 238 for n in sorted_nodes: |
| 239 if not n.Successors() and not n.Predecessors(): | 239 if not n.Successors() and not n.Predecessors(): |
| 240 continue | 240 continue |
| 241 output.write(self._GraphvizNode(n.Index(), highlight)) | 241 output.write(self._GraphvizNode(n.Index(), highlight)) |
| 242 | 242 |
| 243 for n in sorted_nodes: | 243 for n in sorted_nodes: |
| 244 for s in n.Successors(): | 244 for s in n.Successors(): |
| 245 style = 'color = orange' | 245 style = 'color = orange' |
| 246 annotations = self._EdgeAnnotation(n, s) | 246 annotations = self._EdgeAnnotation(n, s) |
| 247 if 'redirect' in annotations: | |
| 248 style = 'color = black' | |
| 247 if 'parser' in annotations: | 249 if 'parser' in annotations: |
|
blundell
2016/01/26 13:23:44
should this be an elif?
Benoit L
2016/01/26 13:40:47
Indeed, thanks!
Done.
| |
| 248 style = 'color = red' | 250 style = 'color = red' |
| 249 elif 'stack' in annotations: | 251 elif 'stack' in annotations: |
| 250 style = 'color = blue' | 252 style = 'color = blue' |
| 251 elif 'script_inferred' in annotations: | 253 elif 'script_inferred' in annotations: |
| 252 style = 'color = purple' | 254 style = 'color = purple' |
| 253 if 'timing' in annotations: | 255 if 'timing' in annotations: |
| 254 style += '; style=dashed' | 256 style += '; style=dashed' |
| 255 arrow = '[%s; label="%s"]' % (style, self._EdgeCost(n, s)) | 257 arrow = '[%s; label="%s"]' % (style, self._EdgeCost(n, s)) |
| 256 output.write('%d -> %d %s;\n' % (n.Index(), s.Index(), arrow)) | 258 output.write('%d -> %d %s;\n' % (n.Index(), s.Index(), arrow)) |
| 257 output.write('}\n}\n') | 259 output.write('}\n}\n') |
| (...skipping 442 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 700 Dict of image url + short name to NodeInfo. | 702 Dict of image url + short name to NodeInfo. |
| 701 """ | 703 """ |
| 702 image_to_info = {} | 704 image_to_info = {} |
| 703 for n in self._node_info: | 705 for n in self._node_info: |
| 704 if (n.ContentType().startswith('image') and | 706 if (n.ContentType().startswith('image') and |
| 705 not self._IsAdUrl(n.Url())): | 707 not self._IsAdUrl(n.Url())): |
| 706 key = str((n.Url(), n.ShortName(), n.StartTime())) | 708 key = str((n.Url(), n.ShortName(), n.StartTime())) |
| 707 assert key not in image_to_info, n.Url() | 709 assert key not in image_to_info, n.Url() |
| 708 image_to_info[key] = n | 710 image_to_info[key] = n |
| 709 return image_to_info | 711 return image_to_info |
| OLD | NEW |