Rework BookProcessor to use OffScreenBrowser (BL-16430)#8038
Open
JohnThomson wants to merge 2 commits into
Open
Rework BookProcessor to use OffScreenBrowser (BL-16430)#8038JohnThomson wants to merge 2 commits into
JohnThomson wants to merge 2 commits into
Conversation
Allows us to finally retire RunJavascriptWithStringResult_Sync_Dangerous.
Contributor
|
| Filename | Overview |
|---|---|
| src/BloomExe/Book/BookProcessor.cs | Reworked to use OffScreenBrowser instead of creating per-page WebView2Browser controls on the UI thread; removes the Debug.Assert UI-thread check, switches to blocking calls, and makes WaitForJavascriptResult internal (enabling unit tests). Logic is correct. |
| src/BloomExe/Publish/OffScreenBrowser.cs | Gains StartFreshBrowser(), NavigateWithoutWaitingForLoad(), RunJavascriptFireAndForget(), a shared CoreWebView2Environment field, and CreateWithInjectedEnvironment plumbing; the dedicated-STA-thread model is preserved and the new code serializes correctly through RunAndBlock. |
| src/BloomExe/web/controllers/ExternalApi.cs | Switches RunProcessBookJob from BeginInvoke-on-UI-thread to Task.Run on a background thread; adds InvokeOnUiThread helper for WinForms state updates; marks _processBookInProgress volatile to handle the now-cross-thread false write. Previous reviewer concern addressed. |
| src/BloomExe/WebView2Browser.cs | Removes RunJavascriptWithStringResult_Sync_Dangerous and the obsolete annotation; adds CreateWithInjectedEnvironment factory and CoreEnvironment property to support OffScreenBrowser's shared-environment approach. |
| src/BloomExe/IBrowser.cs | Removes the obsolete RunJavascriptWithStringResult_Sync_Dangerous abstract member; RunJavascriptFireAndForget already existed in this contract and is unchanged. |
| src/BloomTests/Book/BookProcessorTests.cs | New test class covering WaitForJavascriptResult (page-load value, delayed fire-and-forget value, timeout), and StartFreshBrowser isolation; marked SkipOnTeamCity as the tests require a real WebView2 environment. |
Reviews (2): Last reviewed commit: "Post-review fixes (BL-16430 part C)" | Re-trigger Greptile
Member
|
@JohnThomson please address or resolve https://app.devin.ai/review/BloomBooks/BloomDesktop/pull/8038 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Allows us to finally retire RunJavascriptWithStringResult_Sync_Dangerous.
Devin review
This change is