| 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 """Represents a database of on-disk traces.""" | 5 """Represents a database of on-disk traces.""" |
| 6 | 6 |
| 7 import json | 7 import json |
| 8 | 8 |
| 9 | 9 |
| 10 class LoadingTraceDatabase(object): | 10 class LoadingTraceDatabase(object): |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 @classmethod | 48 @classmethod |
| 49 def FromJsonString(cls, json_string): | 49 def FromJsonString(cls, json_string): |
| 50 """Returns an instance from a string returned by ToJsonString().""" | 50 """Returns an instance from a string returned by ToJsonString().""" |
| 51 return LoadingTraceDatabase(json.loads(json_string)) | 51 return LoadingTraceDatabase(json.loads(json_string)) |
| 52 | 52 |
| 53 @classmethod | 53 @classmethod |
| 54 def FromJsonFile(cls, json_path): | 54 def FromJsonFile(cls, json_path): |
| 55 """Returns an instance from a json file saved by ToJsonFile().""" | 55 """Returns an instance from a json file saved by ToJsonFile().""" |
| 56 with open(json_path) as input_file: | 56 with open(json_path) as input_file: |
| 57 return cls.FromJsonDict(json.load(input_file)) | 57 return cls.FromJsonDict(json.load(input_file)) |
| OLD | NEW |