Skip to content

Pause taggers when they are not visible.#60371

Merged
CyrusNajmabadi merged 23 commits intodotnet:main-vs-depsfrom
CyrusNajmabadi:pauseTaggers
Apr 1, 2022
Merged

Pause taggers when they are not visible.#60371
CyrusNajmabadi merged 23 commits intodotnet:main-vs-depsfrom
CyrusNajmabadi:pauseTaggers

Conversation

@CyrusNajmabadi
Copy link
Copy Markdown
Contributor

No point in doing work here that the user is not even going to see.

in progress

Add support for pausing taggers when they lose visibility

Make async

Flip

Simplify
@CyrusNajmabadi CyrusNajmabadi requested a review from a team as a code owner March 24, 2022 21:48
@CyrusNajmabadi CyrusNajmabadi requested a review from a team March 24, 2022 21:48
@ghost ghost added the Area-IDE label Mar 24, 2022
@CyrusNajmabadi
Copy link
Copy Markdown
Contributor Author

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 4 pipeline(s).

@CyrusNajmabadi CyrusNajmabadi requested a review from dibarbet March 31, 2022 01:44
@allisonchou
Copy link
Copy Markdown
Contributor

Re-targeting from release/dev17.3 to main-vs-deps so we can delete the release/dev17.3 branch.

@CyrusNajmabadi CyrusNajmabadi merged commit 7359848 into dotnet:main-vs-deps Apr 1, 2022
@CyrusNajmabadi CyrusNajmabadi deleted the pauseTaggers branch April 1, 2022 18:50
@ghost ghost added this to the Next milestone Apr 1, 2022
Copy link
Copy Markdown
Member

@jasonmalinowski jasonmalinowski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks great, and as you said nice and simple!

{
internal abstract class AbstractTaggerEventSource : ITaggerEventSource
{
private bool _paused;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We didn't want to disconnect entirely? On one hand I don't know if it really hurts much to stay connected, but given we already had a Connect/Disconnect pair, do we need a second pair?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So the contract of Disconnect is that it's somewhat like Dispose. It's can fundamentally put the event source into an unusable state (and is doc'ed as such). I suppose we could actually try to make it so that you could repeatedly call Connect/Disconnect... but i'm warier of that.

Comment on lines +202 to +204
// any time visibility changes, resume tagging on all taggers. Any non-visible taggers will pause
// themselves immediately afterwards.
Resume();
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I admit it wasn't immediately obvious why this wasn't calling Pause if it was invisible, but I see the idea here is we only enter the paused state once we did have an event, which also doubles as the "we need to recompute once we regain focus" bit. Not sure if that deserves a comment here or perhaps on the paused flag.

/// Pauses this event source and prevents it from firing the <see cref="Changed"/> event. Can be called many
/// times (but subsequence calls have no impact if already paused). Must be called on the UI thread.
/// </summary>
void Pause();
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants