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