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/profiler/native_stack_sampler.h" | 5 #include "base/profiler/native_stack_sampler.h" |
6 | 6 |
| 7 #include "base/memory/ptr_util.h" |
| 8 |
7 namespace base { | 9 namespace base { |
8 | 10 |
| 11 NativeStackSampler::StackBuffer::StackBuffer(size_t buffer_size) |
| 12 : buffer_(new uintptr_t[(buffer_size + sizeof(uintptr_t) - 1) / |
| 13 sizeof(uintptr_t)]), |
| 14 size_(buffer_size) {} |
| 15 |
| 16 NativeStackSampler::StackBuffer::~StackBuffer() {} |
| 17 |
9 NativeStackSampler::NativeStackSampler() {} | 18 NativeStackSampler::NativeStackSampler() {} |
10 | 19 |
11 NativeStackSampler::~NativeStackSampler() {} | 20 NativeStackSampler::~NativeStackSampler() {} |
12 | 21 |
| 22 std::unique_ptr<NativeStackSampler::StackBuffer> |
| 23 NativeStackSampler::CreateStackBuffer() { |
| 24 size_t size = GetStackBufferSize(); |
| 25 if (size == 0) |
| 26 return nullptr; |
| 27 return MakeUnique<StackBuffer>(size); |
| 28 } |
| 29 |
13 NativeStackSamplerTestDelegate::~NativeStackSamplerTestDelegate() {} | 30 NativeStackSamplerTestDelegate::~NativeStackSamplerTestDelegate() {} |
14 | 31 |
15 NativeStackSamplerTestDelegate::NativeStackSamplerTestDelegate() {} | 32 NativeStackSamplerTestDelegate::NativeStackSamplerTestDelegate() {} |
16 | 33 |
17 } // namespace base | 34 } // namespace base |
OLD | NEW |