Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(78)

Side by Side Diff: tools/memory_inspector/memory_inspector/data/serialization.py

Issue 549313006: [Android] memory_inspector: move to libheap_profiler. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@mi3_prebuilts
Patch Set: Add prebuilts Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698