OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 |
11 #ifndef MEMORY_WATCHER_CALL_STACK_H_ | 11 #ifndef TOOLS_MEMORY_WATCHER_CALL_STACK_H_ |
12 #define MEMORY_WATCHER_CALL_STACK_H_ | 12 #define TOOLS_MEMORY_WATCHER_CALL_STACK_H_ |
13 | 13 |
14 #include <windows.h> | 14 #include <windows.h> |
15 #include <dbghelp.h> | 15 #include <dbghelp.h> |
16 #include <functional> | 16 #include <functional> |
17 #include <map> | 17 #include <map> |
18 #include <string> | 18 #include <string> |
19 | 19 |
20 #include "memory_watcher.h" | |
21 #include "base/lock.h" | 20 #include "base/lock.h" |
22 #include "base/logging.h" | 21 #include "base/logging.h" |
| 22 #include "tools/memory_watcher/memory_watcher.h" |
23 | 23 |
24 // The CallStack Class | 24 // The CallStack Class |
25 // A stack where memory has been allocated. | 25 // A stack where memory has been allocated. |
26 class CallStack { | 26 class CallStack { |
27 public: | 27 public: |
28 // Initialize for tracing CallStacks. | 28 // Initialize for tracing CallStacks. |
29 static bool Initialize(); | 29 static bool Initialize(); |
30 | 30 |
31 CallStack(); | 31 CallStack(); |
32 virtual ~CallStack() {} | 32 virtual ~CallStack() {} |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
158 | 158 |
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_COPY_AND_ASSIGN(AllocationStack); | 165 DISALLOW_COPY_AND_ASSIGN(AllocationStack); |
166 }; | 166 }; |
167 | 167 |
168 #endif // MEMORY_WATCHER_CALL_STACK_H_ | 168 #endif // TOOLS_MEMORY_WATCHER_CALL_STACK_H_ |
OLD | NEW |