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

Side by Side Diff: base/trace_event/heap_profiler_allocation_context.h

Issue 1839503002: [tracing] Add native allocation tracing mode. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Revert whitespace change in malloc_dump_provider Created 4 years, 8 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 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 #ifndef BASE_TRACE_EVENT_HEAP_PROFILER_ALLOCATION_CONTEXT_H_ 5 #ifndef BASE_TRACE_EVENT_HEAP_PROFILER_ALLOCATION_CONTEXT_H_
6 #define BASE_TRACE_EVENT_HEAP_PROFILER_ALLOCATION_CONTEXT_H_ 6 #define BASE_TRACE_EVENT_HEAP_PROFILER_ALLOCATION_CONTEXT_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 10
(...skipping 26 matching lines...) Expand all
37 37
38 // Represents (pseudo) stack frame. Used in Backtrace class below. 38 // Represents (pseudo) stack frame. Used in Backtrace class below.
39 // 39 //
40 // Conceptually stack frame is identified by its value, and type is used 40 // Conceptually stack frame is identified by its value, and type is used
41 // mostly to properly format the value. Value is expected to be a valid 41 // mostly to properly format the value. Value is expected to be a valid
42 // pointer from process' address space. 42 // pointer from process' address space.
43 struct BASE_EXPORT StackFrame { 43 struct BASE_EXPORT StackFrame {
44 enum class Type { 44 enum class Type {
45 TRACE_EVENT_NAME, // const char* string 45 TRACE_EVENT_NAME, // const char* string
46 THREAD_NAME, // const char* thread name 46 THREAD_NAME, // const char* thread name
47 PROGRAM_COUNTER, // as returned by stack tracing (e.g. by StackTrace)
47 }; 48 };
48 49
49 static StackFrame FromTraceEventName(const char* name) { 50 static StackFrame FromTraceEventName(const char* name) {
50 return {Type::TRACE_EVENT_NAME, name}; 51 return {Type::TRACE_EVENT_NAME, name};
51 } 52 }
52 static StackFrame FromThreadName(const char* name) { 53 static StackFrame FromThreadName(const char* name) {
53 return {Type::THREAD_NAME, name}; 54 return {Type::THREAD_NAME, name};
54 } 55 }
56 static StackFrame FromProgramCounter(const void* pc) {
57 return {Type::PROGRAM_COUNTER, pc};
58 }
55 59
56 Type type; 60 Type type;
57 const void* value; 61 const void* value;
58 }; 62 };
59 63
60 bool BASE_EXPORT operator < (const StackFrame& lhs, const StackFrame& rhs); 64 bool BASE_EXPORT operator < (const StackFrame& lhs, const StackFrame& rhs);
61 bool BASE_EXPORT operator == (const StackFrame& lhs, const StackFrame& rhs); 65 bool BASE_EXPORT operator == (const StackFrame& lhs, const StackFrame& rhs);
62 bool BASE_EXPORT operator != (const StackFrame& lhs, const StackFrame& rhs); 66 bool BASE_EXPORT operator != (const StackFrame& lhs, const StackFrame& rhs);
63 67
64 struct BASE_EXPORT Backtrace { 68 struct BASE_EXPORT Backtrace {
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 }; 128 };
125 129
126 template <> 130 template <>
127 struct BASE_EXPORT hash<base::trace_event::AllocationContext> { 131 struct BASE_EXPORT hash<base::trace_event::AllocationContext> {
128 size_t operator()(const base::trace_event::AllocationContext& context) const; 132 size_t operator()(const base::trace_event::AllocationContext& context) const;
129 }; 133 };
130 134
131 } // BASE_HASH_NAMESPACE 135 } // BASE_HASH_NAMESPACE
132 136
133 #endif // BASE_TRACE_EVENT_HEAP_PROFILER_ALLOCATION_CONTEXT_H_ 137 #endif // BASE_TRACE_EVENT_HEAP_PROFILER_ALLOCATION_CONTEXT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698