Skip to content

Prepare IsolateManager to become source of truth for isPaused for an isolate. #5005

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 12 commits into from
Jan 6, 2023

Conversation

polina-c
Copy link
Contributor

@polina-c polina-c commented Jan 5, 2023

RELEASE_NOTE_EXCEPTION=[refactoring]

@polina-c polina-c marked this pull request as ready for review January 5, 2023 18:32
@polina-c polina-c requested a review from a team as a code owner January 5, 2023 18:32
@polina-c polina-c requested review from CoderDake and removed request for a team January 5, 2023 18:32
@polina-c polina-c changed the title Prepare IsolateManager to become source of truth for wether an isolate is paused or no. Prepare IsolateManager to become source of truth for isPaused for an isolate. Jan 5, 2023
return isolateState.isolate;
/// Resturns isolate by its reference.
///
/// The method will return immediately in most cases
Copy link
Contributor

Choose a reason for hiding this comment

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

return immediately is misleading as the return value is a future.
This method name has always been bad. Some other ideas:
isolateFor(isolateRef)
isolate(isolateRef)

delete this method completely and just call
isolateState(isolateRef).isolate
everywhere this method was used.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

deleted

Future<bool> isIsolatePaused(IsolateRef ref) async {
final state = isolateState(ref);
await state.waitForIsolateToLoad();
return state.isPaused.value!;
Copy link
Member

Choose a reason for hiding this comment

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

is value guaranteed to be non-null? should we have a default value instead?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

i like this

@@ -10,3 +10,11 @@ in compliance with [Flutter repo style guide]( https://github.com/flutter/flutte
1. Public getter
2. Private field
3. Public setter (when needed)

## Naming for methods and functions
Copy link
Member

Choose a reason for hiding this comment

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

in general, I don't think we need to rewrite a style guide for our own repo. We can link to Effective Dart and the Flutter style guide for references from this README.MD or from out CONTRIBUTING.MD file (this may be a better place), but it seems a bit overkill to try to pick and choose some of the style guidelines we follow and rewrite them here.

Copy link
Contributor Author

@polina-c polina-c Jan 5, 2023

Choose a reason for hiding this comment

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

We do not follow the entire Flutter style guide (because it conflicts with Effective Dart or some rules do not make sense for us). But exactly these two rules make a lot of sense and will bring good consistency to our code. So, I suggest to link just them.

How does it sound?

Copy link
Contributor

@jacob314 jacob314 left a comment

Choose a reason for hiding this comment

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

lgtm

CONTRIBUTING.md Outdated
Comment on lines 17 to 18
2. Make sure your (or your organization's) name and contact info is added to the [AUTHORS](AUTHORS)
file.
Copy link
Member

Choose a reason for hiding this comment

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

I think we can remove this - we don't follow this practice. @jacob314 please correct me if I am wrong.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah I don't know of us ever following that practice. Does any repo under the Flutter org do this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Out of top 5 Flutter repos I checked only flutter-intellij has this instruction and follows the rule:

https://github.com/flutter/flutter-intellij/blob/master/CONTRIBUTING.md

https://github.com/flutter/flutter-intellij/blob/master/AUTHORS

Copy link
Contributor Author

Choose a reason for hiding this comment

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

deleted

@polina-c polina-c merged commit 01f3b44 into flutter:master Jan 6, 2023
@polina-c polina-c deleted the refactor1-3 branch January 6, 2023 19:32
@CoderDake CoderDake mentioned this pull request Jan 24, 2023
7 tasks
@DartDevtoolWorkflowBot DartDevtoolWorkflowBot mentioned this pull request Jan 24, 2023
7 tasks
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.

4 participants