1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859 |
- #ifndef BASE_PROFILER_STACK_BUFFER_H_
- #define BASE_PROFILER_STACK_BUFFER_H_
- #include <stddef.h>
- #include <stdint.h>
- #include <memory>
- #include "base/base_export.h"
- #include "base/macros.h"
- namespace base {
- class BASE_EXPORT StackBuffer {
- public:
-
-
-
-
-
-
- static constexpr size_t kPlatformStackAlignment = 2 * sizeof(uintptr_t);
- StackBuffer(size_t buffer_size);
- ~StackBuffer();
-
- uintptr_t* buffer() const {
-
-
-
- return reinterpret_cast<uintptr_t*>(
- (reinterpret_cast<uintptr_t>(buffer_.get()) + kPlatformStackAlignment -
- 1) &
- ~(kPlatformStackAlignment - 1));
- }
-
- size_t size() const { return size_; }
- private:
-
- const std::unique_ptr<uint8_t[]> buffer_;
-
-
- const size_t size_;
- DISALLOW_COPY_AND_ASSIGN(StackBuffer);
- };
- }
- #endif
|