[CORAL] Sync title observer mojom change
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
Hi reviewers, please help me review this CL, thanks.
base::NullCallback());
@zx...@google.com after you implemented the birch model notify for coral, simply change this null callback to binding OnGroupTitleUpdated and it should work.
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
base::RepeatingCallback<void(const base::Token&, const std::string&)>
nit: this is used multiple times, shall we give it a short name with using, e.g. TitleUpdatedCallback?
// When receiving a new request, reset the previous title observer, if any.
q: will BirchCoralProvider::OnGroupTitleUpdated be used as the title changed callback? If so, why do we need to update the callback everytime? Is it because we may switch between sync and async title requests?
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
// If |on_title_updated| is non-null, the backend will function in an async
super nit: new way is to wrap using backticks `` instead of ||
// When receiving a new request, reset the previous title observer, if any.
q: will BirchCoralProvider::OnGroupTitleUpdated be used as the title changed callback? If so, why do we need to update the callback everytime? Is it because we may switch between sync and async title requests?
i'd make birch coral provider a override of coral::mojom::TitleObserver, or some hybrid an do
if (auto coral_provider = BirchCoralProvider::Get()) {
coral_provider->UpdateTitle();
}
not sure if Howard you tried either and if its feasible. From this CL alone it looks like the callbacks are unnecessary and add more complexity
// The interface is used to provide updates of the |Group.title| field inside
super nit: The -> This
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
Commit-Queue | +1 |
base::RepeatingCallback<void(const base::Token&, const std::string&)>
nit: this is used multiple times, shall we give it a short name with using, e.g. TitleUpdatedCallback?
The callback is no longer used.
// If |on_title_updated| is non-null, the backend will function in an async
super nit: new way is to wrap using backticks `` instead of ||
Done
// When receiving a new request, reset the previous title observer, if any.
Sammie Quonq: will BirchCoralProvider::OnGroupTitleUpdated be used as the title changed callback? If so, why do we need to update the callback everytime? Is it because we may switch between sync and async title requests?
i'd make birch coral provider a override of coral::mojom::TitleObserver, or some hybrid an do
if (auto coral_provider = BirchCoralProvider::Get()) {
coral_provider->UpdateTitle();
}
not sure if Howard you tried either and if its feasible. From this CL alone it looks like the callbacks are unnecessary and add more complexity
Changed to make birch coral provider a TitleObserver, and make CoralController take a TitleObserver remote as param directly.
// The interface is used to provide updates of the |Group.title| field inside
super nit: The -> This
Since the CrOS mojom change has already landed, will fix in the next modification of this file.
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
+Takashi and Mitsuru for the mojom file/BUILD owner approval. Thanks!
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
Code-Review | +1 |
LGTM with nits. You may not need Ahmed, btw, we have similar ownership.
for (coral::mojom::GroupPtr& group : groups) {
optional nit: I would inline `response_->groups()` so the reader doesn't have to think about the vector reference
// the backend will return the titles together with the response.
nit: I would also describe *why* it's built this way. I had to read the mojom to understand that title generation is slow. I presume returning the grouping quickly allows for better UX than waiting a long time for titles?
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
Commit-Queue | +2 |
optional nit: I would inline `response_->groups()` so the reader doesn't have to think about the vector reference
Done
// the backend will return the titles together with the response.
nit: I would also describe *why* it's built this way. I had to read the mojom to understand that title generation is slow. I presume returning the grouping quickly allows for better UX than waiting a long time for titles?
Done, I'll submit first and if there are some more suggestions about the comments I'll update in next CL.
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
6 is the latest approved patch-set.
The change was submitted with unreviewed changes in the following files:
```
The name of the file: ash/wm/coral/coral_controller.h
Insertions: 4, Deletions: 0.
@@ -77,6 +77,10 @@
// grouping is done, but with empty titles. Then, `title_observer` will be
// triggered once for each group when their title is generated. If it's null,
// the backend will return the titles together with the response.
+ // This design is because title generation may take significantly longer
+ // compared to rest of the grouping process, so receiving the response before
+ // title is updated will allow UI to show the groupings with a loading title,
+ // enhancing the user experience.
using CoralResponseCallback =
base::OnceCallback<void(std::unique_ptr<CoralResponse>)>;
void GenerateContentGroups(
```
```
The name of the file: ash/birch/birch_coral_provider.cc
Insertions: 1, Deletions: 2.
@@ -440,8 +440,7 @@
void BirchCoralProvider::TitleUpdated(const base::Token& id,
const std::string& title) {
- std::vector<coral::mojom::GroupPtr>& groups = response_->groups();
- for (coral::mojom::GroupPtr& group : groups) {
+ for (coral::mojom::GroupPtr& group : response_->groups()) {
if (group->id == id) {
group->title = title;
return;
```
[CORAL] Sync title observer mojom change
Sync the title observer mojom change from https://crrev.com/c/5933812,
and modify the CoralController interface accordingly. Currently, the
coral provider doesn't support notifying birch model updates yet, so the
update callback isn't passed to CoralController in this CL yet
(otherwise the coral chips will have no titles and won't show).
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |