OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #include "base/allocator/allocator_extension.h" | 5 #include "base/allocator/allocator_extension.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 | 8 |
9 namespace base { | 9 namespace base { |
10 namespace allocator { | 10 namespace allocator { |
11 | 11 |
12 namespace { | |
13 ReleaseFreeMemoryFunction g_release_free_memory_function = NULL; | |
Primiano Tucci (use gerrit)
2015/12/02 13:50:42
s/NULL/nullptr/ since you are touching this file y
ssid
2015/12/02 14:03:34
Done.
| |
14 GetNumericPropertyFunction g_get_numeric_property_function = NULL; | |
15 } | |
16 | |
12 void ReleaseFreeMemory() { | 17 void ReleaseFreeMemory() { |
13 thunks::ReleaseFreeMemoryFunction release_free_memory_function = | 18 if (g_release_free_memory_function) |
14 thunks::GetReleaseFreeMemoryFunction(); | 19 g_release_free_memory_function(); |
15 if (release_free_memory_function) | 20 } |
16 release_free_memory_function(); | 21 |
22 bool GetNumericProperty(const char* name, size_t* value) { | |
23 return g_get_numeric_property_function != NULL && | |
Primiano Tucci (use gerrit)
2015/12/02 13:50:42
s/!= NULL//
ssid
2015/12/02 14:03:34
Done.
| |
24 g_get_numeric_property_function(name, value); | |
17 } | 25 } |
18 | 26 |
19 void SetReleaseFreeMemoryFunction( | 27 void SetReleaseFreeMemoryFunction( |
20 thunks::ReleaseFreeMemoryFunction release_free_memory_function) { | 28 ReleaseFreeMemoryFunction release_free_memory_function) { |
21 DCHECK_EQ(thunks::GetReleaseFreeMemoryFunction(), | 29 DCHECK_EQ(g_release_free_memory_function, |
22 reinterpret_cast<thunks::ReleaseFreeMemoryFunction>(NULL)); | 30 reinterpret_cast<ReleaseFreeMemoryFunction>(NULL)); |
23 thunks::SetReleaseFreeMemoryFunction(release_free_memory_function); | 31 g_release_free_memory_function = release_free_memory_function; |
24 } | 32 } |
25 | 33 |
26 void SetGetNumericPropertyFunction( | 34 void SetGetNumericPropertyFunction( |
27 thunks::GetNumericPropertyFunction get_numeric_property_function) { | 35 GetNumericPropertyFunction get_numeric_property_function) { |
28 DCHECK_EQ(thunks::GetGetNumericPropertyFunction(), | 36 DCHECK_EQ(g_get_numeric_property_function, |
29 reinterpret_cast<thunks::GetNumericPropertyFunction>(NULL)); | 37 reinterpret_cast<GetNumericPropertyFunction>(NULL)); |
30 thunks::SetGetNumericPropertyFunction(get_numeric_property_function); | 38 g_get_numeric_property_function = get_numeric_property_function; |
31 } | 39 } |
32 | 40 |
33 } // namespace allocator | 41 } // namespace allocator |
34 } // namespace base | 42 } // namespace base |
OLD | NEW |