Right now, it looks like string setters take the string by value: https://cs.chromium.org/chromium/src/out/Debug/gen/headless/public/devtools/domains/types_storage.h?rcl=3ea47128369ba885a1c235866a35be7213c176e2&l=29 void SetOrigin(std::string value) { origin_ = value; } If the caller is passing an object that's not an rvalue, this results in one copy, and a further copy when assigning it to origin_.
I believe this is specific to headless generator. Content uses const-refs: https://cs.chromium.org/chromium/src/out/Debug/gen/content/browser/devtools/protocol/target.h?rcl=3ea47128369ba885a1c235866a35be7213c176e2&l=53
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/6bac5f64f82e95a97fb1cba2fbc9bd8ed8bc8983 commit 6bac5f64f82e95a97fb1cba2fbc9bd8ed8bc8983 Author: skyostil <skyostil@chromium.org> Date: Thu May 04 11:40:30 2017 headless: Remove deprecated DevTools domain bindings Instead of //headless/public/domains, headers under //headless/public/devtools should now be used. BUG= 718242 Review-Url: https://codereview.chromium.org/2854823006 Cr-Commit-Position: refs/heads/master@{#469312} [modify] https://crrev.com/6bac5f64f82e95a97fb1cba2fbc9bd8ed8bc8983/headless/BUILD.gn [modify] https://crrev.com/6bac5f64f82e95a97fb1cba2fbc9bd8ed8bc8983/headless/lib/browser/devtools_api/client_api_generator.py [modify] https://crrev.com/6bac5f64f82e95a97fb1cba2fbc9bd8ed8bc8983/headless/lib/browser/devtools_api/client_api_generator_unittest.py [delete] https://crrev.com/ea46669e9b3d8c7a64e9c2280629a030a9e5e88b/headless/lib/browser/devtools_api/deprecated_domain_h.template [delete] https://crrev.com/ea46669e9b3d8c7a64e9c2280629a030a9e5e88b/headless/lib/browser/devtools_api/deprecated_type_conversions_h.template [delete] https://crrev.com/ea46669e9b3d8c7a64e9c2280629a030a9e5e88b/headless/lib/browser/devtools_api/deprecated_types_h.template [modify] https://crrev.com/6bac5f64f82e95a97fb1cba2fbc9bd8ed8bc8983/headless/lib/headless_browser_context_browsertest.cc
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/273f3371dea38a8348b2d854c560142cfd1bb05c commit 273f3371dea38a8348b2d854c560142cfd1bb05c Author: skyostil <skyostil@chromium.org> Date: Thu May 04 14:28:57 2017 headless: Remove references to nonexistent headers BUG= 718242 Review-Url: https://codereview.chromium.org/2858043005 Cr-Commit-Position: refs/heads/master@{#469328} [modify] https://crrev.com/273f3371dea38a8348b2d854c560142cfd1bb05c/headless/BUILD.gn
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/1d15faaea01846f698bbd4082c582eb180a2a49e commit 1d15faaea01846f698bbd4082c582eb180a2a49e Author: skyostil <skyostil@chromium.org> Date: Thu May 04 16:10:32 2017 headless: Avoid copies for string parameters in DevTools bindings String parameters were being passed by value instead of by const reference by mistake. BUG= 718242 Review-Url: https://codereview.chromium.org/2862843002 Cr-Commit-Position: refs/heads/master@{#469350} [modify] https://crrev.com/1d15faaea01846f698bbd4082c582eb180a2a49e/headless/lib/browser/devtools_api/client_api_generator.py [modify] https://crrev.com/1d15faaea01846f698bbd4082c582eb180a2a49e/headless/lib/browser/devtools_api/client_api_generator_unittest.py
Comment 1 by dgozman@chromium.org
, May 4 2017Status: Assigned (was: Untriaged)