| OLD | NEW |
| 1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2012 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 import copy | 5 import copy |
| 6 import os | 6 import os |
| 7 import sys | 7 import sys |
| 8 | 8 |
| 9 import json_parse | 9 import json_parse |
| 10 import schema_util | 10 import schema_util |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 # at |filename|. | 37 # at |filename|. |
| 38 _cache = {} | 38 _cache = {} |
| 39 | 39 |
| 40 def CachedLoad(filename): | 40 def CachedLoad(filename): |
| 41 """Equivalent to Load(filename), but caches results for subsequent calls""" | 41 """Equivalent to Load(filename), but caches results for subsequent calls""" |
| 42 if filename not in _cache: | 42 if filename not in _cache: |
| 43 _cache[filename] = Load(filename) | 43 _cache[filename] = Load(filename) |
| 44 # Return a copy of the object so that any changes a caller makes won't affect | 44 # Return a copy of the object so that any changes a caller makes won't affect |
| 45 # the next caller. | 45 # the next caller. |
| 46 return copy.deepcopy(_cache[filename]) | 46 return copy.deepcopy(_cache[filename]) |
| OLD | NEW |