OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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/process/memory.h" | 5 #include "base/process/memory.h" |
6 | 6 |
7 #include <psapi.h> | 7 #include <psapi.h> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 HMODULE instance = NULL; | 75 HMODULE instance = NULL; |
76 if (!::GetModuleHandleExA(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS | | 76 if (!::GetModuleHandleExA(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS | |
77 GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT, | 77 GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT, |
78 static_cast<char*>(address), | 78 static_cast<char*>(address), |
79 &instance)) { | 79 &instance)) { |
80 NOTREACHED(); | 80 NOTREACHED(); |
81 } | 81 } |
82 return instance; | 82 return instance; |
83 } | 83 } |
84 | 84 |
| 85 #if defined(WIN_USE_ALLOCATOR_SHIM) |
| 86 void allocator_shim_try_malloc(size_t) __THROW; |
| 87 #endif |
| 88 |
| 89 void* UncheckedMalloc(size_t size) { |
| 90 #if defined(WIN_USE_ALLOCATOR_SHIM) |
| 91 return allocator_shim_try_malloc(size); |
| 92 #else |
| 93 return malloc(size); |
| 94 #endif |
| 95 } |
| 96 |
85 } // namespace base | 97 } // namespace base |
OLD | NEW |