From 13e3accfe82059b0028844b5a05c690f730a36ba Mon Sep 17 00:00:00 2001 From: Avi Drissman Date: Thu, 17 Aug 2023 11:10:53 -0400 Subject: [PATCH] Roll mini_chromium, adjust to more files in base/apple This rolls mini_chromium to the version that has more files in base/apple, and adjusts the code to match. Bug: chromium:1444927 Change-Id: I9642698c8c16151bd0aaca7b46745a59d6e5e6d3 Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/4791121 Reviewed-by: Mark Mentovai Commit-Queue: Avi Drissman --- DEPS | 2 +- util/mac/launchd.mm | 17 +++++++++-------- util/mac/mac_util.cc | 17 +++++++++-------- util/mac/service_management_test.mm | 2 +- util/net/http_transport_mac.mm | 8 ++++---- 5 files changed, 24 insertions(+), 22 deletions(-) diff --git a/DEPS b/DEPS index 42037773..d268bd96 100644 --- a/DEPS +++ b/DEPS @@ -47,7 +47,7 @@ deps = { '9719c1e1e676814c456b55f5f070eabad6709d31', 'crashpad/third_party/mini_chromium/mini_chromium': Var('chromium_git') + '/chromium/mini_chromium@' + - 'f5370228f40bbb8c453e17f6af6c6742858c45d1', + 'e35fc73aa87bb27e10306900b15a18b0e9c7ca42', 'crashpad/third_party/libfuzzer/src': Var('chromium_git') + '/chromium/llvm-project/compiler-rt/lib/fuzzer.git@' + 'fda403cf93ecb8792cb1d061564d89a6553ca020', diff --git a/util/mac/launchd.mm b/util/mac/launchd.mm index 35620ba5..c711747b 100644 --- a/util/mac/launchd.mm +++ b/util/mac/launchd.mm @@ -17,8 +17,8 @@ #import #include "base/apple/bridging.h" -#include "base/mac/foundation_util.h" -#include "base/mac/scoped_cftyperef.h" +#include "base/apple/foundation_util.h" +#include "base/apple/scoped_cftyperef.h" #include "base/mac/scoped_launch_data.h" #include "base/strings/sys_string_conversions.h" #include "util/misc/implicit_cast.h" @@ -36,7 +36,7 @@ launch_data_t CFPropertyToLaunchData(CFPropertyListRef property_cf) { if (type_id_cf == CFDictionaryGetTypeID()) { NSDictionary* dictionary_ns = base::apple::CFToNSPtrCast( - base::mac::CFCastStrict(property_cf)); + base::apple::CFCastStrict(property_cf)); base::mac::ScopedLaunchData dictionary_launch( LaunchDataAlloc(LAUNCH_DATA_DICTIONARY)); @@ -60,7 +60,7 @@ launch_data_t CFPropertyToLaunchData(CFPropertyListRef property_cf) { } else if (type_id_cf == CFArrayGetTypeID()) { NSArray* array_ns = base::apple::CFToNSPtrCast( - base::mac::CFCastStrict(property_cf)); + base::apple::CFCastStrict(property_cf)); base::mac::ScopedLaunchData array_launch( LaunchDataAlloc(LAUNCH_DATA_ARRAY)); size_t index = 0; @@ -78,7 +78,8 @@ launch_data_t CFPropertyToLaunchData(CFPropertyListRef property_cf) { data_launch = array_launch.release(); } else if (type_id_cf == CFNumberGetTypeID()) { - CFNumberRef number_cf = base::mac::CFCastStrict(property_cf); + CFNumberRef number_cf = + base::apple::CFCastStrict(property_cf); NSNumber* number_ns = base::apple::CFToNSPtrCast(number_cf); switch (CFNumberGetType(number_cf)) { case kCFNumberSInt8Type: @@ -109,12 +110,12 @@ launch_data_t CFPropertyToLaunchData(CFPropertyListRef property_cf) { } else if (type_id_cf == CFBooleanGetTypeID()) { CFBooleanRef boolean_cf = - base::mac::CFCastStrict(property_cf); + base::apple::CFCastStrict(property_cf); data_launch = LaunchDataNewBool(CFBooleanGetValue(boolean_cf)); } else if (type_id_cf == CFStringGetTypeID()) { NSString* string_ns = base::apple::CFToNSPtrCast( - base::mac::CFCastStrict(property_cf)); + base::apple::CFCastStrict(property_cf)); // -fileSystemRepresentation might be more correct than -UTF8String, // because these strings can hold paths. The analogous function in @@ -126,7 +127,7 @@ launch_data_t CFPropertyToLaunchData(CFPropertyListRef property_cf) { } else if (type_id_cf == CFDataGetTypeID()) { NSData* data_ns = base::apple::CFToNSPtrCast( - base::mac::CFCastStrict(property_cf)); + base::apple::CFCastStrict(property_cf)); data_launch = LaunchDataNewOpaque([data_ns bytes], [data_ns length]); } else { base::ScopedCFTypeRef type_name_cf( diff --git a/util/mac/mac_util.cc b/util/mac/mac_util.cc index ed2bfb73..f1898620 100644 --- a/util/mac/mac_util.cc +++ b/util/mac/mac_util.cc @@ -21,10 +21,10 @@ #include #include +#include "base/apple/foundation_util.h" +#include "base/apple/scoped_cftyperef.h" #include "base/check_op.h" #include "base/logging.h" -#include "base/mac/foundation_util.h" -#include "base/mac/scoped_cftyperef.h" #include "base/mac/scoped_ioobject.h" #include "base/notreached.h" #include "base/strings/string_number_conversions.h" @@ -168,7 +168,7 @@ std::string IORegistryEntryDataPropertyAsString(io_registry_entry_t entry, CFStringRef key) { base::ScopedCFTypeRef property( IORegistryEntryCreateCFProperty(entry, key, kCFAllocatorDefault, 0)); - CFDataRef data = base::mac::CFCast(property); + CFDataRef data = base::apple::CFCast(property); if (data && CFDataGetLength(data) > 0) { return reinterpret_cast(CFDataGetBytePtr(data)); } @@ -244,7 +244,7 @@ bool MacOSVersionComponents(int* major, bool success = true; - CFStringRef version_cf = base::mac::CFCast( + CFStringRef version_cf = base::apple::CFCast( TryCFDictionaryGetValue(dictionary, _kCFSystemVersionProductVersionKey)); std::string version; if (!version_cf) { @@ -264,7 +264,7 @@ bool MacOSVersionComponents(int* major, } } - CFStringRef build_cf = base::mac::CFCast( + CFStringRef build_cf = base::apple::CFCast( TryCFDictionaryGetValue(dictionary, _kCFSystemVersionBuildVersionKey)); if (!build_cf) { LOG(ERROR) << "build_cf not found"; @@ -273,7 +273,7 @@ bool MacOSVersionComponents(int* major, build->assign(base::SysCFStringRefToUTF8(build_cf)); } - CFStringRef product_cf = base::mac::CFCast( + CFStringRef product_cf = base::apple::CFCast( TryCFDictionaryGetValue(dictionary, _kCFSystemVersionProductNameKey)); std::string product; if (!product_cf) { @@ -284,8 +284,9 @@ bool MacOSVersionComponents(int* major, } // This key is not required, and in fact is normally not present. - CFStringRef extra_cf = base::mac::CFCast(TryCFDictionaryGetValue( - dictionary, _kCFSystemVersionProductVersionExtraKey)); + CFStringRef extra_cf = + base::apple::CFCast(TryCFDictionaryGetValue( + dictionary, _kCFSystemVersionProductVersionExtraKey)); std::string extra; if (extra_cf) { extra = base::SysCFStringRefToUTF8(extra_cf); diff --git a/util/mac/service_management_test.mm b/util/mac/service_management_test.mm index 85335284..26c96049 100644 --- a/util/mac/service_management_test.mm +++ b/util/mac/service_management_test.mm @@ -21,7 +21,7 @@ #include #include "base/apple/bridging.h" -#include "base/mac/scoped_cftyperef.h" +#include "base/apple/scoped_cftyperef.h" #include "base/strings/stringprintf.h" #include "base/strings/sys_string_conversions.h" #include "gtest/gtest.h" diff --git a/util/net/http_transport_mac.mm b/util/net/http_transport_mac.mm index ef51beb6..e65a690f 100644 --- a/util/net/http_transport_mac.mm +++ b/util/net/http_transport_mac.mm @@ -18,7 +18,7 @@ #include #include "base/apple/bridging.h" -#include "base/mac/foundation_util.h" +#include "base/apple/foundation_util.h" #include "base/strings/stringprintf.h" #include "base/strings/sys_string_conversions.h" #include "build/build_config.h" @@ -153,12 +153,12 @@ NSString* UserAgentString() { // Expected to be CFNetwork. NSBundle* nsurl_bundle = [NSBundle bundleForClass:[NSURLRequest class]]; - NSString* bundle_name = base::mac::ObjCCast([nsurl_bundle + NSString* bundle_name = base::apple::ObjCCast([nsurl_bundle objectForInfoDictionaryKey:base::apple::CFToNSPtrCast(kCFBundleNameKey)]); if (bundle_name) { user_agent = AppendEscapedFormat(user_agent, @" %@", bundle_name); - NSString* bundle_version = base::mac::ObjCCast( + NSString* bundle_version = base::apple::ObjCCast( [nsurl_bundle objectForInfoDictionaryKey:base::apple::CFToNSPtrCast( kCFBundleVersionKey)]); if (bundle_version) { @@ -268,7 +268,7 @@ bool HTTPTransportMac::ExecuteSynchronously(std::string* response_body) { return false; } NSHTTPURLResponse* http_response = - base::mac::ObjCCast(response); + base::apple::ObjCCast(response); if (!http_response) { LOG(ERROR) << "no http_response"; return false;