summaryrefslogtreecommitdiff
path: root/third_party
diff options
context:
space:
mode:
authorWang Qing <wangqing-hf@loongson.cn>2018-01-16 15:57:25 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-01-16 15:57:25 +0000
commitd3427164e7869ee9c22fcb843ab619b247cbed72 (patch)
tree1ff47e90952ed4f51f166b1ab244f8869d2b33ba /third_party
parent316dd2fcd64d0cda1e1b2cdc39ca541a57766b35 (diff)
downloadpdfium-d3427164e7869ee9c22fcb843ab619b247cbed72.tar.xz
Add support for pdfium use partitionalloc on loongson platform.
Because system pagesize is 4K on general system, such as x86 etc. But Loongson have 16K system pagesize and unable to print pages with use print preview. Therefore, the relevant pagesize places needs to be changed. Also refer to: https://chromium.googlesource.com/chromium/src/+/0752dbc988222d7edef2ef7c4e19555089c35fdf Bug: 801045 R= palmer@chromium.org Change-Id: Icc5ceae7b8a66be0ced1abb448a80c23fa518f34 Reviewed-on: https://pdfium-review.googlesource.com/22735 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
Diffstat (limited to 'third_party')
-rw-r--r--third_party/base/allocator/partition_allocator/page_allocator.h7
-rw-r--r--third_party/base/allocator/partition_allocator/partition_alloc.h4
2 files changed, 11 insertions, 0 deletions
diff --git a/third_party/base/allocator/partition_allocator/page_allocator.h b/third_party/base/allocator/partition_allocator/page_allocator.h
index be733634c7..aee2532485 100644
--- a/third_party/base/allocator/partition_allocator/page_allocator.h
+++ b/third_party/base/allocator/partition_allocator/page_allocator.h
@@ -18,6 +18,8 @@ namespace base {
#if defined(OS_WIN)
static const size_t kPageAllocationGranularityShift = 16; // 64KB
+#elif defined(_MIPS_ARCH_LOONGSON)
+static const size_t kPageAllocationGranularityShift = 14; // 16KB
#else
static const size_t kPageAllocationGranularityShift = 12; // 4KB
#endif
@@ -30,7 +32,12 @@ static const size_t kPageAllocationGranularityBaseMask =
// All Blink-supported systems have 4096 sized system pages and can handle
// permissions and commit / decommit at this granularity.
+// Loongson have 16384 sized system pages.
+#if defined(_MIPS_ARCH_LOONGSON)
+static const size_t kSystemPageSize = 16384;
+#else
static const size_t kSystemPageSize = 4096;
+#endif
static const size_t kSystemPageOffsetMask = kSystemPageSize - 1;
static const size_t kSystemPageBaseMask = ~kSystemPageOffsetMask;
diff --git a/third_party/base/allocator/partition_allocator/partition_alloc.h b/third_party/base/allocator/partition_allocator/partition_alloc.h
index 5832b9f4be..7e8415c760 100644
--- a/third_party/base/allocator/partition_allocator/partition_alloc.h
+++ b/third_party/base/allocator/partition_allocator/partition_alloc.h
@@ -95,7 +95,11 @@ static const size_t kBucketShift = (kAllocationGranularity == 8) ? 3 : 2;
// system page of the span. For our current max slot span size of 64k and other
// constant values, we pack _all_ PartitionAllocGeneric() sizes perfectly up
// against the end of a system page.
+#if defined(_MIPS_ARCH_LOONGSON)
+static const size_t kPartitionPageShift = 16; // 64KB
+#else
static const size_t kPartitionPageShift = 14; // 16KB
+#endif
static const size_t kPartitionPageSize = 1 << kPartitionPageShift;
static const size_t kPartitionPageOffsetMask = kPartitionPageSize - 1;
static const size_t kPartitionPageBaseMask = ~kPartitionPageOffsetMask;