| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 // Parts of this module come from: | 5 // Parts of this module come from: |
| 6 // http://www.codeproject.com/KB/applications/visualleakdetector.aspx | 6 // http://www.codeproject.com/KB/applications/visualleakdetector.aspx |
| 7 // by Dan Moulding. | 7 // by Dan Moulding. |
| 8 // http://www.codeproject.com/KB/threads/StackWalker.aspx | 8 // http://www.codeproject.com/KB/threads/StackWalker.aspx |
| 9 // by Jochen Kalmbach | 9 // by Jochen Kalmbach |
| 10 | 10 |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 // Dynamically load the DbgHelp library and supporting routines that we | 77 // Dynamically load the DbgHelp library and supporting routines that we |
| 78 // will use. | 78 // will use. |
| 79 static bool LoadDbgHelp(); | 79 static bool LoadDbgHelp(); |
| 80 | 80 |
| 81 static void LockDbgHelp() { | 81 static void LockDbgHelp() { |
| 82 dbghelp_lock_.Acquire(); | 82 dbghelp_lock_.Acquire(); |
| 83 active_thread_id_ = GetCurrentThreadId(); | 83 active_thread_id_ = GetCurrentThreadId(); |
| 84 } | 84 } |
| 85 | 85 |
| 86 static void UnlockDbgHelp() { | 86 static void UnlockDbgHelp() { |
| 87 active_thread_id_ = GetCurrentThreadId(); | 87 active_thread_id_ = 0; |
| 88 dbghelp_lock_.Release(); | 88 dbghelp_lock_.Release(); |
| 89 } | 89 } |
| 90 | 90 |
| 91 class AutoDbgHelpLock { | 91 class AutoDbgHelpLock { |
| 92 public: | 92 public: |
| 93 AutoDbgHelpLock() { | 93 AutoDbgHelpLock() { |
| 94 CallStack::LockDbgHelp(); | 94 CallStack::LockDbgHelp(); |
| 95 } | 95 } |
| 96 ~AutoDbgHelpLock() { | 96 ~AutoDbgHelpLock() { |
| 97 CallStack::UnlockDbgHelp(); | 97 CallStack::UnlockDbgHelp(); |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 159 private: | 159 private: |
| 160 AllocationStack* next_; // Pointer used when on the freelist. | 160 AllocationStack* next_; // Pointer used when on the freelist. |
| 161 int32 size_; // Size of block allocated. | 161 int32 size_; // Size of block allocated. |
| 162 static AllocationStack* freelist_; | 162 static AllocationStack* freelist_; |
| 163 static Lock freelist_lock_; | 163 static Lock freelist_lock_; |
| 164 | 164 |
| 165 DISALLOW_EVIL_CONSTRUCTORS(AllocationStack); | 165 DISALLOW_EVIL_CONSTRUCTORS(AllocationStack); |
| 166 }; | 166 }; |
| 167 | 167 |
| 168 #endif // MEMORY_WATCHER_CALL_STACK_H_ | 168 #endif // MEMORY_WATCHER_CALL_STACK_H_ |
| OLD | NEW |