| Commit-Queue | +1 |
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Code-Review | +1 |
LGTM % nits and suggestions
I don't have a strong preference as to whether or not this is better than the existing pattern. I like that the std::optional<> makes it clear that the Scope is conditional, which this removes, although maybe that is a detail that call sites don't need to care about. Also, preventing unexpected moves is nice too. I think we tend to use both patterns in Chrome (not sure on stats), so I think this is fine either way.
Wait for Michal in case he has a stronger opinion :).
EventTiming eventTiming(frame && window ? window : nullptr, *event_,```suggestion
EventTiming event_timing(frame && window ? window : nullptr, *event_,
```
Might as well fix this while you're in here.
frame_ && frame_->DomWindow() ? frame_->DomWindow() : nullptr, *event,Could the c'tor take a frame instead to simplify all of the construction sites?
EventTiming(EventTiming&& other) = delete;
EventTiming& operator=(EventTiming&& other) = delete;nit: not needed ("For a non-copyable/movable type, delete the copy operations (the move operations will be implicitly deleted)" https://chromium.googlesource.com/chromium/src/+/main/styleguide/c++/c++-dos-and-donts.md#explicitly-declare-class-copyability_movability)
// * In the constructor, notifies the InteractiveDetector if the event needs
// to be logged into input delay histograms.
// * In the constructor, invokes WindowPerformance::EventTimingProcessingStart
// * In the destructor, invokes WindowPerformance::EventTimingProcessingEndA lot of this (% that we log histograms) is implementation details, and I don't think that should be documented here? I think it's good to document what this does at a high level, but the class comments mostly does this?
WDYT about moving the comment about histograms (minus the implementation detail) to up to the class comment and nixing this part? Or even moving all of the c'tor comments into one coherent class comment?
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Code-Review | +1 |
I appreciate this change, and I actually really like the outcome (~ scott's comments).
Buuuut this yak shave is going to require a lot of work to integrate into my stack of growing CLs. Not so bad for the CL that is currently under review and which will concflict, but also all the patches to expose new events, etc.
I would like to see this land asap so I can integrate, but if its alright with you, maybe we could try not step on toes for the next couple days?
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
LGTM % nits and suggestions
I don't have a strong preference as to whether or not this is better than the existing pattern. I like that the std::optional<> makes it clear that the Scope is conditional, which this removes, although maybe that is a detail that call sites don't need to care about. Also, preventing unexpected moves is nice too. I think we tend to use both patterns in Chrome (not sure on stats), so I think this is fine either way.
Wait for Michal in case he has a stronger opinion :).
Cool, thank you!
Addressed the feedback - thanks a lot. I also removed a check statement. This one ...
```
entry_ = performance->EventTimingProcessingStart(event, processing_start,
hit_test_target);
CHECK(entry_);
```
It surprised me that this one would trip, because EventTimingProcessingStart only has this way to return a nullptr as far as I can tell (and I would hope that we have a window and a frame given the other checks in the constructor).
```
if (!DomWindow() || !DomWindow()->GetFrame()) {
return nullptr;
}
```
But OK?
EventTiming eventTiming(frame && window ? window : nullptr, *event_,```suggestion
EventTiming event_timing(frame && window ? window : nullptr, *event_,
```Might as well fix this while you're in here.
Done
frame_ && frame_->DomWindow() ? frame_->DomWindow() : nullptr, *event,Could the c'tor take a frame instead to simplify all of the construction sites?
yeah that's way nicer - thanks!
EventTiming(EventTiming&& other) = delete;
EventTiming& operator=(EventTiming&& other) = delete;nit: not needed ("For a non-copyable/movable type, delete the copy operations (the move operations will be implicitly deleted)" https://chromium.googlesource.com/chromium/src/+/main/styleguide/c++/c++-dos-and-donts.md#explicitly-declare-class-copyability_movability)
Done
// * In the constructor, notifies the InteractiveDetector if the event needs
// to be logged into input delay histograms.
// * In the constructor, invokes WindowPerformance::EventTimingProcessingStart
// * In the destructor, invokes WindowPerformance::EventTimingProcessingEndA lot of this (% that we log histograms) is implementation details, and I don't think that should be documented here? I think it's good to document what this does at a high level, but the class comments mostly does this?
WDYT about moving the comment about histograms (minus the implementation detail) to up to the class comment and nixing this part? Or even moving all of the c'tor comments into one coherent class comment?
Added the important stuff to the class level comment no mention of the histograms so it's shorter now.
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Code-Review | +1 |
Addressed the feedback - thanks a lot. I also removed a check statement. This one ...
```
entry_ = performance->EventTimingProcessingStart(event, processing_start,
hit_test_target);
CHECK(entry_);
```It surprised me that this one would trip, because EventTimingProcessingStart only has this way to return a nullptr as far as I can tell (and I would hope that we have a window and a frame given the other checks in the constructor).
```
if (!DomWindow() || !DomWindow()->GetFrame()) {
return nullptr;
}
```But OK?
That's weird! You're checking for detach right before, so not sure. Ideally, with your change, that `return nullptr` could be a check. It might have to do with `DomWindow()` checking `IsContextDestroyed()` under the hood, but not sure. Probably worth understanding?
| 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. |
Scott HaseleyAddressed the feedback - thanks a lot. I also removed a check statement. This one ...
```
entry_ = performance->EventTimingProcessingStart(event, processing_start,
hit_test_target);
CHECK(entry_);
```It surprised me that this one would trip, because EventTimingProcessingStart only has this way to return a nullptr as far as I can tell (and I would hope that we have a window and a frame given the other checks in the constructor).
```
if (!DomWindow() || !DomWindow()->GetFrame()) {
return nullptr;
}
```But OK?
That's weird! You're checking for detach right before, so not sure. Ideally, with your change, that `return nullptr` could be a check. It might have to do with `DomWindow()` checking `IsContextDestroyed()` under the hood, but not sure. Probably worth understanding?
Thanks a lot - I think your theory is correct!
// performance->EventTimingProcessingStart - which we call below - requires
// execution context internally.
if (performance->GetExecutionContext() == nullptr) {
return;
}I added this one to confirm Scott's theory. And with that, the dry run passes.
CHECK(performance->GetExecutionContext() != nullptr);This was a bit paranoid, I'll back it out, I think the if statement above is sufficient.
CHECK(entry_);This check used to fail, before I added the if statement in l. 97.
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
CHECK(performance->GetExecutionContext() != nullptr);This was a bit paranoid, I'll back it out, I think the if statement above is sufficient.
Done
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
// performance->EventTimingProcessingStart - which we call below - requires
// execution context internally.
if (performance->GetExecutionContext() == nullptr) {
return;
}I added this one to confirm Scott's theory. And with that, the dry run passes.
Huzzah! Glad that was it.
I don't love that this leaks details of `EventTimingProcessingStart`. Another option, which I think is maybe a bit clearer and more idiomatic, is to check for detach directly via `window`, which _is_ the `ExecutionContext` here. IOW, to you could change the `window` test above to `if (!window || window->IsContextDestroyed())`.
Also, I think it would be better if EventTimingProcessingStart() can't return null, i.e. change the existing detach branch to a CHECK and document in the header that the associated window must not be detached. Because otherwise we have a branch that can't be hit (i.e. we're handling this in two places, and IMO we should only handle it in one, and the onus should be either on the caller or method for handling this).
WDYT?
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Commit-Queue | +1 |
// performance->EventTimingProcessingStart - which we call below - requires
// execution context internally.
if (performance->GetExecutionContext() == nullptr) {
return;
}Scott HaseleyI added this one to confirm Scott's theory. And with that, the dry run passes.
Huzzah! Glad that was it.
I don't love that this leaks details of `EventTimingProcessingStart`. Another option, which I think is maybe a bit clearer and more idiomatic, is to check for detach directly via `window`, which _is_ the `ExecutionContext` here. IOW, to you could change the `window` test above to `if (!window || window->IsContextDestroyed())`.
Also, I think it would be better if EventTimingProcessingStart() can't return null, i.e. change the existing detach branch to a CHECK and document in the header that the associated window must not be detached. Because otherwise we have a branch that can't be hit (i.e. we're handling this in two places, and IMO we should only handle it in one, and the onus should be either on the caller or method for handling this).
WDYT?
Yes, thank you! I added checks to EventTimingProcessing{Start,End} and documented these. Yes, I do think it's better to make the requirements there a bit stiffer and handle the context not existing in the caller.
CHECK(entry_);Johannes HenkelThis check used to fail, before I added the if statement in l. 97.
Acknowledged
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Code-Review | +1 |
LGTM. I like how much cleaner the places where we create an EventTiming are!
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Code-Review | +1 |
I love it!
One warning is there is another patch that touch nearby files, may want to wait for that to land or confirm merge is clean.
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Commit-Queue | +2 |
Thanks a lot!
Especially for the wonderful suggestions to make this cl better.
Michal I think your cl went in, so I rebased this one and will try to submit as well.
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Commit-Queue | +2 |
Scott HaseleyAddressed the feedback - thanks a lot. I also removed a check statement. This one ...
```
entry_ = performance->EventTimingProcessingStart(event, processing_start,
hit_test_target);
CHECK(entry_);
```It surprised me that this one would trip, because EventTimingProcessingStart only has this way to return a nullptr as far as I can tell (and I would hope that we have a window and a frame given the other checks in the constructor).
```
if (!DomWindow() || !DomWindow()->GetFrame()) {
return nullptr;
}
```But OK?
Johannes HenkelThat's weird! You're checking for detach right before, so not sure. Ideally, with your change, that `return nullptr` could be a check. It might have to do with `DomWindow()` checking `IsContextDestroyed()` under the hood, but not sure. Probably worth understanding?
Thanks a lot - I think your theory is correct!
Acknowledged
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
11 is the latest approved patch-set.
No files were changed between the latest approved patch-set and the submitted one.
Move logic from EventTiming::TryCreate into constructor.
This is an attempt at yak-shaving away the TryCreate method, which
returns an std::optional instance of EventTiming, to be used with the
classic RAII pattern.
This slight variation moves the logic into the constructor instead,
which means no move semantics or std::optional are required. Instead,
when client code decides last second that it only wants a dummy
EventTiming, it passes a nullptr as the first argument.
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |