Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. | Gerrit |
Code-Review | +1 |
This CL makes it virtual and override in Passthrough, so it's easier
to eliminate call-sites and the function all together.
Do you mean that in a follow up, you'll remove the IsOriginTopLeft method?
As a general thought on this, I find that we often abuse inheritance and virtual calls. Adding a virtual method to a base class when that feature is only ever needed by one child class seems more like and unfortunate consequence of how the code is structured (e.g. I need to use this feature of child class but all I have is a pointer to the parent class) than a correct use of an API interface.
But maybe that's not the case here: the position of the origin is a trait that all child classes care about, irrespective of the default. It remains that by replacing the member attribute with a virtual call, we are adding virtual dispatches in places where we originally had direct access to the value, which complexifies data flow and could impact performance. I've been bitten many times by thinking that a certain method is being used, when in reality, an unexpected remotely defined override is actually being used. All that to say that there is advantages to having a member attribute in the parent class. But if all this is going away, either option works.
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. | Gerrit |
Commit-Queue | +2 |
Thanks for the review.
This CL makes it virtual and override in Passthrough, so it's easier
to eliminate call-sites and the function all together.
Do you mean that in a follow up, you'll remove the IsOriginTopLeft method?
As a general thought on this, I find that we often abuse inheritance and virtual calls. Adding a virtual method to a base class when that feature is only ever needed by one child class seems more like and unfortunate consequence of how the code is structured (e.g. I need to use this feature of child class but all I have is a pointer to the parent class) than a correct use of an API interface.
But maybe that's not the case here: the position of the origin is a trait that all child classes care about, irrespective of the default. It remains that by replacing the member attribute with a virtual call, we are adding virtual dispatches in places where we originally had direct access to the value, which complexifies data flow and could impact performance. I've been bitten many times by thinking that a certain method is being used, when in reality, an unexpected remotely defined override is actually being used. All that to say that there is advantages to having a member attribute in the parent class. But if all this is going away, either option works.
Yes, I plan to remove IsOriginTopLeft from everywhere eventually.
I agree that it has theoretical performance impact, but unless whole chrome would try to avoid virtual calls and memory allocations on the critical path there is no practical difference.
And I agree that from architectural point of view it might be better to have variable and non-virtual getter, but tooling-wise it's much more complicated to trace all places where variable comes from, especially if it's plumbed through few functions vs all overrides of the function. And to easier reasoning for the follow-up CLs that are based on "This code place doesn't use CanvasReourceProviderPassthrough, so origin can't be bottom left" I want to land this as prerequisite.
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. | Gerrit |
This CL makes it virtual and override in Passthrough, so it's easier
to eliminate call-sites and the function all together.
Vasiliy TelezhnikovDo you mean that in a follow up, you'll remove the IsOriginTopLeft method?
As a general thought on this, I find that we often abuse inheritance and virtual calls. Adding a virtual method to a base class when that feature is only ever needed by one child class seems more like and unfortunate consequence of how the code is structured (e.g. I need to use this feature of child class but all I have is a pointer to the parent class) than a correct use of an API interface.
But maybe that's not the case here: the position of the origin is a trait that all child classes care about, irrespective of the default. It remains that by replacing the member attribute with a virtual call, we are adding virtual dispatches in places where we originally had direct access to the value, which complexifies data flow and could impact performance. I've been bitten many times by thinking that a certain method is being used, when in reality, an unexpected remotely defined override is actually being used. All that to say that there is advantages to having a member attribute in the parent class. But if all this is going away, either option works.
Yes, I plan to remove IsOriginTopLeft from everywhere eventually.
I agree that it has theoretical performance impact, but unless whole chrome would try to avoid virtual calls and memory allocations on the critical path there is no practical difference.
And I agree that from architectural point of view it might be better to have variable and non-virtual getter, but tooling-wise it's much more complicated to trace all places where variable comes from, especially if it's plumbed through few functions vs all overrides of the function. And to easier reasoning for the follow-up CLs that are based on "This code place doesn't use CanvasReourceProviderPassthrough, so origin can't be bottom left" I want to land this as prerequisite.
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. | Gerrit |
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. | Gerrit |
5 is the latest approved patch-set.
No files were changed between the latest approved patch-set and the submitted one.
Make CanvasResourceProvider::IsOriginTopLeft virtual
Only CanvasResourceProviderPassthrough can have bottom left origin.
This CL makes it virtual and override in Passthrough, so it's easier
to eliminate call-sites and the function all together.
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. | Gerrit |