iOS/macOS: migrate darwin/common to ARC (flutter/engine#56155)
Migrates //flutter/shell/platform/darwin/common` targets to ARC. Most of these were already ARC compatible. This does add use of the `FLUTTER_ASSERT_ARC` define since that is defined in a public framework header, but this code has no dependency on the framework. This removes `flutter_cflags_objc` and `flutter_cflags_objcc` compile configs from `availability_version_check_unittests` since that target is pure C++ and contains no Objective-C code. No test changes since this there is no semantic change to the code. Issue: https://github.com/flutter/flutter/issues/137801
This commit is contained in:
@@ -9,8 +9,8 @@ import("//flutter/testing/testing.gni")
|
||||
import("framework_common.gni")
|
||||
|
||||
source_set("common") {
|
||||
cflags_objc = flutter_cflags_objc
|
||||
cflags_objcc = flutter_cflags_objcc
|
||||
cflags_objc = flutter_cflags_objc_arc
|
||||
cflags_objcc = flutter_cflags_objcc_arc
|
||||
|
||||
sources = [
|
||||
"buffer_conversions.h",
|
||||
@@ -40,9 +40,6 @@ source_set("common") {
|
||||
# See: Upstream clang change: https://reviews.llvm.org/D150397
|
||||
# See: https://github.com/flutter/flutter/issues/133777
|
||||
source_set("availability_version_check") {
|
||||
cflags_objc = flutter_cflags_objc
|
||||
cflags_objcc = flutter_cflags_objcc
|
||||
|
||||
sources = [ "availability_version_check.cc" ]
|
||||
|
||||
deps = [ "//flutter/fml" ]
|
||||
|
||||
@@ -7,22 +7,22 @@
|
||||
#include "flutter/fml/macros.h"
|
||||
#include "flutter/fml/platform/darwin/scoped_nsobject.h"
|
||||
|
||||
static_assert(__has_feature(objc_arc), "ARC must be enabled.");
|
||||
|
||||
namespace flutter {
|
||||
namespace {
|
||||
class NSDataMapping : public fml::Mapping {
|
||||
public:
|
||||
explicit NSDataMapping(NSData* data) : data_([data retain]) {}
|
||||
explicit NSDataMapping(NSData* data) : data_(data) {}
|
||||
|
||||
size_t GetSize() const override { return [data_.get() length]; }
|
||||
size_t GetSize() const override { return data_.length; }
|
||||
|
||||
const uint8_t* GetMapping() const override {
|
||||
return static_cast<const uint8_t*>([data_.get() bytes]);
|
||||
}
|
||||
const uint8_t* GetMapping() const override { return static_cast<const uint8_t*>(data_.bytes); }
|
||||
|
||||
bool IsDontNeedSafe() const override { return false; }
|
||||
|
||||
private:
|
||||
fml::scoped_nsobject<NSData> data_;
|
||||
NSData* data_;
|
||||
FML_DISALLOW_COPY_AND_ASSIGN(NSDataMapping);
|
||||
};
|
||||
} // namespace
|
||||
|
||||
@@ -6,6 +6,8 @@
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
static_assert(__has_feature(objc_arc), "ARC must be enabled.");
|
||||
|
||||
namespace flutter {
|
||||
|
||||
fml::CommandLine CommandLineFromNSProcessInfo(NSProcessInfo* processInfoOrNil) {
|
||||
|
||||
Reference in New Issue
Block a user