-
Notifications
You must be signed in to change notification settings - Fork 6k
Document flutter::RuntimeController. #17250
Conversation
|
Will land on red to unblock LUCI which is red on a goma flake. |
|
TBR |
| /// normal operation, a single instance of this object is owned by the engine | ||
| /// per shell. This object may only be created, used, and collected on the UI | ||
| /// task runner. Window state queried by the root isolate is stored by this | ||
| /// object. In cold-restart scenarios, the engine may collect this collect |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cold-restart is used in other places, but I think it's a bit incongruent with our more typical terminology at this point of hot reload/hot restart.
Also - collect this collect - just collect this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cold-restart is used in other places, but I think it's a bit incongruent with our more typical terminology at this point of hot reload/hot restart.
I didn't know we settled on that terminology already. When did we do that? I'll change all references to cold-restart in a subsequent patch.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also - collect this collect - just collect this?
Patching.
| /// @param[in] advisory_script_uri The advisory script URI (only used | ||
| /// for debugging). This does not | ||
| /// affect the code being run in the | ||
| /// isolate in any way. | ||
| /// @param[in] advisory_script_entrypoint The advisory script entrypoint | ||
| /// (only used for debugging). This | ||
| /// does not affect the code being run | ||
| /// in the isolate in any way. The | ||
| /// isolate must be transitioned to | ||
| /// the running state explicitly by | ||
| /// the caller. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My understanding at this point is that these don't actually do anything at all, and don't show up anywhere meaningfully for debuggers. Is that correct?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think these still show up when you use the debugger from the observatory. It might be a good idea to just remove these from the engine and see what breaks really.
| /// isolate to collect resources that | ||
| /// may reference resources on the | ||
| /// GPU. | ||
| /// @param[in] image_decoder The image decoder |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Might be helpful to explain why this is here and not on the io_manager, or how it's different.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The IO manager does more than just aid in image decode. I think the difference will become clearer once I document that.
| /// code in isolate scope when the VM | ||
| /// is about to be notified that the | ||
| /// engine is going to be idle. | ||
| /// @param[in] window_data The window data (if exists). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's window data? :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe even just a link to the WindowData struct would do.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doxygen seem to be inferring a link the struct already https://engine.chinmaygarde.com/classflutter_1_1_runtime_controller.html#af7c1055c85ff7300fdb2fd2d9576440a
| /// @brief Clone the the runtime controller. This re-creates the root | ||
| /// isolate with the same snapshots and copies all window data to | ||
| /// the new instance. This is usually only used in the debug | ||
| /// runtime mode to support the cold-restart scenario. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same nit about cold-restart.
| /// NotifyIdle is advisory and not making the same or making it with | ||
| /// insufficient deadlines does not mean that the VM will keep consuming | ||
| /// memory indefinitely. Even if the engine made absolutely no calls to |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This would be a little clearer if phrased without the double negative... something like
NotifyIdle is advisory. The VM may or may not run a garbage collection when this is called, and will eventually perform garbage collections even if it is not called or it is called with insufficient deadlines.
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Patching.
| /// The garbage collection mechanism and its thresholds are internal | ||
| /// implementation details and absolutely no guarantees are made about the | ||
| /// threshold discussed below. This discussion is also an oversimplification | ||
| /// but hopefully serves to calibrate expectations about GC behavior: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there Dart documentation we could link to here instead of all of this?
People who read this will probably think it's more precise than it is, and it seems likely that this could drift out of sync with actual implementation details it's trying to capture.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alternatively, would it make sense to move some of this to somewhere in //dart/runtime/vm where it could be maintained by the VM team? It is a really helpful description.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there Dart documentation we could link to here instead of all of this?
No. It's not documented anywhere. And probably for the same reasons we hesitate to document it here. It's implementation details and may change.
People who read this will probably think it's more precise than it is, and it seems likely that this could drift out of sync with actual implementation details it's trying to capture.
Fair point. But the caveats (stuff like "are implementation details and absolutely no guarantees ... oversimplification" ) I believe are sufficient for reasonable readers to not make assumptions of stability.
| Dart_Port GetMainPort(); | ||
|
|
||
| //---------------------------------------------------------------------------- | ||
| /// @brief Gets the debug name of the root isolate. But default, the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This answers my question(s) above about advisory*
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe link to this from there?
| /// @brief Returns if the root isolate has any live receive ports. | ||
| /// | ||
| /// @return True if there are live receive ports, False otherwise. Return | ||
| /// False is the root isolate is not running as well. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would be helpful to state why this matters here - e.g. this effectively tells you if the isolate is running or not, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A running isolate can have no receive ports.... right?
| bool HasLivePorts(); | ||
|
|
||
| //---------------------------------------------------------------------------- | ||
| /// @brief Get the last error encountered by the microtask queue. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Might be helpful to explain that this doesn't get actual details of errors thrown in Dart code, but basically exit codes from the VM... right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't that implied from the return type of DartErrorHandleType?
Based on feedback gather in flutter#17250 after it landed.
|
Patches based on feedback here applied in #17256 |
Based on feedback gather in #17250 after it landed.
No description provided.