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

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

Issue 2680213002: Updated MallocHooks to collect stack traces when memory is allocated. (Closed)
Patch Set: Updated MallocHooks to collect stack traces when memory is allocated. 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
« no previous file with comments | « runtime/vm/os_macos.cc ('k') | runtime/vm/os_win.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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"
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 } 109 }
110 110
111 static bool GetCurrentStackBounds(uword* lower, uword* upper); 111 static bool GetCurrentStackBounds(uword* lower, uword* upper);
112 112
113 // Used to temporarily disable or enable thread interrupts. 113 // Used to temporarily disable or enable thread interrupts.
114 void DisableThreadInterrupts(); 114 void DisableThreadInterrupts();
115 void EnableThreadInterrupts(); 115 void EnableThreadInterrupts();
116 bool ThreadInterruptsEnabled(); 116 bool ThreadInterruptsEnabled();
117 117
118 // The currently executing thread, or NULL if not yet initialized. 118 // The currently executing thread, or NULL if not yet initialized.
119 static OSThread* Current() { 119 static OSThread* TryCurrent() {
120 BaseThread* thread = GetCurrentTLS(); 120 BaseThread* thread = GetCurrentTLS();
121 OSThread* os_thread = NULL; 121 OSThread* os_thread = NULL;
122 if (thread != NULL) { 122 if (thread != NULL) {
123 if (thread->is_os_thread()) { 123 if (thread->is_os_thread()) {
124 os_thread = reinterpret_cast<OSThread*>(thread); 124 os_thread = reinterpret_cast<OSThread*>(thread);
125 } else { 125 } else {
126 Thread* vm_thread = reinterpret_cast<Thread*>(thread); 126 Thread* vm_thread = reinterpret_cast<Thread*>(thread);
127 os_thread = GetOSThreadFromThread(vm_thread); 127 os_thread = GetOSThreadFromThread(vm_thread);
128 } 128 }
129 } else { 129 }
130 return os_thread;
131 }
132
133 // The currently executing thread. If there is no currently executing thread,
134 // a new OSThread is created and returned.
135 static OSThread* Current() {
136 OSThread* os_thread = TryCurrent();
137 if (os_thread == NULL) {
130 os_thread = CreateAndSetUnknownThread(); 138 os_thread = CreateAndSetUnknownThread();
131 } 139 }
132 return os_thread; 140 return os_thread;
133 } 141 }
134 static void SetCurrent(OSThread* current); 142 static void SetCurrent(OSThread* current);
135 143
136 // TODO(5411455): Use flag to override default value and Validate the 144 // TODO(5411455): Use flag to override default value and Validate the
137 // stack size by querying OS. 145 // stack size by querying OS.
138 static uword GetSpecifiedStackSize() { 146 static uword GetSpecifiedStackSize() {
139 ASSERT(OSThread::kStackSizeBuffer < OSThread::GetMaxStackSize()); 147 ASSERT(OSThread::kStackSizeBuffer < OSThread::GetMaxStackSize());
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after
344 friend class SafepointMonitorLocker; 352 friend class SafepointMonitorLocker;
345 friend void Dart_TestMonitor(); 353 friend void Dart_TestMonitor();
346 DISALLOW_COPY_AND_ASSIGN(Monitor); 354 DISALLOW_COPY_AND_ASSIGN(Monitor);
347 }; 355 };
348 356
349 357
350 } // namespace dart 358 } // namespace dart
351 359
352 360
353 #endif // RUNTIME_VM_OS_THREAD_H_ 361 #endif // RUNTIME_VM_OS_THREAD_H_
OLDNEW
« no previous file with comments | « runtime/vm/os_macos.cc ('k') | runtime/vm/os_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698