diff options
author | Alex Vakulenko <avakulenko@google.com> | 2016-01-22 16:55:13 -0800 |
---|---|---|
committer | Alex Vakulenko <avakulenko@google.com> | 2016-01-22 17:02:35 -0800 |
commit | 24854748fba09df2a29f0d08d558c3acea70e7a1 (patch) | |
tree | 6875ebc8be0aa8b70ebb56ab485520c9484bc7e0 /base | |
parent | f6024733c0d1eed88f68520b5e6a20b96e212ad6 (diff) | |
download | libchrome-24854748fba09df2a29f0d08d558c3acea70e7a1.tar.gz |
libchrome: Fix libchrome build on Chrome OS
Applying libchrome r369476 changes to Chrome OS-only files from the
upstream of libchrome (from Chromium).
Also modified SConstruct to add new files and remove deleted files.
Change-Id: Id22160e32d19b0bb228903e3df372fb82550626c
Diffstat (limited to 'base')
-rw-r--r-- | base/allocator/allocator_extension.cc | 48 | ||||
-rw-r--r-- | base/timer/mock_timer_unittest.cc | 1 |
2 files changed, 17 insertions, 32 deletions
diff --git a/base/allocator/allocator_extension.cc b/base/allocator/allocator_extension.cc index 83e460ac82..4f0b3a9003 100644 --- a/base/allocator/allocator_extension.cc +++ b/base/allocator/allocator_extension.cc @@ -9,47 +9,31 @@ namespace base { namespace allocator { -bool GetAllocatorWasteSize(size_t* size) { - thunks::GetAllocatorWasteSizeFunction get_allocator_waste_size_function = - thunks::GetGetAllocatorWasteSizeFunction(); - return get_allocator_waste_size_function != NULL && - get_allocator_waste_size_function(size); -} - -void GetStats(char* buffer, int buffer_length) { - DCHECK_GT(buffer_length, 0); - thunks::GetStatsFunction get_stats_function = thunks::GetGetStatsFunction(); - if (get_stats_function) - get_stats_function(buffer, buffer_length); - else - buffer[0] = '\0'; +namespace { +ReleaseFreeMemoryFunction g_release_free_memory_function = nullptr; +GetNumericPropertyFunction g_get_numeric_property_function = nullptr; } void ReleaseFreeMemory() { - thunks::ReleaseFreeMemoryFunction release_free_memory_function = - thunks::GetReleaseFreeMemoryFunction(); - if (release_free_memory_function) - release_free_memory_function(); + if (g_release_free_memory_function) + g_release_free_memory_function(); } -void SetGetAllocatorWasteSizeFunction( - thunks::GetAllocatorWasteSizeFunction get_allocator_waste_size_function) { - DCHECK_EQ(thunks::GetGetAllocatorWasteSizeFunction(), - reinterpret_cast<thunks::GetAllocatorWasteSizeFunction>(NULL)); - thunks::SetGetAllocatorWasteSizeFunction(get_allocator_waste_size_function); +bool GetNumericProperty(const char* name, size_t* value) { + return g_get_numeric_property_function && + g_get_numeric_property_function(name, value); } -void SetGetStatsFunction(thunks::GetStatsFunction get_stats_function) { - DCHECK_EQ(thunks::GetGetStatsFunction(), - reinterpret_cast<thunks::GetStatsFunction>(NULL)); - thunks::SetGetStatsFunction(get_stats_function); +void SetReleaseFreeMemoryFunction( + ReleaseFreeMemoryFunction release_free_memory_function) { + DCHECK(!g_release_free_memory_function); + g_release_free_memory_function = release_free_memory_function; } -void SetReleaseFreeMemoryFunction( - thunks::ReleaseFreeMemoryFunction release_free_memory_function) { - DCHECK_EQ(thunks::GetReleaseFreeMemoryFunction(), - reinterpret_cast<thunks::ReleaseFreeMemoryFunction>(NULL)); - thunks::SetReleaseFreeMemoryFunction(release_free_memory_function); +void SetGetNumericPropertyFunction( + GetNumericPropertyFunction get_numeric_property_function) { + DCHECK(!g_get_numeric_property_function); + g_get_numeric_property_function = get_numeric_property_function; } } // namespace allocator diff --git a/base/timer/mock_timer_unittest.cc b/base/timer/mock_timer_unittest.cc index f6b6953648..a38981513a 100644 --- a/base/timer/mock_timer_unittest.cc +++ b/base/timer/mock_timer_unittest.cc @@ -4,6 +4,7 @@ #include "base/timer/mock_timer.h" +#include "base/macros.h" #include "testing/gtest/include/gtest/gtest.h" namespace { |