Skip to content

Commit

Permalink
Merge branch 'release/0.7.9'
Browse files Browse the repository at this point in the history
  • Loading branch information
yulingtianxia committed Dec 1, 2022
2 parents 744b945 + 21ec068 commit b87500b
Show file tree
Hide file tree
Showing 83 changed files with 3,940 additions and 3,582 deletions.
6 changes: 6 additions & 0 deletions dart_native/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
## 0.7.9

* Bump to ffi >=1.1.2
* [Fix] Thread Performance Checker issue
* [Fix] Flutter debug warning

## 0.7.8

* [Fix] Build error on Xcode 12.
Expand Down
2 changes: 1 addition & 1 deletion dart_native/example/ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ SPEC CHECKSUMS:
ClassWrittenInSwift: 84b95c3ec2633b0a18ffdcabf8365a5833a2154c
CocoaLumberjack: 543c79c114dadc3b1aba95641d8738b06b05b646
dart_native: a9824de4c77f34e6a27da6d8eb21784efd5512c7
Flutter: 434fef37c0980e73bb6479ef766c45957d4b510c
Flutter: 50d75fe2f02b26cc09d224853bb45737f8b3214a

PODFILE CHECKSUM: 6e9979e89c4dd9698b3ed55a88e6a5100fa0dc38

Expand Down
4 changes: 4 additions & 0 deletions dart_native/example/ios/Runner/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -45,5 +45,9 @@
</array>
<key>UIViewControllerBasedStatusBarAppearance</key>
<true/>
<key>NSBonjourServices</key>
<array>
<string>_dartobservatory._tcp</string>
</array>
</dict>
</plist>
2 changes: 1 addition & 1 deletion dart_native/example/ios/Runner/RuntimeStub.m
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ - (instancetype)init {
self = [super init];
if (self) {
_object = [NSObject new];
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1 * NSEC_PER_SEC)), dispatch_get_global_queue(QOS_CLASS_DEFAULT, 0), ^{
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1 * NSEC_PER_SEC)), dispatch_get_global_queue(QOS_CLASS_BACKGROUND, 0), ^{
[NSNotificationCenter.defaultCenter postNotificationName:@"SampleDartNotification" object:nil];
});
}
Expand Down
10 changes: 5 additions & 5 deletions dart_native/example/macos/Podfile.lock
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
PODS:
- ClassWrittenInSwift (0.0.4)
- ClassWrittenInSwift (0.0.5)
- CocoaLumberjack/Core (3.7.4)
- CocoaLumberjack/Swift (3.7.4):
- CocoaLumberjack/Core
- dart_native (0.0.1):
- ClassWrittenInSwift (~> 0.0.4)
- ClassWrittenInSwift (~> 0.0.5)
- FlutterMacOS
- FlutterMacOS (1.0.0)

Expand All @@ -25,11 +25,11 @@ EXTERNAL SOURCES:
:path: Flutter/ephemeral

SPEC CHECKSUMS:
ClassWrittenInSwift: de0543e7c1a836e190af74fddff84ad9b2f3d18c
ClassWrittenInSwift: 84b95c3ec2633b0a18ffdcabf8365a5833a2154c
CocoaLumberjack: 543c79c114dadc3b1aba95641d8738b06b05b646
dart_native: 1d89c58404bf2295b0725d24af16a907b1322fdd
dart_native: 82f498a2edc283e94eac2d8ca51d609bdc52e74f
FlutterMacOS: 57701585bf7de1b3fc2bb61f6378d73bbdea8424

PODFILE CHECKSUM: 6134e1091881200875eedf81c63588922d4384ec

