| 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 """Parses a JSON request log created by log_requests.py.""" | 5 """Parses a JSON request log created by log_requests.py.""" |
| 6 | 6 |
| 7 import collections | 7 import collections |
| 8 import json | 8 import json |
| 9 import operator | 9 import operator |
| 10 import urlparse | 10 import urlparse |
| (...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 209 or len(cache_control) == 0): | 209 or len(cache_control) == 0): |
| 210 return -1 | 210 return -1 |
| 211 if 'max-age' in cache_control: | 211 if 'max-age' in cache_control: |
| 212 return int(cache_control['max-age']) | 212 return int(cache_control['max-age']) |
| 213 return -1 | 213 return -1 |
| 214 | 214 |
| 215 | 215 |
| 216 def SortedByCompletion(requests): | 216 def SortedByCompletion(requests): |
| 217 """Returns the requests, sorted by completion time.""" | 217 """Returns the requests, sorted by completion time.""" |
| 218 return sorted(requests, key=operator.attrgetter('timestamp')) | 218 return sorted(requests, key=operator.attrgetter('timestamp')) |
| OLD | NEW |