Commit 042e90ea authored by Wang Qing's avatar Wang Qing Committed by Commit Bot

Fix compile error about base_unittests on Loongson.

This CL fixes the build error with the following message:
     ../../base/allocator/partition_allocator/partition_alloc_unittest.cc: In member function ‘virtual void base::internal::PartitionAllocTest_PurgeDiscardable_Test::TestBody()’:
     ../../base/allocator/partition_allocator/partition_alloc_unittest.cc:1905:42: error: ‘PartitionAllocGeneric’ was not declared in this scope
          char* ptr1 = reinterpret_cast<char*>(PartitionAllocGeneric(
                                          ^~~~~~~~~~~~~~~~~~~~~
     ../../base/allocator/partition_allocator/partition_alloc_unittest.cc:1905:42: note: suggested alternative: ‘PartitionAllocatorGeneric’
          char* ptr1 = reinterpret_cast<char*>(PartitionAllocGeneric(
                                          ^~~~~~~~~~~~~~~~~~~~~
                                          PartitionAllocatorGeneric
     ../../base/allocator/partition_allocator/partition_alloc_unittest.cc:1909:5: error: ‘PartitionFreeGeneric’ was not declared in this scope
          PartitionFreeGeneric(generic_allocator.root(), ptr1);

Bug= 859785

R= haraken@chromium.org

Change-Id: I6e06534ba78fa7a3742ec3585502d60943374b1a
Reviewed-on: https://chromium-review.googlesource.com/1123931Reviewed-by: default avatarKentaro Hara <haraken@chromium.org>
Commit-Queue: 汪 清 <wangqing-hf@loongson.cn>
Cr-Commit-Position: refs/heads/master@{#572150}
parent 11c9826a
...@@ -1902,19 +1902,16 @@ TEST_F(PartitionAllocTest, PurgeDiscardable) { ...@@ -1902,19 +1902,16 @@ TEST_F(PartitionAllocTest, PurgeDiscardable) {
// for clarity of purpose and for applicability to more architectures. // for clarity of purpose and for applicability to more architectures.
#if defined(_MIPS_ARCH_LOONGSON) #if defined(_MIPS_ARCH_LOONGSON)
{ {
char* ptr1 = reinterpret_cast<char*>(PartitionAllocGeneric( char* ptr1 = reinterpret_cast<char*>(generic_allocator.root()->Alloc(
generic_allocator.root(), (32 * kSystemPageSize) - kExtraAllocSize, (32 * kSystemPageSize) - kExtraAllocSize, type_name));
type_name));
memset(ptr1, 'A', (32 * kSystemPageSize) - kExtraAllocSize); memset(ptr1, 'A', (32 * kSystemPageSize) - kExtraAllocSize);
PartitionFreeGeneric(generic_allocator.root(), ptr1); generic_allocator.root()->Free(ptr1);
ptr1 = reinterpret_cast<char*>(PartitionAllocGeneric( ptr1 = reinterpret_cast<char*>(generic_allocator.root()->Alloc(
generic_allocator.root(), (31 * kSystemPageSize) - kExtraAllocSize, (31 * kSystemPageSize) - kExtraAllocSize, type_name));
type_name));
{ {
MockPartitionStatsDumper dumper; MockPartitionStatsDumper dumper;
PartitionDumpStatsGeneric(generic_allocator.root(), generic_allocator.root()->DumpStats("mock_generic_allocator",
"mock_generic_allocator", false /* detailed dump */, &dumper);
false /* detailed dump */, &dumper);
EXPECT_TRUE(dumper.IsMemoryAllocationRecorded()); EXPECT_TRUE(dumper.IsMemoryAllocationRecorded());
const PartitionBucketMemoryStats* stats = const PartitionBucketMemoryStats* stats =
...@@ -1928,12 +1925,12 @@ TEST_F(PartitionAllocTest, PurgeDiscardable) { ...@@ -1928,12 +1925,12 @@ TEST_F(PartitionAllocTest, PurgeDiscardable) {
} }
CheckPageInCore(ptr1 - kPointerOffset + (kSystemPageSize * 30), true); CheckPageInCore(ptr1 - kPointerOffset + (kSystemPageSize * 30), true);
CheckPageInCore(ptr1 - kPointerOffset + (kSystemPageSize * 31), true); CheckPageInCore(ptr1 - kPointerOffset + (kSystemPageSize * 31), true);
PartitionPurgeMemoryGeneric(generic_allocator.root(), generic_allocator.root()->PurgeMemory(
PartitionPurgeDiscardUnusedSystemPages); PartitionPurgeDiscardUnusedSystemPages);
CheckPageInCore(ptr1 - kPointerOffset + (kSystemPageSize * 30), true); CheckPageInCore(ptr1 - kPointerOffset + (kSystemPageSize * 30), true);
CheckPageInCore(ptr1 - kPointerOffset + (kSystemPageSize * 31), false); CheckPageInCore(ptr1 - kPointerOffset + (kSystemPageSize * 31), false);
PartitionFreeGeneric(generic_allocator.root(), ptr1); generic_allocator.root()->Free(ptr1);
} }
#else #else
{ {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment