From b2acc7f51e09fdccbcd717c570db2a7b89c0791c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kasper=20Overg=C3=A5rd=20Nielsen?= Date: Thu, 14 Mar 2024 19:23:20 +0100 Subject: [PATCH 1/2] Update realm-core to v14.2.0-12-g95c6efce8 --- .../lib/src/native/realm_bindings.dart | 104 ++++++++---------- packages/realm_dart/src/realm-core | 2 +- 2 files changed, 44 insertions(+), 62 deletions(-) diff --git a/packages/realm_dart/lib/src/native/realm_bindings.dart b/packages/realm_dart/lib/src/native/realm_bindings.dart index 84dfe75b8..ca058be2a 100644 --- a/packages/realm_dart/lib/src/native/realm_bindings.dart +++ b/packages/realm_dart/lib/src/native/realm_bindings.dart @@ -5148,6 +5148,28 @@ class RealmLibrary { ffi.Pointer Function( ffi.Pointer, int, int)>(); + /// Get the actual log category names (currently 15) + /// @param num_values number of values in the out_values array + /// @param out_values pointer to an array of size num_values + /// @return returns the number of categories returned. If num_values is zero, it will + /// return the total number of categories. + int realm_get_category_names( + int num_values, + ffi.Pointer> out_values, + ) { + return _realm_get_category_names( + num_values, + out_values, + ); + } + + late final _realm_get_category_namesPtr = _lookup< + ffi.NativeFunction< + ffi.Size Function(ffi.Size, + ffi.Pointer>)>>('realm_get_category_names'); + late final _realm_get_category_names = _realm_get_category_namesPtr + .asFunction>)>(); + /// Get the class with @a key from the schema. /// /// Passing an invalid @a key for this schema is considered an error. @@ -5429,6 +5451,21 @@ class RealmLibrary { late final _realm_get_list = _realm_get_listPtr.asFunction< ffi.Pointer Function(ffi.Pointer, int)>(); + /// Get the logging level for given category. + int realm_get_log_level_category( + ffi.Pointer arg0, + ) { + return _realm_get_log_level_category( + arg0, + ); + } + + late final _realm_get_log_level_categoryPtr = + _lookup)>>( + 'realm_get_log_level_category'); + late final _realm_get_log_level_category = _realm_get_log_level_categoryPtr + .asFunction)>(); + /// Return the number of classes in the Realm's schema. /// /// This cannot fail. @@ -8506,24 +8543,6 @@ class RealmLibrary { late final _realm_scheduler_get_frozen = _realm_scheduler_get_frozenPtr .asFunction Function()>(); - /// Returns true if there is a default scheduler implementation for the current - /// platform, or one has been set with `realm_scheduler_set_default_factory()`. - /// - /// If there is no default factory, and no scheduler is provided in the config, - /// `realm_open()` will fail. Note that `realm_scheduler_get_frozen()` always - /// returns a valid scheduler. - /// - /// This function is thread-safe, and cannot fail. - bool realm_scheduler_has_default_factory() { - return _realm_scheduler_has_default_factory(); - } - - late final _realm_scheduler_has_default_factoryPtr = - _lookup>( - 'realm_scheduler_has_default_factory'); - late final _realm_scheduler_has_default_factory = - _realm_scheduler_has_default_factoryPtr.asFunction(); - /// Create an instance of the default scheduler for the current platform, /// normally confined to the calling thread. ffi.Pointer realm_scheduler_make_default() { @@ -8606,40 +8625,6 @@ class RealmLibrary { late final _realm_scheduler_perform_work = _realm_scheduler_perform_workPtr .asFunction)>(); - /// For platforms with no default scheduler implementation, register a factory - /// function which can produce custom schedulers. If there is a platform-specific - /// scheduler, this function will fail. If a custom scheduler is desired for - /// platforms that already have a default scheduler implementation, the caller - /// must call `realm_open()` with a config that indicates the desired scheduler. - /// - /// The provided callback may produce a scheduler by calling - /// `realm_scheduler_new()`. - /// - /// This function is thread-safe, but should generally only be called once. - bool realm_scheduler_set_default_factory( - ffi.Pointer userdata, - realm_free_userdata_func_t userdata_free, - realm_scheduler_default_factory_func_t arg2, - ) { - return _realm_scheduler_set_default_factory( - userdata, - userdata_free, - arg2, - ); - } - - late final _realm_scheduler_set_default_factoryPtr = _lookup< - ffi.NativeFunction< - ffi.Bool Function( - ffi.Pointer, - realm_free_userdata_func_t, - realm_scheduler_default_factory_func_t)>>( - 'realm_scheduler_set_default_factory'); - late final _realm_scheduler_set_default_factory = - _realm_scheduler_set_default_factoryPtr.asFunction< - bool Function(ffi.Pointer, realm_free_userdata_func_t, - realm_scheduler_default_factory_func_t)>(); - /// Create a new schema from classes and their properties. /// /// Note: This function does not validate the schema. @@ -9110,7 +9095,8 @@ class RealmLibrary { late final _realm_set_log_level = _realm_set_log_levelPtr.asFunction(); - void realm_set_log_level_category( + /// Set the logging level for given category. Return the previous level. + int realm_set_log_level_category( ffi.Pointer arg0, int arg1, ) { @@ -9121,11 +9107,11 @@ class RealmLibrary { } late final _realm_set_log_level_categoryPtr = _lookup< - ffi - .NativeFunction, ffi.Int32)>>( - 'realm_set_log_level_category'); + ffi.NativeFunction< + ffi.Int32 Function(ffi.Pointer, + ffi.Int32)>>('realm_set_log_level_category'); late final _realm_set_log_level_category = _realm_set_log_level_categoryPtr - .asFunction, int)>(); + .asFunction, int)>(); /// In a set of objects, delete all objects in the set and clear the set. In a /// set of values, clear the set. @@ -12745,10 +12731,6 @@ typedef realm_scheduler_can_deliver_notifications_func_tFunction = ffi.Bool Function(ffi.Pointer userdata); typedef Dartrealm_scheduler_can_deliver_notifications_func_tFunction = bool Function(ffi.Pointer userdata); -typedef realm_scheduler_default_factory_func_t = ffi.Pointer< - ffi.NativeFunction>; -typedef realm_scheduler_default_factory_func_tFunction - = ffi.Pointer Function(ffi.Pointer userdata); typedef realm_scheduler_is_on_thread_func_t = ffi .Pointer>; typedef realm_scheduler_is_on_thread_func_tFunction = ffi.Bool Function( diff --git a/packages/realm_dart/src/realm-core b/packages/realm_dart/src/realm-core index 2bfd5e9ba..95c6efce8 160000 --- a/packages/realm_dart/src/realm-core +++ b/packages/realm_dart/src/realm-core @@ -1 +1 @@ -Subproject commit 2bfd5e9ba74ed2620657bf968d2931f6ceab6785 +Subproject commit 95c6efce8d573b00c97fa8cd447eabaceb3e6c75 From 7361a8a78d9a62c2f72a39a19d88710ea42f9f75 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kasper=20Overg=C3=A5rd=20Nielsen?= Date: Thu, 14 Mar 2024 19:33:55 +0100 Subject: [PATCH 2/2] Update Changelog --- CHANGELOG.md | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5766b380c..98fa155a8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -103,19 +103,26 @@ ``` * Added `RealmValueType` enum that contains all the possible types that can be wrapped by a `RealmValue`. (PR [#1469](https://github.com/realm/realm-dart/pull/1469)) * Added support for accessing `Set` and `Map` types using the dynamic object API - `obj.dynamic.getSet/getMap`. (PR [#1533](https://github.com/realm/realm-dart/pull/1533)) - +* Improve performance of object notifiers with complex schemas and very simple changes to process by as much as 20% ([PR #7424](https://github.com/realm/realm-core/pull/7424)). +* Improve performance with very large number of notifiers as much as 75% ([PR #7424](https://github.com/realm/realm-core/pull/7424)). +* Add support to synchronize collections embedded in Mixed properties and other collections (except sets) ([PR #7353](https://github.com/realm/realm-core/pull/7353) Core v14.2.0-12-g95c6efce8). +* Improve performance of change notifications on nested collections somewhat ([PR #7402](https://github.com/realm/realm-core/pull/7402) Core v14.2.0-12-g95c6efce8). +* Improve performance of aggregate operations on Dictionaries of objects, particularly when the dictionaries are empty ([PR #7418](https://github.com/realm/realm-core/pull/7418) Core v14.2.0-12-g95c6efce8) ### Fixed * If you have more than 8388606 links pointing to one specific object, the program will crash. (Core 14.0.0) * A Realm generated on a non-apple ARM 64 device and copied to another platform (and vice-versa) were non-portable due to a sorting order difference. This impacts strings or binaries that have their first difference at a non-ascii character. These items may not be found in a set, or in an indexed column if the strings had a long common prefix (> 200 characters). (Core 14.0.0) * Ctor arguments appear in random order on generated classes, if the realm model contains many properties. (PR [#1531](https://github.com/realm/realm-dart/pull/1531)) +* Fixed an issue where removing realm objects from a List with more than 1000 items could crash. ([#7414](https://github.com/realm/realm-core/pull/7414), Core 14.2.0) +* Fixed conflict resolution bug which may result in an crash when the AddInteger instruction on Mixed properties is merged against updates to a non-integer type ([PR #7353](https://github.com/realm/realm-core/pull/7353), Core v14.2.0-12-g95c6efce8). +* Fix a spurious crash related to opening a Realm on background thread while the process was in the middle of exiting ([#7420](https://github.com/realm/realm-core/issues/7420jj), Core v14.2.0-12-g95c6efce8) ### Compatibility * Realm Studio: 14.0.0 or later. * Fileformat: Generates files with format v24. Reads and automatically upgrade from fileformat v10. If you want to upgrade from an earlier file format version you will have to use RealmCore v13.x.y or earlier. ### Internal -* Using Core 14.0.0 +* Using Core v14.2.0-12-g95c6efce8 ## 1.9.0 (2024-02-02)