Skip to content

Hide platform code entirely behind App for framework users - #12

Merged
nathansobo merged 16 commits into
masterfrom
platform-trait
Apr 12, 2021
Merged

Hide platform code entirely behind App for framework users#12
nathansobo merged 16 commits into
masterfrom
platform-trait

Conversation

@nathansobo

Copy link
Copy Markdown
Contributor

This is a bunch of related changes to improve our App and platform code. The big change is that we no longer interact with platform code at all from main. App now has methods for registering the appropriate application-level hooks, and it calls methods on the Platform, which was renamed from platform::App for clarity.

We now have two test methods, App::test and App::test_async. The test method is passed a &mut MutableAppContext, but test_async is passed a TestAppContext, which is another wrapper around the Rc<RefCell<MutableAppContext>> similar to App, but with methods specific to testing. Two of these methods are update and read. An update method exists on App, but has slightly different semantics in that we don't defer effects to the end of update during tests. Now App::update is private. App does not offer a read.

In tests, if you want to update entities, you mostly use the update method on the handles, which take closures and manipulate the models. If you want to read entities, you'll call TestAppContext::read with a closure. This will yield you a &AppContext that you can use with the handles to read their underlying entities.

I renamed ViewHandle::as_ref and ModelHandle::as_ref to read. It's shorter and clearer and stays away from a name used by a trait in Rust's stdlib that has a different interface. So now you can read or update an entity handle. I think it makes sense.

maxbrunsfeld and others added 16 commits April 7, 2021 17:48
Add an application menu with a quit command, bound to command-q
If this method is called too early, the menu bar won't be
clickable on startup until the window loses focus. Calling
it once the application finishes launching seems to fix
the issue.

See glfw/glfw#1648
Co-Authored-By: Max Brunsfeld <maxbrunsfeld@gmail.com>
Co-Authored-By: Max Brunsfeld <maxbrunsfeld@gmail.com>
I don't actually think it was correct to allow the future to borrow a mutable app reference. I went back to passing a wrapper around the refcell to async tests. They'll be a bit more annoying to write but also totally safe.
@nathansobo nathansobo changed the title Platform trait Hide platform code entirely behind App for framework users Apr 10, 2021
@nathansobo
nathansobo merged commit 6ea2581 into master Apr 12, 2021
@nathansobo
nathansobo deleted the platform-trait branch April 12, 2021 16:48
Anthony-Eid pushed a commit to Anthony-Eid/zed that referenced this pull request Aug 7, 2024
* Fix used wrong request args in set breakpoints request

Some debug adapters depend on getting the exact data that you passed in `launch` or `attach` request.

* Send correct request for stopping debug adapter

I changed the name to be more in line with the request name. We now also send the correct request values on the `support_terminate_debuggee` and `support_terminate_debuggee` capabilities.

* Send disconnect request for terminate threads if it does not support it

* Only send configuration done request if its supported

* Add disconnect icon

* Only send step over request params when adapter supports it

* Only send resume(continue) request params if adapter supports it

* Step in only send request args if adapter supports it

* Step out only send request args if adapter supports it

* Step back only send request args if adapter supports it

* Log error using `detach_and_log_err` instead of manually
@zed-zippy

zed-zippy Bot commented Nov 6, 2025

Copy link
Copy Markdown
Contributor

✅ Perf run succeeded! Results:

Category Max Mean Min
average ↑ 8.2% ±↑ 0.3% ±↓ 4.5%

@zed-zippy

zed-zippy Bot commented Nov 7, 2025

Copy link
Copy Markdown
Contributor

@zed-zippy

zed-zippy Bot commented Nov 10, 2025

Copy link
Copy Markdown
Contributor

@zed-zippy

zed-zippy Bot commented Nov 10, 2025

Copy link
Copy Markdown
Contributor

@zed-zippy

zed-zippy Bot commented Nov 10, 2025

Copy link
Copy Markdown
Contributor

@zed-zippy

zed-zippy Bot commented Nov 12, 2025

Copy link
Copy Markdown
Contributor

@zed-zippy

zed-zippy Bot commented Nov 13, 2025

Copy link
Copy Markdown
Contributor

@zed-zippy

zed-zippy Bot commented Nov 13, 2025

Copy link
Copy Markdown
Contributor

@zed-zippy

zed-zippy Bot commented Nov 13, 2025

Copy link
Copy Markdown
Contributor

@zed-zippy

zed-zippy Bot commented Nov 13, 2025

Copy link
Copy Markdown
Contributor

@zed-zippy

zed-zippy Bot commented Nov 13, 2025

Copy link
Copy Markdown
Contributor

@zed-zippy

zed-zippy Bot commented Nov 13, 2025

Copy link
Copy Markdown
Contributor

@zed-zippy

zed-zippy Bot commented Nov 13, 2025

Copy link
Copy Markdown
Contributor

@zed-zippy

zed-zippy Bot commented Nov 13, 2025

Copy link
Copy Markdown
Contributor

@zed-zippy

zed-zippy Bot commented Nov 13, 2025

Copy link
Copy Markdown
Contributor

@zed-zippy

zed-zippy Bot commented Nov 13, 2025

Copy link
Copy Markdown
Contributor

@zed-zippy

zed-zippy Bot commented Nov 13, 2025

Copy link
Copy Markdown
Contributor

@zed-zippy

zed-zippy Bot commented Nov 13, 2025

Copy link
Copy Markdown
Contributor

@zed-zippy

zed-zippy Bot commented Nov 13, 2025

Copy link
Copy Markdown
Contributor

@zed-zippy

zed-zippy Bot commented Nov 13, 2025

Copy link
Copy Markdown
Contributor

@zed-zippy

zed-zippy Bot commented Nov 13, 2025

Copy link
Copy Markdown
Contributor

rtfeldman added a commit that referenced this pull request Feb 5, 2026
…fault, cross-layer accumulation docs

- Fix #11: commit_message_model doc said 'Default: true' but field is Option<LanguageModelSelection>
- Fix #12: agent-settings.md said single_file_review default is false, but it's true
- Fix #13: Add cross-layer accumulation docs to always_allow, always_confirm, always_deny
rtfeldman added a commit that referenced this pull request Feb 5, 2026
…blocks

Refactor both migrations to iterate platform/channel keys (macos, linux,
windows, dev, nightly, preview, stable) and profiles, matching the pattern
used by m_2026_02_04.
osyvokon added a commit that referenced this pull request Apr 3, 2026
When atlas tiles are rapidly allocated and freed (e.g. watching a shared
screen in Collab), a texture can become unreferenced and be removed while
GPU uploads for it are still pending. On the next frame, `flush_uploads`
indexes into the now-empty texture slot and panics:

```
  thread 'main' panicked at crates/gpui_wgpu/src/wgpu_atlas.rs:231:40:
  texture must exist...

  #11 core::option::expect_failed
  #12 gpui_wgpu::wgpu_atlas::WgpuAtlas::before_frame
  #13 gpui_wgpu::wgpu_renderer::WgpuRenderer::draw
```

Drain pending uploads for a texture when it becomes unreferenced in
`remove`, and skip uploads for missing textures in `flush_uploads` as a
safety net.
osyvokon added a commit that referenced this pull request Apr 3, 2026
When atlas tiles are rapidly allocated and freed (e.g. watching a shared
screen in Collab), a texture can become unreferenced and be removed while
GPU uploads for it are still pending. On the next frame, `flush_uploads`
indexes into the now-empty texture slot and panics:

```
  thread 'main' panicked at crates/gpui_wgpu/src/wgpu_atlas.rs:231:40:
  texture must exist...

  #11 core::option::expect_failed
  #12 gpui_wgpu::wgpu_atlas::WgpuAtlas::before_frame
  #13 gpui_wgpu::wgpu_renderer::WgpuRenderer::draw
```

Drain pending uploads for a texture when it becomes unreferenced in
`remove`, and skip uploads for missing textures in `flush_uploads` as a
safety net.
osyvokon added a commit that referenced this pull request Apr 3, 2026
When atlas tiles are rapidly allocated and freed (e.g. watching a shared
screen in Collab), a texture can become unreferenced and be removed
while GPU uploads for it are still pending. On the next frame,
`flush_uploads` indexes into the now-empty texture slot and panics:

```
  thread 'main' panicked at crates/gpui_wgpu/src/wgpu_atlas.rs:231:40:
  texture must exist...

  #11 core::option::expect_failed
  #12 gpui_wgpu::wgpu_atlas::WgpuAtlas::before_frame
  #13 gpui_wgpu::wgpu_renderer::WgpuRenderer::draw
```

