Skip to content

Commit

Permalink
[PA] Namespace migration (27 of N)
Browse files Browse the repository at this point in the history
This CL migrates *Scan's `StateBitmap` into the `partition_alloc`
namespace. This affords us a small tweak in `partition_page`, where a
previous use of (::base::internal::)StateBitmap can be unqualified.

Bug: 1288247
Change-Id: I7ba5320582877fabfdb1b09e0b3902b5d9dc8071
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3557870
Reviewed-by: Bartek Nowierski <bartekn@chromium.org>
Reviewed-by: Yuki Shiino <yukishiino@chromium.org>
Commit-Queue: Kalvin Lee <kdlee@chromium.org>
Cr-Commit-Position: refs/heads/main@{#988274}
  • Loading branch information
Kalvin Lee authored and Chromium LUCI CQ committed Apr 2, 2022
1 parent 24be4d9 commit c8cfb94
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 10 deletions.
2 changes: 1 addition & 1 deletion base/allocator/partition_allocator/partition_page.h
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ ALWAYS_INLINE uintptr_t SuperPagesEndFromExtent(
(extent->number_of_consecutive_super_pages * kSuperPageSize);
}

using AllocationStateMap = ::base::internal::
using AllocationStateMap =
StateBitmap<kSuperPageSize, kSuperPageAlignment, kAlignment>;

// Metadata of the slot span.
Expand Down
8 changes: 3 additions & 5 deletions base/allocator/partition_allocator/starscan/state_bitmap.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@
#include "base/bits.h"
#include "base/compiler_specific.h"

namespace base {
namespace internal {
namespace partition_alloc::internal {

// Bitmap which tracks allocation states. An allocation can be in one of 3
// states:
Expand Down Expand Up @@ -70,7 +69,7 @@ class StateBitmap final {
using CellType = uintptr_t;
static constexpr size_t kBitsPerCell = sizeof(CellType) * CHAR_BIT;
static constexpr size_t kBitsNeededForAllocation =
bits::Log2Floor(static_cast<size_t>(State::kNumOfStates));
base::bits::Log2Floor(static_cast<size_t>(State::kNumOfStates));
static constexpr CellType kStateMask = (1 << kBitsNeededForAllocation) - 1;

static constexpr size_t kBitmapSize =
Expand Down Expand Up @@ -483,7 +482,6 @@ void StateBitmap<PageSize, PageAlignment, AllocationAlignment>::Clear() {
std::fill(bitmap_.begin(), bitmap_.end(), '\0');
}

} // namespace internal
} // namespace base
} // namespace partition_alloc::internal

#endif // BASE_ALLOCATOR_PARTITION_ALLOCATOR_STARSCAN_STATE_BITMAP_H_
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@
#include "base/allocator/partition_allocator/partition_alloc_constants.h"
#include "testing/gtest/include/gtest/gtest.h"

namespace base {
namespace internal {
namespace partition_alloc::internal {

namespace {

Expand Down Expand Up @@ -340,5 +339,4 @@ TEST_F(PartitionAllocStateBitmapTest, AdjacentQuarantinedObjectsAtEnd) {
}
}

} // namespace internal
} // namespace base
} // namespace partition_alloc::internal

0 comments on commit c8cfb94

Please sign in to comment.