New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 615102 link

Starred by 2 users

Issue metadata

Status: Untriaged
Owner: ----
Cc:
EstimatedDays: ----
NextAction: 2019-07-09
OS: ----
Pri: 3
Type: Feature

Blocking:
issue 617167
issue 617222



Sign in to add a comment

Shouldn't use polymorphism for ui::Event types

Project Member Reported by ben@chromium.org, May 26 2016

Issue description

This is somewhat of an assertion based on feeling/observation so feel free to challenge but wanted to put this out there.

I don't think ui::Event should have subclasses for specific event types. It's annoying in dispatch code where mostly we don't care about event types, just the flow of events. Where we do, we'd much rather just check a type field so we can route appropriately.

This makes events harder to construct as we need to construct the right type, and in framework clients where we receive generic events we then need to cast back to the right implementation type to call the helper methods.

Instead, I propose ui::Event as a generic uber event, with nullable fields for type-specific data. These type-specific data objects might contain utility functions for convenient analysis, or these functions could just be global utility functions... that's more of an aesthetic decision.

Sky@ points out the value in (e.g.) the Views layer of using types to guarantee OnMousePressed() can only take a MouseEvent, which I buy, but it seems that that could be achieved via a views-specific wrapper which wraps the generic & provides the type-specific convenience functions. I think this makes sense inside the Views layer, but IMO various FooEvent classes makes little sense in the dispatch layers.

WDYT?
 
Blocking: 617167
Blocking: 617222
Cc: moh...@chromium.org
Project Member

Comment 4 by sheriffbot@chromium.org, Jun 22 2017

Labels: Hotlist-Recharge-Cold
Status: Untriaged (was: Available)
This issue has been Available for over a year. If it's no longer important or seems unlikely to be fixed, please consider closing it out. If it is important, please re-triage the issue.

Sorry for the inconvenience if the bug really should have been left as Available. If you change it back, also remove the "Hotlist-Recharge-Cold" label.

For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot
Labels: Pri-3
NextAction: 2019-07-09
Downgrading P2s that haven't been modified in more than 6 months, which have no component or owner.

Sign in to add a comment