OLD | NEW |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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 StackUtil_h | 5 #ifndef StackUtil_h |
6 #define StackUtil_h | 6 #define StackUtil_h |
7 | 7 |
| 8 #include <stddef.h> |
| 9 #include <stdint.h> |
8 #include "platform/wtf/Compiler.h" | 10 #include "platform/wtf/Compiler.h" |
9 #include "platform/wtf/WTFExport.h" | 11 #include "platform/wtf/WTFExport.h" |
10 #include "platform/wtf/build_config.h" | 12 #include "platform/wtf/build_config.h" |
11 #include <stddef.h> | |
12 #include <stdint.h> | |
13 | 13 |
14 namespace WTF { | 14 namespace WTF { |
15 | 15 |
16 WTF_EXPORT size_t GetUnderestimatedStackSize(); | 16 WTF_EXPORT size_t GetUnderestimatedStackSize(); |
17 WTF_EXPORT void* GetStackStart(); | 17 WTF_EXPORT void* GetStackStart(); |
18 | 18 |
19 namespace internal { | 19 namespace internal { |
20 | 20 |
21 WTF_EXPORT extern uintptr_t g_main_thread_stack_start; | 21 WTF_EXPORT extern uintptr_t g_main_thread_stack_start; |
22 WTF_EXPORT extern uintptr_t g_main_thread_underestimated_stack_size; | 22 WTF_EXPORT extern uintptr_t g_main_thread_underestimated_stack_size; |
(...skipping 17 matching lines...) Expand all Loading... |
40 // This is a fast way to judge if we are in the main thread. | 40 // This is a fast way to judge if we are in the main thread. |
41 // If |&dummy| is within |s_mainThreadUnderestimatedStackSize| byte from | 41 // If |&dummy| is within |s_mainThreadUnderestimatedStackSize| byte from |
42 // the stack start of the main thread, we judge that we are in | 42 // the stack start of the main thread, we judge that we are in |
43 // the main thread. | 43 // the main thread. |
44 return address_diff >= internal::g_main_thread_underestimated_stack_size; | 44 return address_diff >= internal::g_main_thread_underestimated_stack_size; |
45 } | 45 } |
46 | 46 |
47 } // namespace WTF | 47 } // namespace WTF |
48 | 48 |
49 #endif // StackUtil_h | 49 #endif // StackUtil_h |
OLD | NEW |