Currently we cannot directly map mojom::Event directly to ui::Event, and instead map it to unique_ptr<ui::Event>. This is because:
1. ui::Event is polymorphic.
2. Auto-generated struct traits code by Mojo does the allocation of deserialization target before calling the deserialization target (see crbug.com/610729 ).
Using unique_ptr<ui::Event> instead of ui::Event:
1. Makes the code a bit more complex.
2. Forces us to call ui::Event::Clone() when calling from functions working with ui::Event to functions working with unique_ptr<ui::Event>.
One way to solve this is to remove polymorphism from ui::Event as suggested in crbug.com/615102.
Comment 1 by rjkroege@chromium.org
, Oct 4 2016Labels: Proj-Mustash