Make BlinkCloneableMessage and BlinkTransferableMessage move-only.
The mojo typemaps for BlinkCloneableMessage and BlinkTransferableMessage specify that the structs are move-only, so the code in the mojo bindings uses std::move. However, since the structs declare a custom constructor (the constructor is defaulted in the .cpp, but the compiler can't see this from the .h), no move constructor or move-assignment is generated, and the structs are copied rather than being moved. The mismatch causes extra reference increments / decrements. When the underlying type uses thread-safe reference counter (like SerializedScriptValue does), increments and decrements use atomic operations, which are not cheap on ARM. This CL adds move constructors and move-assignment operators to BlinkCloneableMessage to allow moving, and adds DISALLOW_COPY_AND_ASSIGN to prevent accidental copying. This CL also adds DISALLOW_COPY_AND_ASSIGN to the browser-side structures corresponding to Blink{Cloneable,Transferable}Message, to make it obvious that they are move-only. Bug: 794791 Change-Id: Iffe8f1e65bf9ccc2cd98082c341c2bdc3246fa33 Reviewed-on: https://chromium-review.googlesource.com/826260 Commit-Queue: Jeremy Roman <jbroman@chromium.org> Reviewed-by:Jeremy Roman <jbroman@chromium.org> Reviewed-by:
Marijn Kruisselbrink <mek@chromium.org> Cr-Commit-Position: refs/heads/master@{#524085}
Showing
Please register or sign in to comment