COCOAPODS: 1.11.2
COCOAPODS: 1.11.3
37 changes: 22 additions & 15 deletions dart_native/example/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@ packages:
name: _fe_analyzer_shared
url: "https://pub.dartlang.org"
source: hosted
version: "22.0.0"
version: "31.0.0"
analyzer:
dependency: transitive
description:
name: analyzer
url: "https://pub.dartlang.org"
source: hosted
version: "1.7.1"
version: "2.8.0"
args:
dependency: transitive
description:
Expand All @@ -28,7 +28,7 @@ packages:
name: async
url: "https://pub.dartlang.org"
source: hosted
version: "2.6.1"
version: "2.8.2"
boolean_selector:
dependency: transitive
description:
Expand Down Expand Up @@ -98,14 +98,14 @@ packages:
name: characters
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.0"
version: "1.2.0"
charcode:
dependency: transitive
description:
name: charcode
url: "https://pub.dartlang.org"
source: hosted
version: "1.2.0"
version: "1.3.1"
checked_yaml:
dependency: transitive
description:
Expand Down Expand Up @@ -140,7 +140,7 @@ packages:
name: collection
url: "https://pub.dartlang.org"
source: hosted
version: "1.15.0"
version: "1.16.0"
convert:
dependency: transitive
description:
Expand Down Expand Up @@ -168,7 +168,7 @@ packages:
path: ".."
relative: true
source: path
version: "0.7.8"
version: "0.7.9"
dart_native_gen:
dependency: transitive
description:
Expand All @@ -189,7 +189,7 @@ packages:
name: fake_async
url: "https://pub.dartlang.org"
source: hosted
version: "1.2.0"
version: "1.3.0"
ffi:
dependency: transitive
description:
Expand Down Expand Up @@ -297,14 +297,21 @@ packages:
name: matcher
url: "https://pub.dartlang.org"
source: hosted
version: "0.12.10"
version: "0.12.11"
material_color_utilities:
dependency: transitive
description:
name: material_color_utilities
url: "https://pub.dartlang.org"
source: hosted
version: "0.1.4"
meta:
dependency: transitive
description:
name: meta
url: "https://pub.dartlang.org"
source: hosted
version: "1.3.0"
version: "1.7.0"
mime:
dependency: transitive
description:
Expand All @@ -325,7 +332,7 @@ packages:
name: path
url: "https://pub.dartlang.org"
source: hosted
version: "1.8.0"
version: "1.8.1"
pedantic:
dependency: transitive
description:
Expand Down Expand Up @@ -386,7 +393,7 @@ packages:
name: source_span
url: "https://pub.dartlang.org"
source: hosted
version: "1.8.1"
version: "1.8.2"
stack_trace:
dependency: transitive
description:
Expand Down Expand Up @@ -428,7 +435,7 @@ packages:
name: test_api
url: "https://pub.dartlang.org"
source: hosted
version: "0.3.0"
version: "0.4.9"
timing:
dependency: transitive
description:
Expand All @@ -449,7 +456,7 @@ packages:
name: vector_math
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.0"
version: "2.1.2"
watcher:
dependency: transitive
description:
Expand All @@ -472,5 +479,5 @@ packages:
source: hosted
version: "3.1.0"
sdks:
dart: ">=2.13.0 <3.0.0"
dart: ">=2.17.0-0 <3.0.0"
flutter: ">=2.2.0"
3 changes: 2 additions & 1 deletion dart_native/ios/Classes/DNAssociatedDartObject.m
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@

#import "DNAssociatedDartObject.h"
#import <objc/runtime.h>
#import "native_runtime.h"

#import "DNMemoryValidation.h"

#if !__has_feature(objc_arc)
#error
Expand Down
8 changes: 4 additions & 4 deletions dart_native/ios/Classes/DNBlockCreator.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,16 @@
//

#import <Foundation/Foundation.h>
#import "DNMacro.h"
#import "DNExtern.h"
#import "dart_api_dl.h"
#import "native_runtime.h"
#import "DNTypeEncoding.h"

#ifndef DNBlockCreator_h
#define DNBlockCreator_h

NS_ASSUME_NONNULL_BEGIN

#pragma mark - Block Layout
/// MARK: Block Layout

typedef void(*DNBlockCopyFunction)(void *, const void *);
typedef void(*DNBlockDisposeFunction)(const void *);
Expand Down Expand Up @@ -52,7 +52,7 @@ typedef struct DNBlock {
void *creator;
} DNBlock;

#pragma mark - Block Creator
/// MARK: Block Creator

DN_EXTERN const char *DNBlockTypeEncodeString(id blockObj);
DN_EXTERN const char *_Nonnull *_Nonnull DNBlockTypeEncodings(id blockObj);
Expand Down
16 changes: 10 additions & 6 deletions dart_native/ios/Classes/DNBlockCreator.m
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,23 @@
//

#import "DNBlockCreator.h"
#import <objc/runtime.h>
#import <stdatomic.h>

