OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 // Functions used to debug memory usage, leaks, and other memory issues. | 5 // Functions used to debug memory usage, leaks, and other memory issues. |
6 // All methods are effectively no-ops unless this program is being run through | 6 // All methods are effectively no-ops unless this program is being run through |
7 // a supported memory tool (currently, only Purify) | 7 // a supported memory tool (currently, only Purify) |
8 | 8 |
9 #ifndef BASE_MEMORY_DEBUG_H_ | 9 #ifndef BASE_MEMORY_DEBUG_H_ |
10 #define BASE_MEMORY_DEBUG_H_ | 10 #define BASE_MEMORY_DEBUG_H_ |
11 #pragma once | 11 #pragma once |
12 | 12 |
| 13 #include "base/base_api.h" |
13 #include "base/basictypes.h" | 14 #include "base/basictypes.h" |
14 | 15 |
15 namespace base { | 16 namespace base { |
16 | 17 |
17 class MemoryDebug { | 18 class BASE_API MemoryDebug { |
18 public: | 19 public: |
19 // Since MIU messages are a lot of data, and we don't always want this data, | 20 // Since MIU messages are a lot of data, and we don't always want this data, |
20 // we have a global switch. If disabled, *MemoryInUse are no-ops. | 21 // we have a global switch. If disabled, *MemoryInUse are no-ops. |
21 static void SetMemoryInUseEnabled(bool enabled); | 22 static void SetMemoryInUseEnabled(bool enabled); |
22 | 23 |
23 // Dump information about all memory in use. | 24 // Dump information about all memory in use. |
24 static void DumpAllMemoryInUse(); | 25 static void DumpAllMemoryInUse(); |
25 // Dump information about new memory in use since the last | 26 // Dump information about new memory in use since the last |
26 // call to DumpAllMemoryInUse() or DumpNewMemoryInUse(). | 27 // call to DumpAllMemoryInUse() or DumpNewMemoryInUse(). |
27 static void DumpNewMemoryInUse(); | 28 static void DumpNewMemoryInUse(); |
(...skipping 10 matching lines...) Expand all Loading... |
38 | 39 |
39 private: | 40 private: |
40 static bool memory_in_use_; | 41 static bool memory_in_use_; |
41 | 42 |
42 DISALLOW_IMPLICIT_CONSTRUCTORS(MemoryDebug); | 43 DISALLOW_IMPLICIT_CONSTRUCTORS(MemoryDebug); |
43 }; | 44 }; |
44 | 45 |
45 } // namespace base | 46 } // namespace base |
46 | 47 |
47 #endif // BASE_MEMORY_DEBUG_H_ | 48 #endif // BASE_MEMORY_DEBUG_H_ |
OLD | NEW |