Skip to content

Commit

Permalink
Revert "Move and rename macOS+iOS base/ files in PA to "apple""
Browse files Browse the repository at this point in the history
This reverts commit 31d8fb4.

Reason for revert: Broke https://ci.chromium.org/ui/p/chromium/builders/ci/Linux%20Builder/174944/overview

Original change's description:
> Move and rename macOS+iOS base/ files in PA to "apple"
>
> Bypasses trybots to avoid an existing checkdeps failure.
>
> Bug: 1444927
> Change-Id: I658a5f88106001500a90a7930a1688a1679fbe5c
> No-Presubmit: true
> No-Try: true
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4781926
> Reviewed-by: Mark Mentovai <mark@chromium.org>
> Auto-Submit: Avi Drissman <avi@chromium.org>
> Owners-Override: Avi Drissman <avi@chromium.org>
> Commit-Queue: Mark Mentovai <mark@chromium.org>
> Cr-Commit-Position: refs/heads/main@{#1184344}

Bug: 1444927
Change-Id: Ib9cc114e7af0ab56b1c2d1cace860245344a5ac5
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4787467
Owners-Override: Darren Shen <shend@chromium.org>
Auto-Submit: Darren Shen <shend@chromium.org>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Commit-Queue: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Cr-Commit-Position: refs/heads/main@{#1184461}
  • Loading branch information
darrnshn authored and Chromium LUCI CQ committed Aug 16, 2023
1 parent a5db950 commit 664931b
Show file tree
Hide file tree
Showing 26 changed files with 84 additions and 91 deletions.
8 changes: 4 additions & 4 deletions base/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -3726,8 +3726,8 @@ test("base_unittests") {

if (is_mac) {
sources += [
"allocator/partition_allocator/shim/allocator_interception_apple_unittest.mm",
"allocator/partition_allocator/shim/malloc_zone_functions_apple_unittest.cc",
"allocator/partition_allocator/shim/allocator_interception_mac_unittest.mm",
"allocator/partition_allocator/shim/malloc_zone_functions_mac_unittest.cc",
"apple/call_with_eh_frame_unittest.mm",
"apple/scoped_mach_vm_unittest.cc",
"apple/scoped_objc_class_swizzler_unittest.mm",
Expand Down Expand Up @@ -3783,8 +3783,8 @@ test("base_unittests") {

if (use_allocator_shim) {
sources += [
"allocator/partition_allocator/shim/allocator_interception_apple_unittest.mm",
"allocator/partition_allocator/shim/malloc_zone_functions_apple_unittest.cc",
"allocator/partition_allocator/shim/allocator_interception_mac_unittest.mm",
"allocator/partition_allocator/shim/malloc_zone_functions_mac_unittest.cc",
]
}

Expand Down
2 changes: 1 addition & 1 deletion base/allocator/allocator_check.cc
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#endif

#if BUILDFLAG(IS_APPLE)
#include "base/allocator/partition_allocator/shim/allocator_interception_apple.h"
#include "base/allocator/partition_allocator/shim/allocator_interception_mac.h"
#endif

namespace base::allocator {
Expand Down
28 changes: 14 additions & 14 deletions base/allocator/partition_allocator/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -422,7 +422,7 @@ source_set("allocator_base") {
sources += [ "partition_alloc_base/time/time_android.cc" ]
}
if (is_apple) {
sources += [ "partition_alloc_base/time/time_apple.mm" ]
sources += [ "partition_alloc_base/time/time_mac.mm" ]
} else {
sources += [ "partition_alloc_base/time/time_now_posix.cc" ]
}
Expand Down Expand Up @@ -454,12 +454,12 @@ source_set("allocator_base") {
if (is_apple) {
# Apple-specific utilities
sources += [
"partition_alloc_base/apple/foundation_util.h",
"partition_alloc_base/apple/foundation_util.mm",
"partition_alloc_base/apple/mach_logging.cc",
"partition_alloc_base/apple/mach_logging.h",
"partition_alloc_base/apple/scoped_cftyperef.h",
"partition_alloc_base/apple/scoped_typeref.h",
"partition_alloc_base/mac/foundation_util.h",
"partition_alloc_base/mac/foundation_util.mm",
"partition_alloc_base/mac/mach_logging.cc",
"partition_alloc_base/mac/mach_logging.h",
"partition_alloc_base/mac/scoped_cftyperef.h",
"partition_alloc_base/mac/scoped_typeref.h",
]
if (is_ios) {
sources += [
Expand Down Expand Up @@ -537,8 +537,8 @@ source_set("allocator_shim") {
}
if (is_apple) {
sources += [
"shim/allocator_shim_override_apple_default_zone.h",
"shim/allocator_shim_override_apple_symbols.h",
"shim/allocator_shim_override_mac_default_zone.h",
"shim/allocator_shim_override_mac_symbols.h",
"shim/early_zone_registration_constants.h",
]
configs += [ ":mac_no_default_new_delete_symbols" ]
Expand Down Expand Up @@ -566,7 +566,7 @@ source_set("allocator_shim") {
}
if (is_apple) {
sources +=
[ "shim/allocator_shim_default_dispatch_to_apple_zoned_malloc.cc" ]
[ "shim/allocator_shim_default_dispatch_to_mac_zoned_malloc.cc" ]
}
if (is_chromeos || is_linux) {
sources += [ "shim/allocator_shim_default_dispatch_to_glibc.cc" ]
Expand All @@ -585,10 +585,10 @@ source_set("allocator_shim") {

if (is_apple) {
sources += [
"shim/allocator_interception_apple.h",
"shim/allocator_interception_apple.mm",
"shim/malloc_zone_functions_apple.cc",
"shim/malloc_zone_functions_apple.h",
"shim/allocator_interception_mac.h",
"shim/allocator_interception_mac.mm",
"shim/malloc_zone_functions_mac.cc",
"shim/malloc_zone_functions_mac.h",
]

# Do not compile with ARC because this target has to interface with
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,15 @@
#include "build/build_config.h"

#if BUILDFLAG(IS_APPLE)
#include "base/allocator/partition_allocator/partition_alloc_base/apple/foundation_util.h"
#include "base/allocator/partition_allocator/partition_alloc_base/mac/foundation_util.h"
#if BUILDFLAG(IS_IOS)
#include "base/allocator/partition_allocator/partition_alloc_base/ios/ios_util.h"
#elif BUILDFLAG(IS_MAC)
#include "base/allocator/partition_allocator/partition_alloc_base/mac/mac_util.h"
#else
#error "Unknown platform"
#endif
#include "base/allocator/partition_allocator/partition_alloc_base/apple/scoped_cftyperef.h"
#include "base/allocator/partition_allocator/partition_alloc_base/mac/scoped_cftyperef.h"

#include <Availability.h>
#include <Security/Security.h>
Expand Down Expand Up @@ -141,7 +141,7 @@ bool UseMapJit() {
return false;
}

return base::apple::CFCast<CFBooleanRef>(jit_entitlement.get()) ==
return base::mac::CFCast<CFBooleanRef>(jit_entitlement.get()) ==
kCFBooleanTrue;
}
#elif BUILDFLAG(IS_IOS)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef BASE_ALLOCATOR_PARTITION_ALLOCATOR_PARTITION_ALLOC_BASE_APPLE_FOUNDATION_UTIL_H_
#define BASE_ALLOCATOR_PARTITION_ALLOCATOR_PARTITION_ALLOC_BASE_APPLE_FOUNDATION_UTIL_H_
#ifndef BASE_ALLOCATOR_PARTITION_ALLOCATOR_PARTITION_ALLOC_BASE_MAC_FOUNDATION_UTIL_H_
#define BASE_ALLOCATOR_PARTITION_ALLOCATOR_PARTITION_ALLOC_BASE_MAC_FOUNDATION_UTIL_H_

#include <CoreFoundation/CoreFoundation.h>

namespace partition_alloc::internal::base::apple {
namespace partition_alloc::internal::base::mac {

// CFCast<>() and CFCastStrict<>() cast a basic CFTypeRef to a more
// specific CoreFoundation type. The compatibility of the passed
Expand Down Expand Up @@ -53,6 +53,6 @@ PA_CF_CAST_DECL(CFUUID);

#undef PA_CF_CAST_DECL

} // namespace partition_alloc::internal::base::apple
} // namespace partition_alloc::internal::base::mac

#endif // BASE_ALLOCATOR_PARTITION_ALLOCATOR_PARTITION_ALLOC_BASE_APPLE_FOUNDATION_UTIL_H_
#endif // BASE_ALLOCATOR_PARTITION_ALLOCATOR_PARTITION_ALLOC_BASE_MAC_FOUNDATION_UTIL_H_
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "base/allocator/partition_allocator/partition_alloc_base/apple/foundation_util.h"
#include "base/allocator/partition_allocator/partition_alloc_base/mac/foundation_util.h"

#include "base/allocator/partition_allocator/partition_alloc_base/check.h"

namespace partition_alloc::internal::base::apple {
namespace partition_alloc::internal::base::mac {

#define PA_CF_CAST_DEFN(TypeCF) \
template <> \
Expand Down Expand Up @@ -42,4 +42,4 @@

#undef PA_CF_CAST_DEFN

} // namespace partition_alloc::internal::base::apple
} // namespace partition_alloc::internal::base::mac
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "base/allocator/partition_allocator/partition_alloc_base/apple/mach_logging.h"
#include "base/allocator/partition_allocator/partition_alloc_base/mac/mach_logging.h"

#include <iomanip>
#include <string>

#include "base/allocator/partition_allocator/partition_alloc_base/strings/stringprintf.h"
#include "build/build_config.h"

namespace {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef BASE_ALLOCATOR_PARTITION_ALLOCATOR_PARTITION_ALLOC_BASE_APPLE_MACH_LOGGING_H_
#define BASE_ALLOCATOR_PARTITION_ALLOCATOR_PARTITION_ALLOC_BASE_APPLE_MACH_LOGGING_H_
#ifndef BASE_ALLOCATOR_PARTITION_ALLOCATOR_PARTITION_ALLOC_BASE_MAC_MACH_LOGGING_H_
#define BASE_ALLOCATOR_PARTITION_ALLOCATOR_PARTITION_ALLOC_BASE_MAC_MACH_LOGGING_H_

#include <mach/mach.h>

Expand Down Expand Up @@ -96,4 +96,4 @@ class PA_COMPONENT_EXPORT(PARTITION_ALLOC) MachLogMessage
BUILDFLAG(PA_DCHECK_IS_ON) && !(condition)) \
<< "Check failed: " #condition << ". "

#endif // BASE_ALLOCATOR_PARTITION_ALLOCATOR_PARTITION_ALLOC_BASE_APPLE_MACH_LOGGING_H_
#endif // BASE_ALLOCATOR_PARTITION_ALLOCATOR_PARTITION_ALLOC_BASE_MAC_MACH_LOGGING_H_
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef BASE_ALLOCATOR_PARTITION_ALLOCATOR_PARTITION_ALLOC_BASE_APPLE_SCOPED_CFTYPEREF_H_
#define BASE_ALLOCATOR_PARTITION_ALLOCATOR_PARTITION_ALLOC_BASE_APPLE_SCOPED_CFTYPEREF_H_
#ifndef BASE_ALLOCATOR_PARTITION_ALLOCATOR_PARTITION_ALLOC_BASE_MAC_SCOPED_CFTYPEREF_H_
#define BASE_ALLOCATOR_PARTITION_ALLOCATOR_PARTITION_ALLOC_BASE_MAC_SCOPED_CFTYPEREF_H_

#include <CoreFoundation/CoreFoundation.h>

#include "base/allocator/partition_allocator/partition_alloc_base/apple/scoped_typeref.h"
#include "base/allocator/partition_allocator/partition_alloc_base/mac/scoped_typeref.h"

namespace partition_alloc::internal::base {

Expand Down Expand Up @@ -45,4 +45,4 @@ using ScopedCFTypeRef =

} // namespace partition_alloc::internal::base

#endif // BASE_ALLOCATOR_PARTITION_ALLOCATOR_PARTITION_ALLOC_BASE_APPLE_SCOPED_CFTYPEREF_H_
#endif // BASE_ALLOCATOR_PARTITION_ALLOCATOR_PARTITION_ALLOC_BASE_MAC_SCOPED_CFTYPEREF_H_
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef BASE_ALLOCATOR_PARTITION_ALLOCATOR_PARTITION_ALLOC_BASE_APPLE_SCOPED_TYPEREF_H_
#define BASE_ALLOCATOR_PARTITION_ALLOCATOR_PARTITION_ALLOC_BASE_APPLE_SCOPED_TYPEREF_H_
#ifndef BASE_ALLOCATOR_PARTITION_ALLOCATOR_PARTITION_ALLOC_BASE_MAC_SCOPED_TYPEREF_H_
#define BASE_ALLOCATOR_PARTITION_ALLOCATOR_PARTITION_ALLOC_BASE_MAC_SCOPED_TYPEREF_H_

#include "base/allocator/partition_allocator/partition_alloc_base/check.h"
#include "base/allocator/partition_allocator/partition_alloc_base/memory/scoped_policy.h"
Expand Down Expand Up @@ -56,34 +56,30 @@ class ScopedTypeRef {
element_type object = Traits::InvalidValue(),
base::scoped_policy::OwnershipPolicy policy = base::scoped_policy::ASSUME)
: object_(object) {
if (object_ && policy == base::scoped_policy::RETAIN) {
if (object_ && policy == base::scoped_policy::RETAIN)
object_ = Traits::Retain(object_);
}
}

ScopedTypeRef(const ScopedTypeRef<T, Traits>& that) : object_(that.object_) {
if (object_) {
if (object_)
object_ = Traits::Retain(object_);
}
}

// This allows passing an object to a function that takes its superclass.
template <typename R, typename RTraits>
explicit ScopedTypeRef(const ScopedTypeRef<R, RTraits>& that_as_subclass)
: object_(that_as_subclass.get()) {
if (object_) {
if (object_)
object_ = Traits::Retain(object_);
}
}

ScopedTypeRef(ScopedTypeRef<T, Traits>&& that) : object_(that.object_) {
that.object_ = Traits::InvalidValue();
}

~ScopedTypeRef() {
if (object_) {
if (object_)
Traits::Release(object_);
}
}

ScopedTypeRef& operator=(const ScopedTypeRef<T, Traits>& that) {
Expand All @@ -106,12 +102,10 @@ class ScopedTypeRef {
void reset(element_type object = Traits::InvalidValue(),
base::scoped_policy::OwnershipPolicy policy =
base::scoped_policy::ASSUME) {
if (object && policy == base::scoped_policy::RETAIN) {
if (object && policy == base::scoped_policy::RETAIN)
object = Traits::Retain(object);
}
if (object_) {
if (object_)
Traits::Release(object_);
}
object_ = object;
}

Expand Down Expand Up @@ -148,4 +142,4 @@ class ScopedTypeRef {

} // namespace partition_alloc::internal::base

#endif // BASE_ALLOCATOR_PARTITION_ALLOCATOR_PARTITION_ALLOC_BASE_APPLE_SCOPED_TYPEREF_H_
#endif // BASE_ALLOCATOR_PARTITION_ALLOCATOR_PARTITION_ALLOC_BASE_MAC_SCOPED_TYPEREF_H_
Original file line number Diff line number Diff line change
Expand Up @@ -156,9 +156,8 @@ Time TimeNowFromSystemTimeIgnoringOverride() {
Time Time::FromCFAbsoluteTime(CFAbsoluteTime t) {
static_assert(std::numeric_limits<CFAbsoluteTime>::has_infinity,
"CFAbsoluteTime must have an infinity value");
if (t == 0) {
if (t == 0)
return Time(); // Consider 0 as a null Time.
}
return (t == std::numeric_limits<CFAbsoluteTime>::infinity())
? Max()
: (UnixEpoch() +
Expand All @@ -168,9 +167,8 @@ Time TimeNowFromSystemTimeIgnoringOverride() {
CFAbsoluteTime Time::ToCFAbsoluteTime() const {
static_assert(std::numeric_limits<CFAbsoluteTime>::has_infinity,
"CFAbsoluteTime must have an infinity value");
if (is_null()) {
if (is_null())
return 0; // Consider 0 as a null Time.
}
return is_max() ? std::numeric_limits<CFAbsoluteTime>::infinity()
: (CFAbsoluteTime{(*this - UnixEpoch()).InSecondsF()} -
kCFAbsoluteTimeIntervalSince1970);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef BASE_ALLOCATOR_PARTITION_ALLOCATOR_SHIM_ALLOCATOR_INTERCEPTION_APPLE_H_
#define BASE_ALLOCATOR_PARTITION_ALLOCATOR_SHIM_ALLOCATOR_INTERCEPTION_APPLE_H_
#ifndef BASE_ALLOCATOR_PARTITION_ALLOCATOR_SHIM_ALLOCATOR_INTERCEPTION_MAC_H_
#define BASE_ALLOCATOR_PARTITION_ALLOCATOR_SHIM_ALLOCATOR_INTERCEPTION_MAC_H_

#include <stddef.h>

Expand Down Expand Up @@ -63,4 +63,4 @@ void ReplaceZoneFunctions(ChromeMallocZone* zone,

} // namespace allocator_shim

#endif // BASE_ALLOCATOR_PARTITION_ALLOCATOR_SHIM_ALLOCATOR_INTERCEPTION_APPLE_H_
#endif // BASE_ALLOCATOR_PARTITION_ALLOCATOR_SHIM_ALLOCATOR_INTERCEPTION_MAC_H_
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
// only reason to intercept these calls is to re-label OOM crashes with slightly
// more details.

#include "base/allocator/partition_allocator/shim/allocator_interception_apple.h"
#include "base/allocator/partition_allocator/shim/allocator_interception_mac.h"

#include <CoreFoundation/CoreFoundation.h>
#import <Foundation/Foundation.h>
Expand All @@ -28,12 +28,12 @@
#include <new>

#include "base/allocator/partition_allocator/oom.h"
#include "base/allocator/partition_allocator/partition_alloc_base/apple/mach_logging.h"
#include "base/allocator/partition_allocator/partition_alloc_base/bits.h"
#include "base/allocator/partition_allocator/partition_alloc_base/logging.h"
#include "base/allocator/partition_allocator/partition_alloc_base/mac/mach_logging.h"
#include "base/allocator/partition_allocator/partition_alloc_buildflags.h"
#include "base/allocator/partition_allocator/partition_alloc_check.h"
#include "base/allocator/partition_allocator/shim/malloc_zone_functions_apple.h"
#include "base/allocator/partition_allocator/shim/malloc_zone_functions_mac.h"
#include "base/allocator/partition_allocator/third_party/apple_apsl/CFBase.h"
#include "build/build_config.h"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "base/allocator/partition_allocator/shim/allocator_interception_apple.h"
#include "base/allocator/partition_allocator/shim/allocator_interception_mac.h"

#include <mach/mach.h>

#include "base/allocator/partition_allocator/shim/allocator_shim.h"
#include "base/allocator/partition_allocator/shim/malloc_zone_functions_apple.h"
#include "base/allocator/partition_allocator/shim/malloc_zone_functions_mac.h"
#include "testing/gtest/include/gtest/gtest.h"

namespace allocator_shim {
Expand Down
8 changes: 4 additions & 4 deletions base/allocator/partition_allocator/shim/allocator_shim.cc
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@
#if BUILDFLAG(IS_APPLE)
#include <malloc/malloc.h>

#include "base/allocator/partition_allocator/partition_alloc_base/apple/mach_logging.h"
#include "base/allocator/partition_allocator/shim/allocator_interception_apple.h"
#include "base/allocator/partition_allocator/partition_alloc_base/mac/mach_logging.h"
#include "base/allocator/partition_allocator/shim/allocator_interception_mac.h"
#endif

#if BUILDFLAG(USE_PARTITION_ALLOC_AS_MALLOC)
Expand Down Expand Up @@ -410,9 +410,9 @@ PA_ALWAYS_INLINE void ShimAlignedFree(void* address, void* context) {
#include "base/allocator/partition_allocator/shim/allocator_shim_override_ucrt_symbols_win.h"
#elif BUILDFLAG(IS_APPLE)
#if BUILDFLAG(USE_PARTITION_ALLOC_AS_MALLOC)
#include "base/allocator/partition_allocator/shim/allocator_shim_override_apple_default_zone.h"
#include "base/allocator/partition_allocator/shim/allocator_shim_override_mac_default_zone.h"
#else // BUILDFLAG(USE_PARTITION_ALLOC_AS_MALLOC)
#include "base/allocator/partition_allocator/shim/allocator_shim_override_apple_symbols.h"
#include "base/allocator/partition_allocator/shim/allocator_shim_override_mac_symbols.h"
#endif // BUILDFLAG(USE_PARTITION_ALLOC_AS_MALLOC)
#else
#include "base/allocator/partition_allocator/shim/allocator_shim_override_libc_symbols.h"
Expand Down

0 comments on commit 664931b

Please sign in to comment.