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

Side by Side Diff: runtime/vm/os_thread.h

Issue 2680213002: Updated MallocHooks to collect stack traces when memory is allocated. (Closed)
Patch Set: Rough first patch Created 3 years, 10 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 (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #ifndef RUNTIME_VM_OS_THREAD_H_ 5 #ifndef RUNTIME_VM_OS_THREAD_H_
6 #define RUNTIME_VM_OS_THREAD_H_ 6 #define RUNTIME_VM_OS_THREAD_H_
7 7
8 #include "platform/globals.h" 8 #include "platform/globals.h"
9 #include "vm/allocation.h" 9 #include "vm/allocation.h"
10 #include "vm/globals.h" 10 #include "vm/globals.h"
11 #include "vm/malloc_hooks.h"
11 12
12 // Declare the OS-specific types ahead of defining the generic classes. 13 // Declare the OS-specific types ahead of defining the generic classes.
13 #if defined(TARGET_OS_ANDROID) 14 #if defined(TARGET_OS_ANDROID)
14 #include "vm/os_thread_android.h" 15 #include "vm/os_thread_android.h"
15 #elif defined(TARGET_OS_FUCHSIA) 16 #elif defined(TARGET_OS_FUCHSIA)
16 #include "vm/os_thread_fuchsia.h" 17 #include "vm/os_thread_fuchsia.h"
17 #elif defined(TARGET_OS_LINUX) 18 #elif defined(TARGET_OS_LINUX)
18 #include "vm/os_thread_linux.h" 19 #include "vm/os_thread_linux.h"
19 #elif defined(TARGET_OS_MACOS) 20 #elif defined(TARGET_OS_MACOS)
20 #include "vm/os_thread_macos.h" 21 #include "vm/os_thread_macos.h"
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 *lower = stack_lower; 107 *lower = stack_lower;
107 *upper = stack_upper; 108 *upper = stack_upper;
108 return true; 109 return true;
109 } 110 }
110 111
111 // Used to temporarily disable or enable thread interrupts. 112 // Used to temporarily disable or enable thread interrupts.
112 void DisableThreadInterrupts(); 113 void DisableThreadInterrupts();
113 void EnableThreadInterrupts(); 114 void EnableThreadInterrupts();
114 bool ThreadInterruptsEnabled(); 115 bool ThreadInterruptsEnabled();
115 116
117 static bool DoesCurrentThreadExist() { return (GetCurrentTLS() != NULL); }
118
116 // The currently executing thread, or NULL if not yet initialized. 119 // The currently executing thread, or NULL if not yet initialized.
117 static OSThread* Current() { 120 static OSThread* Current() {
118 BaseThread* thread = GetCurrentTLS(); 121 BaseThread* thread = GetCurrentTLS();
119 OSThread* os_thread = NULL; 122 OSThread* os_thread = NULL;
120 if (thread != NULL) { 123 if (thread != NULL) {
121 if (thread->is_os_thread()) { 124 if (thread->is_os_thread()) {
122 os_thread = reinterpret_cast<OSThread*>(thread); 125 os_thread = reinterpret_cast<OSThread*>(thread);
123 } else { 126 } else {
124 Thread* vm_thread = reinterpret_cast<Thread*>(thread); 127 Thread* vm_thread = reinterpret_cast<Thread*>(thread);
125 os_thread = GetOSThreadFromThread(vm_thread); 128 os_thread = GetOSThreadFromThread(vm_thread);
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after
342 friend class SafepointMonitorLocker; 345 friend class SafepointMonitorLocker;
343 friend void Dart_TestMonitor(); 346 friend void Dart_TestMonitor();
344 DISALLOW_COPY_AND_ASSIGN(Monitor); 347 DISALLOW_COPY_AND_ASSIGN(Monitor);
345 }; 348 };
346 349
347 350
348 } // namespace dart 351 } // namespace dart
349 352
350 353
351 #endif // RUNTIME_VM_OS_THREAD_H_ 354 #endif // RUNTIME_VM_OS_THREAD_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698