This change drains pending uploads for a texture when it becomes
unreferenced in `remove`, and skips uploads for missing textures in
`flush_uploads` as a safety net.

Self-Review Checklist:

- [x] I've reviewed my own diff for quality, security, and reliability
- [x] Unsafe blocks (if any) have justifying comments
- [x] The content is consistent with the [UI/UX
checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)
- [x] Tests cover the new/changed behavior
- [x] Performance impact has been considered and is acceptable


Release Notes:

- Fixed occasional crashes when viewing a screen share
rtfeldman pushed a commit that referenced this pull request Apr 4, 2026
When atlas tiles are rapidly allocated and freed (e.g. watching a shared
screen in Collab), a texture can become unreferenced and be removed
while GPU uploads for it are still pending. On the next frame,
`flush_uploads` indexes into the now-empty texture slot and panics:

```
  thread 'main' panicked at crates/gpui_wgpu/src/wgpu_atlas.rs:231:40:
  texture must exist...

  #11 core::option::expect_failed
  #12 gpui_wgpu::wgpu_atlas::WgpuAtlas::before_frame
  #13 gpui_wgpu::wgpu_renderer::WgpuRenderer::draw
```

This change drains pending uploads for a texture when it becomes
unreferenced in `remove`, and skips uploads for missing textures in
`flush_uploads` as a safety net.

Self-Review Checklist:

- [x] I've reviewed my own diff for quality, security, and reliability
- [x] Unsafe blocks (if any) have justifying comments
- [x] The content is consistent with the [UI/UX
checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)
- [x] Tests cover the new/changed behavior
- [x] Performance impact has been considered and is acceptable


Release Notes:

- Fixed occasional crashes when viewing a screen share
chan-yuu pushed a commit to chan-yuu/zed that referenced this pull request Apr 18, 2026
m-bers pushed a commit to m-bers/zed that referenced this pull request Apr 19, 2026
…connect-api

fix: adapt to upstream connect() API change
piper-of-dawn pushed a commit to piper-of-dawn/zed that referenced this pull request Apr 25, 2026
)

When atlas tiles are rapidly allocated and freed (e.g. watching a shared
screen in Collab), a texture can become unreferenced and be removed
while GPU uploads for it are still pending. On the next frame,
`flush_uploads` indexes into the now-empty texture slot and panics:

```
  thread 'main' panicked at crates/gpui_wgpu/src/wgpu_atlas.rs:231:40:
  texture must exist...

  zed-industries#11 core::option::expect_failed
  zed-industries#12 gpui_wgpu::wgpu_atlas::WgpuAtlas::before_frame
  zed-industries#13 gpui_wgpu::wgpu_renderer::WgpuRenderer::draw
```

This change drains pending uploads for a texture when it becomes
unreferenced in `remove`, and skips uploads for missing textures in
`flush_uploads` as a safety net.

Self-Review Checklist:

- [x] I've reviewed my own diff for quality, security, and reliability
- [x] Unsafe blocks (if any) have justifying comments
- [x] The content is consistent with the [UI/UX
checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)
- [x] Tests cover the new/changed behavior
- [x] Performance impact has been considered and is acceptable


Release Notes:

- Fixed occasional crashes when viewing a screen share
Zenor27 pushed a commit to Zenor27/zed that referenced this pull request Jul 4, 2026
)

When atlas tiles are rapidly allocated and freed (e.g. watching a shared
screen in Collab), a texture can become unreferenced and be removed
while GPU uploads for it are still pending. On the next frame,
`flush_uploads` indexes into the now-empty texture slot and panics:

```
  thread 'main' panicked at crates/gpui_wgpu/src/wgpu_atlas.rs:231:40:
  texture must exist...

  zed-industries#11 core::option::expect_failed
  zed-industries#12 gpui_wgpu::wgpu_atlas::WgpuAtlas::before_frame
  zed-industries#13 gpui_wgpu::wgpu_renderer::WgpuRenderer::draw
```

This change drains pending uploads for a texture when it becomes
unreferenced in `remove`, and skips uploads for missing textures in
`flush_uploads` as a safety net.

Self-Review Checklist:

- [x] I've reviewed my own diff for quality, security, and reliability
- [x] Unsafe blocks (if any) have justifying comments
- [x] The content is consistent with the [UI/UX
checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)
- [x] Tests cover the new/changed behavior
- [x] Performance impact has been considered and is acceptable


