OLD | NEW |
1 # Copyright 2014 The Chromium Authors. All rights reserved. | 1 # Copyright 2014 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 """This module handles the JSON de/serialization of the core classes. | 5 """This module handles the JSON de/serialization of the core classes. |
6 | 6 |
7 This is needed for both long term storage (e.g., loading/storing traces to local | 7 This is needed for both long term storage (e.g., loading/storing traces to local |
8 files) and for short term data exchange (AJAX with the HTML UI). | 8 files) and for short term data exchange (AJAX with the HTML UI). |
9 | 9 |
10 The rationale of these serializers is to store data in an efficient (i.e. avoid | 10 The rationale of these serializers is to store data in an efficient (i.e. avoid |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 # First load and rebuild the stack_frame index. | 98 # First load and rebuild the stack_frame index. |
99 for frame_dict in d['stack_frames']: | 99 for frame_dict in d['stack_frames']: |
100 frame = nh.GetStackFrame(frame_dict['address']) | 100 frame = nh.GetStackFrame(frame_dict['address']) |
101 frame.SetExecFileInfo(frame_dict['exec_file_rel_path'], | 101 frame.SetExecFileInfo(frame_dict['exec_file_rel_path'], |
102 frame_dict['offset']) | 102 frame_dict['offset']) |
103 # Then load backtraces (reusing stack frames from the index above). | 103 # Then load backtraces (reusing stack frames from the index above). |
104 for alloc_dict in d['allocations']: | 104 for alloc_dict in d['allocations']: |
105 stack_trace = stacktrace.Stacktrace() | 105 stack_trace = stacktrace.Stacktrace() |
106 for absolute_addr in alloc_dict['stack_trace']: | 106 for absolute_addr in alloc_dict['stack_trace']: |
107 stack_trace.Add(nh.GetStackFrame(absolute_addr)) | 107 stack_trace.Add(nh.GetStackFrame(absolute_addr)) |
108 allocation = native_heap.Allocation(alloc_dict['size'], | 108 nh.Add(native_heap.Allocation(start=alloc_dict['start'], |
109 alloc_dict['count'], | 109 size=alloc_dict['size'], |
110 stack_trace) | 110 stack_trace=stack_trace, |
111 nh.Add(allocation) | 111 flags=alloc_dict['flags'])) |
112 return nh | 112 return nh |
OLD | NEW |