xref: /aosp_15_r20/external/cronet/testing/platform_test_mac.mm (revision 6777b5387eb2ff775bb5750e3f5d96f37fb7352b)
1*6777b538SAndroid Build Coastguard Worker// Copyright 2006-2008 The Chromium Authors
2*6777b538SAndroid Build Coastguard Worker// Use of this source code is governed by a BSD-style license that can be
3*6777b538SAndroid Build Coastguard Worker// found in the LICENSE file.
4*6777b538SAndroid Build Coastguard Worker
5*6777b538SAndroid Build Coastguard Worker#include "platform_test.h"
6*6777b538SAndroid Build Coastguard Worker
7*6777b538SAndroid Build Coastguard Worker// /!\ WARNING!
8*6777b538SAndroid Build Coastguard Worker//
9*6777b538SAndroid Build Coastguard Worker// Chromium compiles this file as ARC, but other dependencies pull it in and
10*6777b538SAndroid Build Coastguard Worker// compile it as non-ARC. Be sure that this file compiles correctly with either
11*6777b538SAndroid Build Coastguard Worker// build setting.
12*6777b538SAndroid Build Coastguard Worker//
13*6777b538SAndroid Build Coastguard Worker// /!\ WARNING!
14*6777b538SAndroid Build Coastguard Worker
15*6777b538SAndroid Build Coastguard Worker// Note that this uses the direct runtime interface to the autorelease pool.
16*6777b538SAndroid Build Coastguard Worker// https://clang.llvm.org/docs/AutomaticReferenceCounting.html#runtime-support
17*6777b538SAndroid Build Coastguard Worker// This is so this can work correctly whether or not it's compiled for ARC.
18*6777b538SAndroid Build Coastguard Worker
19*6777b538SAndroid Build Coastguard Workerextern "C" {
20*6777b538SAndroid Build Coastguard Workervoid* objc_autoreleasePoolPush(void);
21*6777b538SAndroid Build Coastguard Workervoid objc_autoreleasePoolPop(void* pool);
22*6777b538SAndroid Build Coastguard Worker}
23*6777b538SAndroid Build Coastguard Worker
24*6777b538SAndroid Build Coastguard WorkerPlatformTest::PlatformTest() : autorelease_pool_(objc_autoreleasePoolPush()) {}
25*6777b538SAndroid Build Coastguard Worker
26*6777b538SAndroid Build Coastguard WorkerPlatformTest::~PlatformTest() {
27*6777b538SAndroid Build Coastguard Worker  objc_autoreleasePoolPop(autorelease_pool_);
28*6777b538SAndroid Build Coastguard Worker}
29