Release Notes:

- Fixed occasional crashes when viewing a screen share
jonx pushed a commit to jonx/zed-aros that referenced this pull request Jul 17, 2026
)

When atlas tiles are rapidly allocated and freed (e.g. watching a shared
screen in Collab), a texture can become unreferenced and be removed
while GPU uploads for it are still pending. On the next frame,
`flush_uploads` indexes into the now-empty texture slot and panics:

```
  thread 'main' panicked at crates/gpui_wgpu/src/wgpu_atlas.rs:231:40:
  texture must exist...

  zed-industries#11 core::option::expect_failed
  zed-industries#12 gpui_wgpu::wgpu_atlas::WgpuAtlas::before_frame
  zed-industries#13 gpui_wgpu::wgpu_renderer::WgpuRenderer::draw
```

This change drains pending uploads for a texture when it becomes
unreferenced in `remove`, and skips uploads for missing textures in
`flush_uploads` as a safety net.

Self-Review Checklist:

- [x] I've reviewed my own diff for quality, security, and reliability
- [x] Unsafe blocks (if any) have justifying comments
- [x] The content is consistent with the [UI/UX
checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)
- [x] Tests cover the new/changed behavior
- [x] Performance impact has been considered and is acceptable


Release Notes:

- Fixed occasional crashes when viewing a screen share
jolutz pushed a commit to jolutz/zed that referenced this pull request Aug 8, 2026
Hide platform code entirely behind App for framework users
audivir added a commit to audivir/zed that referenced this pull request Aug 10, 2026
…ention, audit Chrome/Edge parity

Adds 4 regression tests closing out TEST_PLAN.md items zed-industries#2, zed-industries#5, and zed-industries#12:
corrupted/truncated file load (test_fixtures/corrupted.pdf, a real PDF
truncated mid-stream), a dangling bookmark reference (test_fixtures/
dangling_bookmark.pdf, an outline entry whose target page was removed),
a render failure being recorded and not retried every frame, and degenerate
zoom input staying finite/clamped.

Adding these pushed the full suite over gpui's 15-second parking timeout:
many tests across pdf.rs/pdf_renderer.rs/pdf_viewer.rs do real PDFium FFI
work under allow_parking() and all queue on the single global PDFIUM async
mutex when cargo test runs them in parallel. Fixed by adding a crate-wide
PDFIUM_TEST_LOCK so these tests serialize instead of contending.

Also corrects BUG_REPORT.md/TEST_PLAN.md's overstated "Done" status for
search-error-vs-zero-results distinguishability (zed-industries#13) - only the logging
half was fixed, the UI still can't tell the two apart - and adds a Chrome/
Edge feature parity audit to FEATURE_ROADMAP.md: no zoom-preset dropdown,
rotate, document properties dialog, attachments panel, two-page view, or
presentation mode exist yet.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
audivir added a commit to audivir/zed that referenced this pull request Aug 10, 2026
…ention, audit Chrome/Edge parity

Adds 4 regression tests closing out TEST_PLAN.md items zed-industries#2, zed-industries#5, and zed-industries#12:
corrupted/truncated file load (test_fixtures/corrupted.pdf, a real PDF
truncated mid-stream), a dangling bookmark reference (test_fixtures/
dangling_bookmark.pdf, an outline entry whose target page was removed),
a render failure being recorded and not retried every frame, and degenerate
zoom input staying finite/clamped.

Adding these pushed the full suite over gpui's 15-second parking timeout:
many tests across pdf.rs/pdf_renderer.rs/pdf_viewer.rs do real PDFium FFI
work under allow_parking() and all queue on the single global PDFIUM async
mutex when cargo test runs them in parallel. Fixed by adding a crate-wide
PDFIUM_TEST_LOCK so these tests serialize instead of contending.

Also corrects BUG_REPORT.md/TEST_PLAN.md's overstated "Done" status for
search-error-vs-zero-results distinguishability (zed-industries#13) - only the logging
half was fixed, the UI still can't tell the two apart - and adds a Chrome/
Edge feature parity audit to FEATURE_ROADMAP.md: no zoom-preset dropdown,
rotate, document properties dialog, attachments panel, two-page view, or
presentation mode exist yet.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants