Convert Crashpad to use ARC

See
https://chromium.googlesource.com/chromium/src/+/main/docs/mac/arc.md
for information about this conversion.

Bug: chromium:1280726
Change-Id: I9ed10e9a255eb6b13035b05bcc587c4b6cb7b78e
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/4651106
Reviewed-by: Mark Mentovai <mmentovai@google.com>
Commit-Queue: Mark Mentovai <mark@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
This commit is contained in:
Avi Drissman 2023-06-30 11:39:44 -04:00 committed by Crashpad LUCI CQ
parent 87e1883047
commit 9e37dc46b6
24 changed files with 174 additions and 102 deletions

2
DEPS
View File

@ -47,7 +47,7 @@ deps = {
'9719c1e1e676814c456b55f5f070eabad6709d31', '9719c1e1e676814c456b55f5f070eabad6709d31',
'crashpad/third_party/mini_chromium/mini_chromium': 'crashpad/third_party/mini_chromium/mini_chromium':
Var('chromium_git') + '/chromium/mini_chromium@' + Var('chromium_git') + '/chromium/mini_chromium@' +
'f0eebea8bd59215be300ffbe5e7883e85a6fdc0e', 'e009af846ef4790a90d69fe13ed54df25b93fdef',
'crashpad/third_party/libfuzzer/src': 'crashpad/third_party/libfuzzer/src':
Var('chromium_git') + '/chromium/llvm-project/compiler-rt/lib/fuzzer.git@' + Var('chromium_git') + '/chromium/llvm-project/compiler-rt/lib/fuzzer.git@' +
'fda403cf93ecb8792cb1d061564d89a6553ca020', 'fda403cf93ecb8792cb1d061564d89a6553ca020',

View File

@ -31,9 +31,8 @@ config("crashpad_is_in_fuchsia") {
} }
config("flock_always_supported_defines") { config("flock_always_supported_defines") {
defines = [ defines =
"CRASHPAD_FLOCK_ALWAYS_SUPPORTED=$crashpad_flock_always_supported", [ "CRASHPAD_FLOCK_ALWAYS_SUPPORTED=$crashpad_flock_always_supported" ]
]
} }
group("default_exe_manifest_win") { group("default_exe_manifest_win") {
@ -52,16 +51,17 @@ config("crashpad_fuzzer_flags") {
ldflags = [ "-fsanitize=address" ] ldflags = [ "-fsanitize=address" ]
} }
if (crashpad_is_ios) { if (crashpad_is_apple) {
group("ios_enable_arc") { group("apple_enable_arc") {
if (crashpad_is_in_chromium) { if (crashpad_is_in_chromium) {
public_configs = [ "//build/config/compiler:enable_arc" ] public_configs = [ "//build/config/compiler:enable_arc" ]
} else if (crashpad_is_standalone) { } else if (crashpad_is_standalone) {
public_configs = public_configs = [ "//third_party/mini_chromium/mini_chromium/build/config:apple_enable_arc" ]
[ "//third_party/mini_chromium/mini_chromium/build/config:ios_enable_arc" ]
} }
} }
}
if (crashpad_is_ios) {
group("ios_xctest") { group("ios_xctest") {
if (crashpad_is_in_chromium) { if (crashpad_is_in_chromium) {
public_configs = [ "//build/config/ios:xctest_config" ] public_configs = [ "//build/config/ios:xctest_config" ]

View File

@ -59,6 +59,7 @@ if (crashpad_is_external || crashpad_is_in_dart) {
if (crashpad_is_in_chromium) { if (crashpad_is_in_chromium) {
crashpad_is_mac = is_mac crashpad_is_mac = is_mac
crashpad_is_ios = is_ios crashpad_is_ios = is_ios
crashpad_is_apple = is_apple
crashpad_is_win = is_win crashpad_is_win = is_win
crashpad_is_linux = is_linux || is_chromeos crashpad_is_linux = is_linux || is_chromeos
crashpad_is_android = is_android crashpad_is_android = is_android
@ -73,6 +74,7 @@ if (crashpad_is_in_chromium) {
crashpad_is_mac = mini_chromium_is_mac crashpad_is_mac = mini_chromium_is_mac
crashpad_is_ios = mini_chromium_is_ios crashpad_is_ios = mini_chromium_is_ios
crashpad_is_apple = mini_chromium_is_apple
crashpad_is_win = mini_chromium_is_win crashpad_is_win = mini_chromium_is_win
crashpad_is_linux = mini_chromium_is_linux crashpad_is_linux = mini_chromium_is_linux
crashpad_is_android = mini_chromium_is_android crashpad_is_android = mini_chromium_is_android

View File

@ -89,6 +89,10 @@ crashpad_static_library("client") {
cflags = [ "/wd4201" ] # nonstandard extension used : nameless struct/union cflags = [ "/wd4201" ] # nonstandard extension used : nameless struct/union
} }
if (crashpad_is_apple) {
deps += [ "../build:apple_enable_arc" ]
}
if (crashpad_is_ios) { if (crashpad_is_ios) {
deps += [ deps += [
"../handler:common", "../handler:common",
@ -127,7 +131,7 @@ static_library("common") {
"simple_string_dictionary.h", "simple_string_dictionary.h",
] ]
if (crashpad_is_mac || crashpad_is_ios) { if (crashpad_is_apple) {
sources += [ "crash_report_database_mac.mm" ] sources += [ "crash_report_database_mac.mm" ]
} }
if (crashpad_is_win) { if (crashpad_is_win) {
@ -147,17 +151,19 @@ static_library("common") {
] ]
deps = [ "../util" ] deps = [ "../util" ]
configs += [ "../build:flock_always_supported_defines" ] configs += [ "../build:flock_always_supported_defines" ]
if (crashpad_is_apple) {
deps += [ "../build:apple_enable_arc" ]
}
} }
crashpad_executable("ring_buffer_annotation_load_test") { crashpad_executable("ring_buffer_annotation_load_test") {
testonly = true testonly = true
sources = [ sources = [ "ring_buffer_annotation_load_test_main.cc" ]
"ring_buffer_annotation_load_test_main.cc",
]
deps = [ deps = [
":client", ":client",
"../tools:tool_support",
"$mini_chromium_source_parent:base", "$mini_chromium_source_parent:base",
"../tools:tool_support",
] ]
} }
@ -212,6 +218,10 @@ source_set("client_test") {
data_deps = [ "../handler:crashpad_handler" ] data_deps = [ "../handler:crashpad_handler" ]
} }
if (crashpad_is_apple) {
deps += [ "../build:apple_enable_arc" ]
}
if (crashpad_is_win) { if (crashpad_is_win) {
data_deps += [ data_deps += [
"../handler:crashpad_handler_console", "../handler:crashpad_handler_console",

View File

@ -49,6 +49,10 @@
#include "util/ios/scoped_background_task.h" #include "util/ios/scoped_background_task.h"
#endif // BUILDFLAG(IS_IOS) #endif // BUILDFLAG(IS_IOS)
#if !defined(__has_feature) || !__has_feature(objc_arc)
#error "This file requires ARC support."
#endif
namespace crashpad { namespace crashpad {
namespace { namespace {

View File

@ -27,6 +27,10 @@
#include "testing/platform_test.h" #include "testing/platform_test.h"
#include "util/thread/thread.h" #include "util/thread/thread.h"
#if !defined(__has_feature) || !__has_feature(objc_arc)
#error "This file requires ARC support."
#endif
namespace crashpad { namespace crashpad {
namespace test { namespace test {
namespace { namespace {

View File

@ -54,6 +54,10 @@
#include "client/annotation.h" #include "client/annotation.h"
#include "client/simulate_crash_ios.h" #include "client/simulate_crash_ios.h"
#if !defined(__has_feature) || !__has_feature(objc_arc)
#error "This file requires ARC support."
#endif
namespace crashpad { namespace crashpad {
namespace { namespace {
@ -65,7 +69,7 @@ struct objc_typeinfo {
Class cls_unremapped; Class cls_unremapped;
}; };
struct objc_exception { struct objc_exception {
id obj; id __unsafe_unretained obj;
objc_typeinfo tinfo; objc_typeinfo tinfo;
}; };
@ -219,7 +223,7 @@ class ExceptionPreprocessorState {
// preprocessor didn't catch anything, so pass the frames or just the context // preprocessor didn't catch anything, so pass the frames or just the context
// to the exception_delegate. // to the exception_delegate.
void FinalizeUncaughtNSException(id exception) { void FinalizeUncaughtNSException(id exception) {
if (last_exception() == exception && if (last_exception() == (__bridge void*)exception &&
!last_handled_intermediate_dump_.empty() && !last_handled_intermediate_dump_.empty() &&
exception_delegate_->MoveIntermediateDumpAtPathToPending( exception_delegate_->MoveIntermediateDumpAtPathToPending(
last_handled_intermediate_dump_)) { last_handled_intermediate_dump_)) {
@ -331,10 +335,10 @@ id ObjcExceptionPreprocessor(id exception) {
// ignore it. // ignore it.
ExceptionPreprocessorState* preprocessor_state = ExceptionPreprocessorState* preprocessor_state =
ExceptionPreprocessorState::Get(); ExceptionPreprocessorState::Get();
if (preprocessor_state->last_exception() == exception) { if (preprocessor_state->last_exception() == (__bridge void*)exception) {
return preprocessor_state->MaybeCallNextPreprocessor(exception); return preprocessor_state->MaybeCallNextPreprocessor(exception);
} }
preprocessor_state->set_last_exception(exception); preprocessor_state->set_last_exception((__bridge void*)exception);
static bool seen_first_exception; static bool seen_first_exception;

View File

@ -19,6 +19,10 @@
#include "gtest/gtest.h" #include "gtest/gtest.h"
#include "testing/platform_test.h" #include "testing/platform_test.h"
#if !defined(__has_feature) || !__has_feature(objc_arc)
#error "This file requires ARC support."
#endif
namespace crashpad { namespace crashpad {
namespace test { namespace test {
namespace { namespace {

View File

@ -17,7 +17,7 @@ import("../build/crashpad_buildconfig.gni")
config("compat_config") { config("compat_config") {
include_dirs = [] include_dirs = []
if (crashpad_is_mac || crashpad_is_ios) { if (crashpad_is_apple) {
include_dirs += [ "mac" ] include_dirs += [ "mac" ]
} }
@ -41,7 +41,7 @@ config("compat_config") {
} }
template("compat_target") { template("compat_target") {
if (crashpad_is_mac || crashpad_is_ios) { if (crashpad_is_apple) {
# There are no sources to compile, which doesnt mix will with a # There are no sources to compile, which doesnt mix will with a
# static_library. # static_library.
group(target_name) { group(target_name) {
@ -64,7 +64,7 @@ template("compat_target") {
compat_target("compat") { compat_target("compat") {
sources = [] sources = []
if (crashpad_is_mac || crashpad_is_ios) { if (crashpad_is_apple) {
sources += [ sources += [
"mac/Availability.h", "mac/Availability.h",
"mac/AvailabilityVersions.h", "mac/AvailabilityVersions.h",

View File

@ -100,7 +100,7 @@ static_library("common") {
"minidump_to_upload_parameters.cc", "minidump_to_upload_parameters.cc",
"minidump_to_upload_parameters.h", "minidump_to_upload_parameters.h",
] ]
if (crashpad_is_mac || crashpad_is_ios) { if (crashpad_is_apple) {
sources += [ sources += [
"mac/file_limit_annotation.cc", "mac/file_limit_annotation.cc",
"mac/file_limit_annotation.h", "mac/file_limit_annotation.h",

View File

@ -566,7 +566,7 @@ if ((crashpad_is_linux || crashpad_is_android || crashpad_is_fuchsia) &&
} }
} }
if (crashpad_is_mac || crashpad_is_ios) { if (crashpad_is_apple) {
crashpad_loadable_module("crashpad_snapshot_test_module_crashy_initializer") { crashpad_loadable_module("crashpad_snapshot_test_module_crashy_initializer") {
testonly = true testonly = true
sources = [ sources = [

View File

@ -61,12 +61,10 @@ static_library("test") {
# TODO(crbug.com/812974): Remove !crashpad_is_fuchsia when Fuchsia is no # TODO(crbug.com/812974): Remove !crashpad_is_fuchsia when Fuchsia is no
# longer treated as a posix platform. # longer treated as a posix platform.
if (crashpad_is_posix && !crashpad_is_fuchsia) { if (crashpad_is_posix && !crashpad_is_fuchsia) {
sources += [ sources += [ "scoped_set_thread_name_posix.cc" ]
"scoped_set_thread_name_posix.cc",
]
} }
if (crashpad_is_mac || crashpad_is_ios) { if (crashpad_is_apple) {
sources += [ sources += [
"mac/mach_errors.cc", "mac/mach_errors.cc",
"mac/mach_errors.h", "mac/mach_errors.h",
@ -135,9 +133,9 @@ static_library("test") {
data = [ "test_paths_test_data_root.txt" ] data = [ "test_paths_test_data_root.txt" ]
deps = [ deps = [
"$mini_chromium_source_parent:base",
"../compat", "../compat",
"../third_party/googletest:googletest", "../third_party/googletest:googletest",
"$mini_chromium_source_parent:base",
"../util", "../util",
] ]
@ -214,10 +212,10 @@ source_set("test_test") {
deps = [ deps = [
":test", ":test",
"$mini_chromium_source_parent:base",
"../compat", "../compat",
"../third_party/googletest:googlemock", "../third_party/googletest:googlemock",
"../third_party/googletest:googletest", "../third_party/googletest:googletest",
"$mini_chromium_source_parent:base",
"../util", "../util",
] ]
@ -243,10 +241,10 @@ static_library("googlemock_main") {
defines = [ "CRASHPAD_TEST_LAUNCHER_GOOGLEMOCK" ] defines = [ "CRASHPAD_TEST_LAUNCHER_GOOGLEMOCK" ]
deps = [ deps = [
":test", ":test",
"../third_party/googletest:googlemock",
"../third_party/googletest:googletest",
"$mini_chromium_source_parent:base", "$mini_chromium_source_parent:base",
"$mini_chromium_source_parent:base_test_support", "$mini_chromium_source_parent:base_test_support",
"../third_party/googletest:googlemock",
"../third_party/googletest:googletest",
] ]
if (crashpad_is_android) { if (crashpad_is_android) {
deps += [ "../util" ] deps += [ "../util" ]
@ -263,9 +261,9 @@ static_library("googletest_main") {
defines = [ "CRASHPAD_TEST_LAUNCHER_GOOGLETEST" ] defines = [ "CRASHPAD_TEST_LAUNCHER_GOOGLETEST" ]
deps = [ deps = [
":test", ":test",
"../third_party/googletest:googletest",
"$mini_chromium_source_parent:base", "$mini_chromium_source_parent:base",
"$mini_chromium_source_parent:base_test_support", "$mini_chromium_source_parent:base_test_support",
"../third_party/googletest:googletest",
] ]
if (crashpad_is_android) { if (crashpad_is_android) {
deps += [ "../util" ] deps += [ "../util" ]

View File

@ -40,7 +40,7 @@ source_set("google_test_runner") {
configs += [ "../..:crashpad_config" ] configs += [ "../..:crashpad_config" ]
deps = [ deps = [
"../$mini_chromium_source_parent:base", "../$mini_chromium_source_parent:base",
"../../build:ios_enable_arc", "../../build:apple_enable_arc",
"../../build:ios_xctest", "../../build:ios_xctest",
"../../test/ios:google_test_runner_shared_headers", "../../test/ios:google_test_runner_shared_headers",
] ]
@ -57,7 +57,7 @@ source_set("google_test_setup") {
deps = [ deps = [
":google_test_runner_shared_headers", ":google_test_runner_shared_headers",
"../$mini_chromium_source_parent:base", "../$mini_chromium_source_parent:base",
"../../build:ios_enable_arc", "../../build:apple_enable_arc",
"../../third_party/googletest:googletest", "../../third_party/googletest:googletest",
] ]
frameworks = [ "UIKit.framework" ] frameworks = [ "UIKit.framework" ]
@ -72,7 +72,7 @@ source_set("xcuitests") {
] ]
deps = [ deps = [
"../../build:ios_enable_arc", "../../build:apple_enable_arc",
"../../build:ios_xctest", "../../build:ios_xctest",
"../../client:common", "../../client:common",
"../../test/ios/host:app_shared_sources", "../../test/ios/host:app_shared_sources",

View File

@ -24,7 +24,7 @@ source_set("app_shared_sources") {
testonly = true testonly = true
sources = [ "cptest_shared_object.h" ] sources = [ "cptest_shared_object.h" ]
configs += [ "../../..:crashpad_config" ] configs += [ "../../..:crashpad_config" ]
deps = [ "../../../build:ios_enable_arc" ] deps = [ "../../../build:apple_enable_arc" ]
frameworks = [ "UIKit.framework" ] frameworks = [ "UIKit.framework" ]
} }
@ -42,7 +42,7 @@ static_library("app_host_sources") {
configs += [ "../../..:crashpad_config" ] configs += [ "../../..:crashpad_config" ]
deps = [ deps = [
":app_shared_sources", ":app_shared_sources",
"../../../build:ios_enable_arc", "../../../build:apple_enable_arc",
"../../../client", "../../../client",
"../../../snapshot", "../../../snapshot",
"../../../test", "../../../test",

View File

@ -139,6 +139,6 @@ if (crashpad_is_in_chromium) {
] ]
public_configs = [ ":config" ] public_configs = [ ":config" ]
deps = [ "../../build:ios_enable_arc" ] deps = [ "../../build:apple_enable_arc" ]
} }
} }

View File

@ -36,8 +36,7 @@ crashpad_executable("dump_minidump_annotations") {
] ]
if (crashpad_is_win) { if (crashpad_is_win) {
cflags = cflags = [ "/wd4201" ] # nonstandard extension used : nameless struct/union
[ "/wd4201" ] # nonstandard extension used : nameless struct/union
} }
} }
@ -47,10 +46,10 @@ if (!crashpad_is_ios && !crashpad_is_fuchsia) {
deps = [ deps = [
":tool_support", ":tool_support",
"$mini_chromium_source_parent:base",
"../build:default_exe_manifest_win", "../build:default_exe_manifest_win",
"../client", "../client",
"../compat", "../compat",
"$mini_chromium_source_parent:base",
"../util", "../util",
] ]
} }
@ -60,9 +59,9 @@ if (!crashpad_is_ios && !crashpad_is_fuchsia) {
deps = [ deps = [
":tool_support", ":tool_support",
"$mini_chromium_source_parent:base",
"../build:default_exe_manifest_win", "../build:default_exe_manifest_win",
"../compat", "../compat",
"$mini_chromium_source_parent:base",
"../util", "../util",
"../util:net", "../util:net",
] ]
@ -73,8 +72,8 @@ crashpad_executable("base94_encoder") {
sources = [ "base94_encoder.cc" ] sources = [ "base94_encoder.cc" ]
deps = [ deps = [
":tool_support", ":tool_support",
"../build:default_exe_manifest_win",
"$mini_chromium_source_parent:base", "$mini_chromium_source_parent:base",
"../build:default_exe_manifest_win",
"../util", "../util",
] ]
} }
@ -85,11 +84,11 @@ if (!crashpad_is_fuchsia && !crashpad_is_ios) {
deps = [ deps = [
":tool_support", ":tool_support",
"$mini_chromium_source_parent:base",
"../build:default_exe_manifest_win", "../build:default_exe_manifest_win",
"../compat", "../compat",
"../minidump", "../minidump",
"../snapshot", "../snapshot",
"$mini_chromium_source_parent:base",
"../util", "../util",
] ]
@ -119,9 +118,9 @@ if (crashpad_is_mac || crashpad_is_fuchsia) {
deps = [ deps = [
":tool_support", ":tool_support",
"$mini_chromium_source_parent:base",
"../client", "../client",
"../compat", "../compat",
"$mini_chromium_source_parent:base",
"../util", "../util",
] ]
} }
@ -133,8 +132,8 @@ if (crashpad_is_mac) {
deps = [ deps = [
":tool_support", ":tool_support",
"../compat",
"$mini_chromium_source_parent:base", "$mini_chromium_source_parent:base",
"../compat",
"../util", "../util",
] ]
} }
@ -154,8 +153,8 @@ if (crashpad_is_mac) {
deps = [ deps = [
":tool_support", ":tool_support",
"../compat",
"$mini_chromium_source_parent:base", "$mini_chromium_source_parent:base",
"../compat",
"../util", "../util",
] ]
} }
@ -170,8 +169,9 @@ if (crashpad_is_mac) {
deps = [ deps = [
":tool_support", ":tool_support",
"../compat",
"$mini_chromium_source_parent:base", "$mini_chromium_source_parent:base",
"../build:apple_enable_arc",
"../compat",
"../util", "../util",
] ]
} }

View File

@ -24,12 +24,16 @@
#include <string> #include <string>
#include <vector> #include <vector>
#include "base/mac/foundation_util.h" #include "base/apple/bridging.h"
#include "base/strings/sys_string_conversions.h" #include "base/strings/sys_string_conversions.h"
#include "tools/tool_support.h" #include "tools/tool_support.h"
#include "util/mac/service_management.h" #include "util/mac/service_management.h"
#include "util/stdlib/objc.h" #include "util/stdlib/objc.h"
#if !defined(__has_feature) || !__has_feature(objc_arc)
#error "This file requires ARC support."
#endif
namespace crashpad { namespace crashpad {
namespace { namespace {
@ -158,13 +162,13 @@ int OnDemandServiceToolMain(int argc, char* argv[]) {
} }
NSMutableDictionary* mutable_job_dictionary = NSMutableDictionary* mutable_job_dictionary =
[[job_dictionary mutableCopy] autorelease]; [job_dictionary mutableCopy];
mutable_job_dictionary[@LAUNCH_JOBKEY_MACHSERVICES] = mach_services; mutable_job_dictionary[@LAUNCH_JOBKEY_MACHSERVICES] = mach_services;
job_dictionary = mutable_job_dictionary; job_dictionary = mutable_job_dictionary;
} }
CFDictionaryRef job_dictionary_cf = CFDictionaryRef job_dictionary_cf =
base::mac::NSToCFCast(job_dictionary); base::apple::NSToCFPtrCast(job_dictionary);
if (!ServiceManagementSubmitJob(job_dictionary_cf)) { if (!ServiceManagementSubmitJob(job_dictionary_cf)) {
fprintf(stderr, "%s: failed to submit job\n", me.c_str()); fprintf(stderr, "%s: failed to submit job\n", me.c_str());
return EXIT_FAILURE; return EXIT_FAILURE;

View File

@ -19,7 +19,7 @@ if (crashpad_is_in_chromium) {
import("//build/config/sanitizers/sanitizers.gni") import("//build/config/sanitizers/sanitizers.gni")
} }
if (crashpad_is_mac || crashpad_is_ios) { if (crashpad_is_apple) {
if (crashpad_is_in_chromium || crashpad_is_in_fuchsia) { if (crashpad_is_in_chromium || crashpad_is_in_fuchsia) {
import("//build/config/sysroot.gni") import("//build/config/sysroot.gni")
} else { } else {
@ -317,7 +317,7 @@ crashpad_static_library("util") {
} }
} }
if (crashpad_is_mac || crashpad_is_ios) { if (crashpad_is_apple) {
sources += [ sources += [
"mac/xattr.cc", "mac/xattr.cc",
"mac/xattr.h", "mac/xattr.h",
@ -401,10 +401,10 @@ crashpad_static_library("util") {
"ios/raw_logging.h", "ios/raw_logging.h",
"ios/scoped_background_task.h", "ios/scoped_background_task.h",
"ios/scoped_background_task.mm", "ios/scoped_background_task.mm",
"ios/scoped_vm_read.cc",
"ios/scoped_vm_read.h",
"ios/scoped_vm_map.cc", "ios/scoped_vm_map.cc",
"ios/scoped_vm_map.h", "ios/scoped_vm_map.h",
"ios/scoped_vm_read.cc",
"ios/scoped_vm_read.h",
] ]
} }
@ -585,13 +585,12 @@ crashpad_static_library("util") {
configs = [ "../build:flock_always_supported_defines" ] configs = [ "../build:flock_always_supported_defines" ]
if (crashpad_is_mac || crashpad_is_ios) { if (crashpad_is_apple) {
include_dirs += [ "$root_gen_dir" ] include_dirs += [ "$root_gen_dir" ]
deps += [ ":mig_output" ] deps += [
} ":mig_output",
"../build:apple_enable_arc",
if (crashpad_is_ios) { ]
deps += [ "../build:ios_enable_arc" ]
} }
if (crashpad_is_mac && !crashpad_is_in_fuchsia) { if (crashpad_is_mac && !crashpad_is_in_fuchsia) {
@ -652,6 +651,10 @@ crashpad_static_library("net") {
"$mini_chromium_source_parent:base", "$mini_chromium_source_parent:base",
] ]
if (crashpad_is_apple) {
deps += [ "../build:apple_enable_arc" ]
}
if (crashpad_is_mac && !crashpad_is_in_fuchsia) { if (crashpad_is_mac && !crashpad_is_in_fuchsia) {
sources += [ "net/http_transport_mac.mm" ] sources += [ "net/http_transport_mac.mm" ]
} }
@ -804,7 +807,7 @@ source_set("util_test") {
sources += [ "posix/scoped_mmap_test.cc" ] sources += [ "posix/scoped_mmap_test.cc" ]
} }
if (crashpad_is_mac || crashpad_is_ios) { if (crashpad_is_apple) {
sources += [ sources += [
"mac/xattr_test.cc", "mac/xattr_test.cc",
"mach/composite_mach_message_server_test.cc", "mach/composite_mach_message_server_test.cc",
@ -840,8 +843,8 @@ source_set("util_test") {
sources += [ sources += [
"ios/ios_intermediate_dump_reader_test.cc", "ios/ios_intermediate_dump_reader_test.cc",
"ios/ios_intermediate_dump_writer_test.cc", "ios/ios_intermediate_dump_writer_test.cc",
"ios/scoped_vm_read_test.cc",
"ios/scoped_vm_map_test.cc", "ios/scoped_vm_map_test.cc",
"ios/scoped_vm_read_test.cc",
] ]
sources -= [ sources -= [
@ -919,6 +922,10 @@ source_set("util_test") {
} }
} }
if (crashpad_is_apple) {
deps += [ "../build:apple_enable_arc" ]
}
if (crashpad_is_mac) { if (crashpad_is_mac) {
frameworks = [ "Foundation.framework" ] frameworks = [ "Foundation.framework" ]
} }

View File

@ -27,6 +27,10 @@
#include "base/strings/sys_string_conversions.h" #include "base/strings/sys_string_conversions.h"
#include "build/build_config.h" #include "build/build_config.h"
#if !defined(__has_feature) || !__has_feature(objc_arc)
#error "This file requires ARC support."
#endif
namespace { namespace {
std::string ReadStringSysctlByName(const char* name) { std::string ReadStringSysctlByName(const char* name) {

View File

@ -16,12 +16,17 @@
#import <Foundation/Foundation.h> #import <Foundation/Foundation.h>
#include "base/apple/bridging.h"
#include "base/mac/foundation_util.h" #include "base/mac/foundation_util.h"
#include "base/mac/scoped_launch_data.h"
#include "base/mac/scoped_cftyperef.h" #include "base/mac/scoped_cftyperef.h"
#include "base/mac/scoped_launch_data.h"
#include "base/strings/sys_string_conversions.h" #include "base/strings/sys_string_conversions.h"
#include "util/misc/implicit_cast.h" #include "util/misc/implicit_cast.h"
#if !defined(__has_feature) || !__has_feature(objc_arc)
#error "This file requires ARC support."
#endif
namespace crashpad { namespace crashpad {
launch_data_t CFPropertyToLaunchData(CFPropertyListRef property_cf) { launch_data_t CFPropertyToLaunchData(CFPropertyListRef property_cf) {
@ -34,7 +39,7 @@ launch_data_t CFPropertyToLaunchData(CFPropertyListRef property_cf) {
CFTypeID type_id_cf = CFGetTypeID(property_cf); CFTypeID type_id_cf = CFGetTypeID(property_cf);
if (type_id_cf == CFDictionaryGetTypeID()) { if (type_id_cf == CFDictionaryGetTypeID()) {
NSDictionary* dictionary_ns = base::mac::CFToNSCast( NSDictionary* dictionary_ns = base::apple::CFToNSPtrCast(
base::mac::CFCastStrict<CFDictionaryRef>(property_cf)); base::mac::CFCastStrict<CFDictionaryRef>(property_cf));
base::mac::ScopedLaunchData dictionary_launch( base::mac::ScopedLaunchData dictionary_launch(
LaunchDataAlloc(LAUNCH_DATA_DICTIONARY)); LaunchDataAlloc(LAUNCH_DATA_DICTIONARY));
@ -45,7 +50,7 @@ launch_data_t CFPropertyToLaunchData(CFPropertyListRef property_cf) {
} }
CFPropertyListRef value_cf = CFPropertyListRef value_cf =
implicit_cast<CFPropertyListRef>(dictionary_ns[key]); (__bridge CFPropertyListRef)dictionary_ns[key];
launch_data_t value_launch = CFPropertyToLaunchData(value_cf); launch_data_t value_launch = CFPropertyToLaunchData(value_cf);
if (!value_launch) { if (!value_launch) {
return nullptr; return nullptr;
@ -58,15 +63,14 @@ launch_data_t CFPropertyToLaunchData(CFPropertyListRef property_cf) {
data_launch = dictionary_launch.release(); data_launch = dictionary_launch.release();
} else if (type_id_cf == CFArrayGetTypeID()) { } else if (type_id_cf == CFArrayGetTypeID()) {
NSArray* array_ns = base::mac::CFToNSCast( NSArray* array_ns = base::apple::CFToNSPtrCast(
base::mac::CFCastStrict<CFArrayRef>(property_cf)); base::mac::CFCastStrict<CFArrayRef>(property_cf));
base::mac::ScopedLaunchData array_launch( base::mac::ScopedLaunchData array_launch(
LaunchDataAlloc(LAUNCH_DATA_ARRAY)); LaunchDataAlloc(LAUNCH_DATA_ARRAY));
size_t index = 0; size_t index = 0;
for (id element_ns in array_ns) { for (id element_ns in array_ns) {
CFPropertyListRef element_cf = CFPropertyListRef element_cf = (__bridge CFPropertyListRef)element_ns;
implicit_cast<CFPropertyListRef>(element_ns);
launch_data_t element_launch = CFPropertyToLaunchData(element_cf); launch_data_t element_launch = CFPropertyToLaunchData(element_cf);
if (!element_launch) { if (!element_launch) {
return nullptr; return nullptr;
@ -79,7 +83,7 @@ launch_data_t CFPropertyToLaunchData(CFPropertyListRef property_cf) {
} else if (type_id_cf == CFNumberGetTypeID()) { } else if (type_id_cf == CFNumberGetTypeID()) {
CFNumberRef number_cf = base::mac::CFCastStrict<CFNumberRef>(property_cf); CFNumberRef number_cf = base::mac::CFCastStrict<CFNumberRef>(property_cf);
NSNumber* number_ns = base::mac::CFToNSCast(number_cf); NSNumber* number_ns = base::apple::CFToNSPtrCast(number_cf);
switch (CFNumberGetType(number_cf)) { switch (CFNumberGetType(number_cf)) {
case kCFNumberSInt8Type: case kCFNumberSInt8Type:
case kCFNumberSInt16Type: case kCFNumberSInt16Type:
@ -113,7 +117,7 @@ launch_data_t CFPropertyToLaunchData(CFPropertyListRef property_cf) {
data_launch = LaunchDataNewBool(CFBooleanGetValue(boolean_cf)); data_launch = LaunchDataNewBool(CFBooleanGetValue(boolean_cf));
} else if (type_id_cf == CFStringGetTypeID()) { } else if (type_id_cf == CFStringGetTypeID()) {
NSString* string_ns = base::mac::CFToNSCast( NSString* string_ns = base::apple::CFToNSPtrCast(
base::mac::CFCastStrict<CFStringRef>(property_cf)); base::mac::CFCastStrict<CFStringRef>(property_cf));
// -fileSystemRepresentation might be more correct than -UTF8String, // -fileSystemRepresentation might be more correct than -UTF8String,
@ -125,7 +129,7 @@ launch_data_t CFPropertyToLaunchData(CFPropertyListRef property_cf) {
data_launch = LaunchDataNewString([string_ns UTF8String]); data_launch = LaunchDataNewString([string_ns UTF8String]);
} else if (type_id_cf == CFDataGetTypeID()) { } else if (type_id_cf == CFDataGetTypeID()) {
NSData* data_ns = base::mac::CFToNSCast( NSData* data_ns = base::apple::CFToNSPtrCast(
base::mac::CFCastStrict<CFDataRef>(property_cf)); base::mac::CFCastStrict<CFDataRef>(property_cf));
data_launch = LaunchDataNewOpaque([data_ns bytes], [data_ns length]); data_launch = LaunchDataNewOpaque([data_ns bytes], [data_ns length]);
} else { } else {

View File

@ -23,10 +23,15 @@
#include <iterator> #include <iterator>
#include <limits> #include <limits>
#include "base/apple/bridging.h"
#include "base/mac/scoped_launch_data.h" #include "base/mac/scoped_launch_data.h"
#include "gtest/gtest.h" #include "gtest/gtest.h"
#include "util/stdlib/objc.h" #include "util/stdlib/objc.h"
#if !defined(__has_feature) || !__has_feature(objc_arc)
#error "This file requires ARC support."
#endif
namespace crashpad { namespace crashpad {
namespace test { namespace test {
namespace { namespace {
@ -60,7 +65,8 @@ TEST(Launchd, CFPropertyToLaunchData_Integer) {
for (size_t index = 0; index < std::size(integer_nses); ++index) { for (size_t index = 0; index < std::size(integer_nses); ++index) {
NSNumber* integer_ns = integer_nses[index]; NSNumber* integer_ns = integer_nses[index];
launch_data.reset(CFPropertyToLaunchData(integer_ns)); launch_data.reset(
CFPropertyToLaunchData(base::apple::NSToCFPtrCast(integer_ns)));
ASSERT_TRUE(launch_data.get()); ASSERT_TRUE(launch_data.get());
ASSERT_EQ(LaunchDataGetType(launch_data.get()), LAUNCH_DATA_INTEGER); ASSERT_EQ(LaunchDataGetType(launch_data.get()), LAUNCH_DATA_INTEGER);
EXPECT_EQ(LaunchDataGetInteger(launch_data.get()), EXPECT_EQ(LaunchDataGetInteger(launch_data.get()),
@ -90,7 +96,8 @@ TEST(Launchd, CFPropertyToLaunchData_FloatingPoint) {
for (size_t index = 0; index < std::size(double_nses); ++index) { for (size_t index = 0; index < std::size(double_nses); ++index) {
NSNumber* double_ns = double_nses[index]; NSNumber* double_ns = double_nses[index];
launch_data.reset(CFPropertyToLaunchData(double_ns)); launch_data.reset(
CFPropertyToLaunchData(base::apple::NSToCFPtrCast(double_ns)));
ASSERT_TRUE(launch_data.get()); ASSERT_TRUE(launch_data.get());
ASSERT_EQ(LaunchDataGetType(launch_data.get()), LAUNCH_DATA_REAL); ASSERT_EQ(LaunchDataGetType(launch_data.get()), LAUNCH_DATA_REAL);
double expected_double_value = [double_ns doubleValue]; double expected_double_value = [double_ns doubleValue];
@ -109,17 +116,19 @@ TEST(Launchd, CFPropertyToLaunchData_Boolean) {
@autoreleasepool { @autoreleasepool {
base::mac::ScopedLaunchData launch_data; base::mac::ScopedLaunchData launch_data;
NSNumber* bool_nses[] = { // Use CFBooleanRefs here because calling NSToCFPtrCast on an NSNumber
@NO, // boolean can fail. Casting an NSNumber expects a CFNumberRef as a result
@YES, // but a cast boolean will end up as a CFBooleanRef.
CFBooleanRef bools[] = {
kCFBooleanFalse,
kCFBooleanTrue,
}; };
for (size_t index = 0; index < std::size(bool_nses); ++index) { for (CFBooleanRef bool_cf : bools) {
NSNumber* bool_ns = bool_nses[index]; launch_data.reset(CFPropertyToLaunchData(bool_cf));
launch_data.reset(CFPropertyToLaunchData(bool_ns));
ASSERT_TRUE(launch_data.get()); ASSERT_TRUE(launch_data.get());
ASSERT_EQ(LaunchDataGetType(launch_data.get()), LAUNCH_DATA_BOOL); ASSERT_EQ(LaunchDataGetType(launch_data.get()), LAUNCH_DATA_BOOL);
if ([bool_ns boolValue]) { if (CFBooleanGetValue(bool_cf)) {
EXPECT_TRUE(LaunchDataGetBool(launch_data.get())); EXPECT_TRUE(LaunchDataGetBool(launch_data.get()));
} else { } else {
EXPECT_FALSE(LaunchDataGetBool(launch_data.get())); EXPECT_FALSE(LaunchDataGetBool(launch_data.get()));
@ -140,7 +149,8 @@ TEST(Launchd, CFPropertyToLaunchData_String) {
for (size_t index = 0; index < std::size(string_nses); ++index) { for (size_t index = 0; index < std::size(string_nses); ++index) {
NSString* string_ns = string_nses[index]; NSString* string_ns = string_nses[index];
launch_data.reset(CFPropertyToLaunchData(string_ns)); launch_data.reset(
CFPropertyToLaunchData(base::apple::NSToCFPtrCast(string_ns)));
ASSERT_TRUE(launch_data.get()); ASSERT_TRUE(launch_data.get());
ASSERT_EQ(LaunchDataGetType(launch_data.get()), LAUNCH_DATA_STRING); ASSERT_EQ(LaunchDataGetType(launch_data.get()), LAUNCH_DATA_STRING);
EXPECT_STREQ([string_ns UTF8String], EXPECT_STREQ([string_ns UTF8String],
@ -156,7 +166,8 @@ TEST(Launchd, CFPropertyToLaunchData_Data) {
static constexpr uint8_t data_c[] = { static constexpr uint8_t data_c[] = {
1, 2, 3, 4, 5, 6, 7, 8, 0, 0, 0, 0, 0, 0, 0, 0, 9, 8, 7, 6, 5, 4, 3, 2}; 1, 2, 3, 4, 5, 6, 7, 8, 0, 0, 0, 0, 0, 0, 0, 0, 9, 8, 7, 6, 5, 4, 3, 2};
NSData* data_ns = [NSData dataWithBytes:data_c length:sizeof(data_c)]; NSData* data_ns = [NSData dataWithBytes:data_c length:sizeof(data_c)];
launch_data.reset(CFPropertyToLaunchData(data_ns)); launch_data.reset(
CFPropertyToLaunchData(base::apple::NSToCFPtrCast(data_ns)));
ASSERT_TRUE(launch_data.get()); ASSERT_TRUE(launch_data.get());
ASSERT_EQ(LaunchDataGetType(launch_data.get()), LAUNCH_DATA_OPAQUE); ASSERT_EQ(LaunchDataGetType(launch_data.get()), LAUNCH_DATA_OPAQUE);
EXPECT_EQ(LaunchDataGetOpaqueSize(launch_data.get()), sizeof(data_c)); EXPECT_EQ(LaunchDataGetOpaqueSize(launch_data.get()), sizeof(data_c));
@ -174,7 +185,8 @@ TEST(Launchd, CFPropertyToLaunchData_Dictionary) {
@"key" : @"value", @"key" : @"value",
}; };
launch_data.reset(CFPropertyToLaunchData(dictionary_ns)); launch_data.reset(
CFPropertyToLaunchData(base::apple::NSToCFPtrCast(dictionary_ns)));
ASSERT_TRUE(launch_data.get()); ASSERT_TRUE(launch_data.get());
ASSERT_EQ(LaunchDataGetType(launch_data.get()), LAUNCH_DATA_DICTIONARY); ASSERT_EQ(LaunchDataGetType(launch_data.get()), LAUNCH_DATA_DICTIONARY);
EXPECT_EQ(LaunchDataDictGetCount(launch_data.get()), [dictionary_ns count]); EXPECT_EQ(LaunchDataDictGetCount(launch_data.get()), [dictionary_ns count]);
@ -193,7 +205,8 @@ TEST(Launchd, CFPropertyToLaunchData_Array) {
NSArray* array_ns = @[ @"element_1", @"element_2", ]; NSArray* array_ns = @[ @"element_1", @"element_2", ];
launch_data.reset(CFPropertyToLaunchData(array_ns)); launch_data.reset(
CFPropertyToLaunchData(base::apple::NSToCFPtrCast(array_ns)));
ASSERT_TRUE(launch_data.get()); ASSERT_TRUE(launch_data.get());
ASSERT_EQ(LaunchDataGetType(launch_data.get()), LAUNCH_DATA_ARRAY); ASSERT_EQ(LaunchDataGetType(launch_data.get()), LAUNCH_DATA_ARRAY);
EXPECT_EQ(LaunchDataArrayGetCount(launch_data.get()), [array_ns count]); EXPECT_EQ(LaunchDataArrayGetCount(launch_data.get()), [array_ns count]);
@ -219,18 +232,20 @@ TEST(Launchd, CFPropertyToLaunchData_NSDate) {
base::mac::ScopedLaunchData launch_data; base::mac::ScopedLaunchData launch_data;
NSDate* date = [NSDate date]; NSDate* date = [NSDate date];
launch_data.reset(CFPropertyToLaunchData(date)); launch_data.reset(CFPropertyToLaunchData(base::apple::NSToCFPtrCast(date)));
EXPECT_FALSE(launch_data.get()); EXPECT_FALSE(launch_data.get());
NSDictionary* date_dictionary = @{ NSDictionary* date_dictionary = @{
@"key" : @"value", @"key" : @"value",
@"date" : date, @"date" : date,
}; };
launch_data.reset(CFPropertyToLaunchData(date_dictionary)); launch_data.reset(
CFPropertyToLaunchData(base::apple::NSToCFPtrCast(date_dictionary)));
EXPECT_FALSE(launch_data.get()); EXPECT_FALSE(launch_data.get());
NSArray* date_array = @[ @"string_1", date, @"string_2", ]; NSArray* date_array = @[ @"string_1", date, @"string_2", ];
launch_data.reset(CFPropertyToLaunchData(date_array)); launch_data.reset(
CFPropertyToLaunchData(base::apple::NSToCFPtrCast(date_array)));
EXPECT_FALSE(launch_data.get()); EXPECT_FALSE(launch_data.get());
} }
} }
@ -249,7 +264,8 @@ TEST(Launchd, CFPropertyToLaunchData_RealWorldJobDictionary) {
}, },
}; };
launch_data.reset(CFPropertyToLaunchData(job_dictionary)); launch_data.reset(
CFPropertyToLaunchData(base::apple::NSToCFPtrCast(job_dictionary)));
ASSERT_TRUE(launch_data.get()); ASSERT_TRUE(launch_data.get());
ASSERT_EQ(LaunchDataGetType(launch_data.get()), LAUNCH_DATA_DICTIONARY); ASSERT_EQ(LaunchDataGetType(launch_data.get()), LAUNCH_DATA_DICTIONARY);
EXPECT_EQ(LaunchDataDictGetCount(launch_data.get()), 4u); EXPECT_EQ(LaunchDataDictGetCount(launch_data.get()), 4u);

View File

@ -19,10 +19,13 @@
#include <string> #include <string>
#include "base/mac/scoped_nsobject.h"
#include "base/strings/stringprintf.h" #include "base/strings/stringprintf.h"
#include "gtest/gtest.h" #include "gtest/gtest.h"
#if !defined(__has_feature) || !__has_feature(objc_arc)
#error "This file requires ARC support."
#endif
namespace crashpad { namespace crashpad {
namespace test { namespace test {
namespace { namespace {
@ -33,8 +36,8 @@ namespace {
// check for with ASSERT_NO_FATAL_FAILURE() or testing::Test::HasFatalFailure(). // check for with ASSERT_NO_FATAL_FAILURE() or testing::Test::HasFatalFailure().
void SwVers(NSString* argument, std::string* output) { void SwVers(NSString* argument, std::string* output) {
@autoreleasepool { @autoreleasepool {
base::scoped_nsobject<NSPipe> pipe([[NSPipe alloc] init]); NSPipe* pipe = [[NSPipe alloc] init];
base::scoped_nsobject<NSTask> task([[NSTask alloc] init]); NSTask* task = [[NSTask alloc] init];
[task setStandardOutput:pipe]; [task setStandardOutput:pipe];
[task setLaunchPath:@"/usr/bin/sw_vers"]; [task setLaunchPath:@"/usr/bin/sw_vers"];
[task setArguments:@[ argument ]]; [task setArguments:@[ argument ]];

View File

@ -20,7 +20,7 @@
#include <string> #include <string>
#include <vector> #include <vector>
#include "base/mac/foundation_util.h" #include "base/apple/bridging.h"
#include "base/mac/scoped_cftyperef.h" #include "base/mac/scoped_cftyperef.h"
#include "base/strings/stringprintf.h" #include "base/strings/stringprintf.h"
#include "base/strings/sys_string_conversions.h" #include "base/strings/sys_string_conversions.h"
@ -30,6 +30,10 @@
#include "util/posix/process_info.h" #include "util/posix/process_info.h"
#include "util/stdlib/objc.h" #include "util/stdlib/objc.h"
#if !defined(__has_feature) || !__has_feature(objc_arc)
#error "This file requires ARC support."
#endif
namespace crashpad { namespace crashpad {
namespace test { namespace test {
namespace { namespace {
@ -124,7 +128,7 @@ TEST(ServiceManagement, SubmitRemoveJob) {
@[ @"/bin/sh", @"-c", shell_script_ns, ], @[ @"/bin/sh", @"-c", shell_script_ns, ],
}; };
CFDictionaryRef job_dictionary_cf = CFDictionaryRef job_dictionary_cf =
base::mac::NSToCFCast(job_dictionary_ns); base::apple::NSToCFPtrCast(job_dictionary_ns);
// The job may be left over from a failed previous run. // The job may be left over from a failed previous run.
if (ServiceManagementIsJobLoaded(kJobLabel)) { if (ServiceManagementIsJobLoaded(kJobLabel)) {

View File

@ -17,8 +17,8 @@
#import <Foundation/Foundation.h> #import <Foundation/Foundation.h>
#include <sys/utsname.h> #include <sys/utsname.h>
#include "base/apple/bridging.h"
#include "base/mac/foundation_util.h" #include "base/mac/foundation_util.h"
#import "base/mac/scoped_nsobject.h"
#include "base/strings/stringprintf.h" #include "base/strings/stringprintf.h"
#include "base/strings/sys_string_conversions.h" #include "base/strings/sys_string_conversions.h"
#include "build/build_config.h" #include "build/build_config.h"
@ -28,12 +28,16 @@
#include "util/misc/metrics.h" #include "util/misc/metrics.h"
#include "util/net/http_body.h" #include "util/net/http_body.h"
#if !defined(__has_feature) || !__has_feature(objc_arc)
#error "This file requires ARC support."
#endif
// An implementation of NSInputStream that reads from a // An implementation of NSInputStream that reads from a
// crashpad::HTTPBodyStream. // crashpad::HTTPBodyStream.
@interface CrashpadHTTPBodyStreamTransport : NSInputStream { @interface CrashpadHTTPBodyStreamTransport : NSInputStream {
@private @private
NSStreamStatus _streamStatus; NSStreamStatus _streamStatus;
id<NSStreamDelegate> _delegate; id<NSStreamDelegate> __strong _delegate;
crashpad::HTTPBodyStream* _bodyStream; // weak crashpad::HTTPBodyStream* _bodyStream; // weak
} }
- (instancetype)initWithBodyStream:(crashpad::HTTPBodyStream*)bodyStream; - (instancetype)initWithBodyStream:(crashpad::HTTPBodyStream*)bodyStream;
@ -154,12 +158,13 @@ NSString* UserAgentString() {
// Expected to be CFNetwork. // Expected to be CFNetwork.
NSBundle* nsurl_bundle = [NSBundle bundleForClass:[NSURLRequest class]]; NSBundle* nsurl_bundle = [NSBundle bundleForClass:[NSURLRequest class]];
NSString* bundle_name = base::mac::ObjCCast<NSString>([nsurl_bundle NSString* bundle_name = base::mac::ObjCCast<NSString>([nsurl_bundle
objectForInfoDictionaryKey:base::mac::CFToNSCast(kCFBundleNameKey)]); objectForInfoDictionaryKey:base::apple::CFToNSPtrCast(kCFBundleNameKey)]);
if (bundle_name) { if (bundle_name) {
user_agent = AppendEscapedFormat(user_agent, @" %@", bundle_name); user_agent = AppendEscapedFormat(user_agent, @" %@", bundle_name);
NSString* bundle_version = base::mac::ObjCCast<NSString>([nsurl_bundle NSString* bundle_version = base::mac::ObjCCast<NSString>(
objectForInfoDictionaryKey:base::mac::CFToNSCast(kCFBundleVersionKey)]); [nsurl_bundle objectForInfoDictionaryKey:base::apple::CFToNSPtrCast(
kCFBundleVersionKey)]);
if (bundle_version) { if (bundle_version) {
user_agent = AppendEscapedFormat(user_agent, @"/%@", bundle_version); user_agent = AppendEscapedFormat(user_agent, @"/%@", bundle_version);
} }
@ -240,10 +245,9 @@ bool HTTPTransportMac::ExecuteSynchronously(std::string* response_body) {
forHTTPHeaderField:base::SysUTF8ToNSString(pair.first)]; forHTTPHeaderField:base::SysUTF8ToNSString(pair.first)];
} }
base::scoped_nsobject<NSInputStream> input_stream( NSInputStream* input_stream = [[CrashpadHTTPBodyStreamTransport alloc]
[[CrashpadHTTPBodyStreamTransport alloc] initWithBodyStream:body_stream()];
initWithBodyStream:body_stream()]); [request setHTTPBodyStream:input_stream];
[request setHTTPBodyStream:input_stream.get()];
NSURLResponse* response = nil; NSURLResponse* response = nil;
NSError* error = nil; NSError* error = nil;