| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
return instance_metrics().initial_invocation_source();Its probably better style to create the const instance_metrics() but couldnt you have technically just used instance_metrics_.initial_invocation_source() here? Is there a reason beside style to do this?
void GlicInstanceMetrics::OnShowInactiveSidePanel(If initial_invocation_source_ is populated here then later when the instance is brought to the foreground, GlicInstanceImpl invokes OnOpen() under kReshowInactive. Inside OnOpen(), the if (!initial_invocation_source_.has_value()) block evaluates to false, which causes base::UmaHistogramEnumeration("Glic.Instance.InitialInvocationSource", source); to be skipped completely. That instance would finish its lifecycle dropping that metric entirely.
Jetski wrote a test that fails:
```
TEST_F(GlicInstanceMetricsTest, InitialInvocationSource_LoggedWhenStartingInactive) {
// 1. Simulate opening the instance in an inactive side panel via a background daisy-chain.
metrics_.OnShowInactiveSidePanel(mojom::InvocationSource::kDaisyChainOnFollowLink);
// 2. Later, the user activates the background tab, promoting the instance to be fully shown.
EXPECT_CALL(mock_tab_, GetTabHandle()).WillRepeatedly(testing::Return(1));
ShowOptions show_options{SidePanelShowOptions{mock_tab_}};
metrics_.OnOpen(mojom::InvocationSource::kReshowInactive, show_options);
// 3. EXPECTATION: The original entry point (`kDaisyChainOnFollowLink`) should have been logged.
// CURRENT BEHAVIOR: This fails expecting 1 sample but getting 0.
histogram_tester_.ExpectUniqueSample(
"Glic.Instance.InitialInvocationSource",
mojom::InvocationSource::kDaisyChainOnFollowLink, 1);
}
```
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Commit-Queue | +1 |
Its probably better style to create the const instance_metrics() but couldnt you have technically just used instance_metrics_.initial_invocation_source() here? Is there a reason beside style to do this?
Frankly I let Jetski run wild and didn't bother to change this. I appreciate your assumption that there was a good reason though, haha
There's no reason to add a const `instance_metrics()`, I'll change this function to use `instance_metrics_` directly.
If initial_invocation_source_ is populated here then later when the instance is brought to the foreground, GlicInstanceImpl invokes OnOpen() under kReshowInactive. Inside OnOpen(), the if (!initial_invocation_source_.has_value()) block evaluates to false, which causes base::UmaHistogramEnumeration("Glic.Instance.InitialInvocationSource", source); to be skipped completely. That instance would finish its lifecycle dropping that metric entirely.
Jetski wrote a test that fails:
```
TEST_F(GlicInstanceMetricsTest, InitialInvocationSource_LoggedWhenStartingInactive) {
// 1. Simulate opening the instance in an inactive side panel via a background daisy-chain.
metrics_.OnShowInactiveSidePanel(mojom::InvocationSource::kDaisyChainOnFollowLink);// 2. Later, the user activates the background tab, promoting the instance to be fully shown.
EXPECT_CALL(mock_tab_, GetTabHandle()).WillRepeatedly(testing::Return(1));
ShowOptions show_options{SidePanelShowOptions{mock_tab_}};
metrics_.OnOpen(mojom::InvocationSource::kReshowInactive, show_options);// 3. EXPECTATION: The original entry point (`kDaisyChainOnFollowLink`) should have been logged.
// CURRENT BEHAVIOR: This fails expecting 1 sample but getting 0.
histogram_tester_.ExpectUniqueSample(
"Glic.Instance.InitialInvocationSource",
mojom::InvocationSource::kDaisyChainOnFollowLink, 1);
}
```
Good catch. I've updated how OnOpen() decides whether to log InitialInvocationSource to allow for initial_invocation_source_ already having been set by a background invocation. Also, added your test unchanged.
IMO it's fine to change that metric in this way because kReshowInactive isn't a very useful signal for initial invocation source -- we should be getting strictly more information by logging whatever source was set when opening inactive.
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Code-Review | +1 |
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Commit-Queue | +2 |
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
3 is the latest approved patch-set.
The change was submitted with unreviewed changes in the following files:
```
The name of the file: chrome/browser/glic/service/glic_instance_impl.h
Insertions: 1, Deletions: 1.
@@ -49,7 +49,7 @@
namespace tabs {
class TabInterface;
}
-//
+
namespace glic {
class ContextualCueingService;
class EmptyEmbedderDelegate;
```
glic: Set the initial invocation source on background invocation
This is meant to support UniversalCart which can invoke on background
tabs. This case causes GlicInstanceImpl::Show to exit early (inactive
embedder) without setting initial_invocation_source_. We don't want to
lose the initial invocation source in this case.
Also expose initial_invocation_source_ so that it can be used in
crrev.com/c/7963450.
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |