| OLD | NEW |
| 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 #include "base/trace_event/heap_profiler_allocation_context_tracker.h" | 5 #include "base/trace_event/heap_profiler_allocation_context_tracker.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <iterator> | 8 #include <iterator> |
| 9 | 9 |
| 10 #include "base/atomicops.h" | 10 #include "base/atomicops.h" |
| (...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 199 } | 199 } |
| 200 case CaptureMode::NATIVE_STACK: | 200 case CaptureMode::NATIVE_STACK: |
| 201 { | 201 { |
| 202 // Backtrace contract requires us to return bottom frames, i.e. | 202 // Backtrace contract requires us to return bottom frames, i.e. |
| 203 // from main() and up. Stack unwinding produces top frames, i.e. | 203 // from main() and up. Stack unwinding produces top frames, i.e. |
| 204 // from this point and up until main(). We request many frames to | 204 // from this point and up until main(). We request many frames to |
| 205 // make sure we reach main(), and then copy bottom portion of them. | 205 // make sure we reach main(), and then copy bottom portion of them. |
| 206 const void* frames[128]; | 206 const void* frames[128]; |
| 207 static_assert(arraysize(frames) >= Backtrace::kMaxFrameCount, | 207 static_assert(arraysize(frames) >= Backtrace::kMaxFrameCount, |
| 208 "not requesting enough frames to fill Backtrace"); | 208 "not requesting enough frames to fill Backtrace"); |
| 209 #if HAVE_TRACE_STACK_FRAME_POINTERS && !defined(OS_NACL) | 209 #if CAN_UNWIND_WITH_FRAME_POINTERS && !defined(OS_NACL) |
| 210 size_t frame_count = debug::TraceStackFramePointers( | 210 size_t frame_count = debug::TraceStackFramePointers( |
| 211 frames, | 211 frames, |
| 212 arraysize(frames), | 212 arraysize(frames), |
| 213 1 /* exclude this function from the trace */ ); | 213 1 /* exclude this function from the trace */ ); |
| 214 #else | 214 #else |
| 215 size_t frame_count = 0; | 215 size_t frame_count = 0; |
| 216 NOTREACHED(); | 216 NOTREACHED(); |
| 217 #endif | 217 #endif |
| 218 | 218 |
| 219 // Copy frames backwards | 219 // Copy frames backwards |
| (...skipping 21 matching lines...) Expand all Loading... |
| 241 ctx->type_name = pseudo_stack_.back().trace_event_category; | 241 ctx->type_name = pseudo_stack_.back().trace_event_category; |
| 242 } else { | 242 } else { |
| 243 ctx->type_name = nullptr; | 243 ctx->type_name = nullptr; |
| 244 } | 244 } |
| 245 | 245 |
| 246 return true; | 246 return true; |
| 247 } | 247 } |
| 248 | 248 |
| 249 } // namespace trace_event | 249 } // namespace trace_event |
| 250 } // namespace base | 250 } // namespace base |
| OLD | NEW |