• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright (c) 2018 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #ifndef THIRD_PARTY_BASE_ALLOCATOR_PARTITION_ALLOCATOR_PARTITION_DIRECT_MAP_EXTENT_H_
6 #define THIRD_PARTY_BASE_ALLOCATOR_PARTITION_ALLOCATOR_PARTITION_DIRECT_MAP_EXTENT_H_
7 
8 #include "third_party/base/allocator/partition_allocator/partition_bucket.h"
9 #include "third_party/base/allocator/partition_allocator/partition_page.h"
10 
11 namespace pdfium {
12 namespace base {
13 namespace internal {
14 
15 struct PartitionDirectMapExtent {
16   PartitionDirectMapExtent* next_extent;
17   PartitionDirectMapExtent* prev_extent;
18   PartitionBucket* bucket;
19   size_t map_size;  // Mapped size, not including guard pages and meta-data.
20 
21   ALWAYS_INLINE static PartitionDirectMapExtent* FromPage(PartitionPage* page);
22 };
23 
FromPage(PartitionPage * page)24 ALWAYS_INLINE PartitionDirectMapExtent* PartitionDirectMapExtent::FromPage(
25     PartitionPage* page) {
26   DCHECK(page->bucket->is_direct_mapped());
27   return reinterpret_cast<PartitionDirectMapExtent*>(
28       reinterpret_cast<char*>(page) + 3 * kPageMetadataSize);
29 }
30 
31 }  // namespace internal
32 }  // namespace base
33 }  // namespace pdfium
34 
35 #endif  // THIRD_PARTY_BASE_ALLOCATOR_PARTITION_ALLOCATOR_PARTITION_DIRECT_MAP_EXTENT_H_
36