Skip to content

[objective_c] support scheduleInRunLoop:forMode: - #3763

Merged
brianquinlan merged 12 commits into
dart-lang:mainfrom
brianquinlan:runloop
Nov 2, 2026
Merged

brianquinlan merged 12 commits into
dart-lang:mainfrom
brianquinlan:runloop

Conversation

@brianquinlan

@brianquinlan brianquinlan commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

Description

The NSInputStream returned by toNSInputStream currently ignores scheduleInRunLoop:forMode:.

This causes NSURLSession to make read:maxLength calls on its single, process-wide com.apple.NSURLConnectionLoader thread, which waits until the Dart stream provides data. This really hurts package:cupertino_http's performance when performing concurrent uploads.

Related Issues

Fixes #3750
Fixes #3752

PR Checklist

  • I’ve reviewed the contributor guide and applied the relevant portions to this PR.
  • I've run dart tool/ci.dart --all locally and resolved all issues identified. This ensures the PR is formatted, has no lint errors, and ran all code generators. This applies to the packages part of the toplevel pubspec.yaml workspace.
  • All existing and new tests are passing. I added new tests to check the change I am making.
  • The PR is actually solving the issue. PRs that don't solve the issue will be closed. Please be respectful of the maintainers' time. If it's not clear what the issue is, feel free to ask questions on the GitHub issue before submitting a PR.
  • I have updated CHANGELOG.md for the relevant packages. (Not needed for small changes such as doc typos).
  • I have updated the pubspec package version if necessary.

@brianquinlan brianquinlan changed the title Runloop [objective_c] support scheduleInRunLoop:forMode: Oct 23, 2026
@codecov

codecov Bot commented Oct 23, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 87.91%. Comparing base (264318e) to head (40b912e).

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #3763      +/-   ##
==========================================
+ Coverage   85.84%   87.91%   +2.06%     
==========================================
  Files         322      310      -12     
  Lines       20877    19794    -1083     
==========================================
- Hits        17922    17402     -520     
+ Misses       2955     2392     -563     
Flag Coverage Δ
ffigen 91.36% <ø> (ø)
objective_c 62.87% <ø> (ø)
swiftgen 80.41% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Components Coverage Δ
code_assets 94.86% <ø> (-0.46%) ⬇️
data_assets 91.56% <ø> (ø)
ffi 100.00% <ø> (ø)
ffigen 91.45% <ø> (ø)
hooks 86.40% <ø> (ø)
hooks_runner 90.35% <ø> (-0.17%) ⬇️
jni 66.34% <ø> (ø)
jni_flutter ∅ <ø> (∅)
jni_util 25.00% <ø> (ø)
jnigen 82.85% <ø> (ø)
json_syntax_generator ∅ <ø> (∅)
native_test_helpers 85.71% <ø> (ø)
native_toolchain_c 95.90% <ø> (-0.09%) ⬇️
objective_c 79.56% <ø> (ø)
pub_formats ∅ <ø> (∅)
record_use 81.48% <ø> (ø)
snippet_tool 66.23% <ø> (ø)
swift2objc 92.95% <ø> (ø)
swiftgen 80.41% <ø> (ø)
test_case_selector 97.28% <ø> (ø)
see 18 files with indirect coverage changes
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

# Conflicts:
#	pkgs/objective_c/CHANGELOG.md
#	pkgs/objective_c/src/input_stream_adapter.m
#	pkgs/objective_c/test/ns_input_stream_test.dart
@brianquinlan
brianquinlan merged commit b442038 into dart-lang:main Nov 2, 2026
57 of 58 checks passed
copybara-service Bot pushed a commit to dart-lang/sdk that referenced this pull request Nov 4, 2026
Revisions updated by `dart tools/rev_sdk_deps.dart native`.

native (https://github.com/dart-lang/native/compare/e0ca7c6..b442038):
  b442038de  Mon Nov 2 10:46:15 2026 -0800  Brian Quinlan  [objective_c] support `scheduleInRunLoop:forMode:` (dart-lang/native#3763)
  264318e75  Fri Oct 30 12:49:03 2026 -0700  Brian Quinlan  [objective_c] fix `toNSInputStream` double copy (dart-lang/native#3762)
  63f3e8641  Fri Oct 30 12:09:04 2026 -0700  Brian Quinlan  [objective_c] avoid an extra copy in `toNSData`  (dart-lang/native#3761)
  ad203b01d  Fri Oct 30 11:48:15 2026 -0700  Brian Quinlan  [objective_c] increase read chunk size (dart-lang/native#3760)
  fa112d95b  Fri Oct 30 09:14:23 2026 -0700  Brian Quinlan  [objective_c] Fix a `NSInputStream` hang (dart-lang/native#3751)
  035f4ef38  Fri Oct 30 09:23:30 2026 +0100  Michael Goderbauer  [jnigen] Fix race conditions in tests (dart-lang/native#3767)
  d58a8f514  Fri Oct 30 00:57:49 2026 -0400  Jhin Lee  [code_assets] Preserve full Apple deployment versions (dart-lang/native#3742)

Migrate `MacOSCodeConfig` in `pkg/dartdev/lib/src/native_assets.dart` from the
deprecated `targetVersion` parameter to `deploymentVersion: AppleVersion(...)`.

Change-Id: I2df469fc05bda2c1db051f43e803fe5145f7c246
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/573102
Auto-Submit: Nate Bosch <[email protected]>
Reviewed-by: Nicholas Shahan <[email protected]>
Reviewed-by: Ben Konyi <[email protected]>
Commit-Queue: Ben Konyi <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[objective_c] NSInputStream doesn't support run loop scheduling [objective_c] NSInputStream can deadlock

2 participants