#import "ffi.h"
#import "DNFFIHelper.h"
#import "DNInvocation.h"
#import <objc/runtime.h>
#import "DNPointerWrapper.h"
#import "DNError.h"
#import <stdatomic.h>
#import "NSString+DartNative.h"
#import "DNObjCRuntime.h"
#import "DNDartBridge.h"

#if !__has_feature(objc_arc)
#error
#endif

#pragma mark - Block Helper
/// MARK: Block Helper

enum {
BLOCK_HAS_COPY_DISPOSE = (1 << 25),
Expand Down Expand Up @@ -72,7 +76,7 @@ void dispose_helper(DNBlock *src) {
CFRelease(src->creator);
}

#pragma mark - Block Wrapper
/// MARK: Block Wrapper

@interface DNBlockCreator () {
ffi_cif _cif;
Expand Down Expand Up @@ -190,7 +194,7 @@ - (id)blockWithError:(out NSError **)error {
return block;
}

#pragma mark - Private Method
/// MARK: Private Method

- (int)_prepCIF:(ffi_cif *)cif withEncodeString:(const char *)str flags:(int32_t)flags {
int argCount;
Expand Down Expand Up @@ -279,7 +283,7 @@ static void DNHandleReturnValue(void *origRet, DNBlockCreator *creator, DNInvoca
return;
} else if (creator.typeEncodings[0] == native_type_string) {
// type is native_type_object but result is a string
NSString *string = NSStringFromUTF16Data(*(const unichar **)ret);
NSString *string = [NSString dn_stringWithUTF16String:*(const unichar **)ret];
if (string) {
native_retain_object(string);
[invocation setReturnValue:&string];
Expand Down
2 changes: 1 addition & 1 deletion dart_native/ios/Classes/DNBlockHelper.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
//

#import <Foundation/Foundation.h>
#import "native_runtime.h"
#import "DNInterface.h"

NS_ASSUME_NONNULL_BEGIN

Expand Down
1 change: 1 addition & 0 deletions dart_native/ios/Classes/DNBlockHelper.m
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
//

#import "DNBlockHelper.h"
#import "DNDartBridge.h"

#if !__has_feature(objc_arc)
#error
Expand Down
59 changes: 59 additions & 0 deletions dart_native/ios/Classes/DNDartBridge.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
//
// DNDartBridge.h
// DartNative
//
// Created by 杨萧玉 on 2022/11/21.
//

#import <Foundation/Foundation.h>

#import "DNExtern.h"
#import "DNTypeEncoding.h"

@class DNBlockCreator;
@class DNMethod;
@class DNInvocation;

NS_ASSUME_NONNULL_BEGIN

/// MARK: Dart VM API

DN_EXTERN intptr_t InitDartApiDL(void *data);

/// MARK: Async Callback Basic

DN_EXTERN BOOL TestNotifyDart(Dart_Port send_port);

/// MARK: Async Block Callback

DN_EXTERN void NotifyBlockInvokeToDart(DNInvocation *invocation,
DNBlockCreator *wrapper,
int numberOfArguments);

/// MARK: Async Method Callback

DN_EXTERN void NotifyMethodPerformToDart(DNInvocation *invocation,
DNMethod *method,
int numberOfArguments,
const char *_Nonnull *_Nonnull types);

/// MARK: Memory Management

typedef NS_CLOSED_ENUM(NSUInteger, DNPassObjectResult) {
DNPassObjectResultFailed,
DNPassObjectResultSuccess,
DNPassObjectResultNeedless,
};

/// Bind the lifetime of an Objective-C object to a dart object.
/// @param h A dart object with identity.
/// @param pointer pointer to an Objective-C object.
DN_EXTERN DNPassObjectResult BindObjcLifecycleToDart(Dart_Handle h, void *pointer);

DN_EXTERN void RegisterDartFinalizer(Dart_Handle h, void *callback, void *key, Dart_Port dartPort);

DN_EXTERN void NotifyDeallocToDart(intptr_t address, Dart_Port dartPort);

DN_EXTERN void RegisterDeallocCallback(void (*callback)(intptr_t), Dart_Port dartPort);

NS_ASSUME_NONNULL_END
Loading

0 comments on commit b87500b

Please sign in to comment.