8000 refactor: use std::string instead of base::string16 for IPC channel names by miniak · Pull Request #14286 · electron/electron · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

refactor: use std::string instead of base::string16 for IPC channel names #14286

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 24, 2018

Conversation

miniak
Copy link
Contributor
@miniak miniak commented Aug 24, 2018
Description of Change

There is no need to use UTF-16 for IPC channel names, as they are almost always ASCII strings (UTF-8 is therefore more efficient). This change makes IPC messages slightly smaller, which should improve performance slightly.

Checklist
Release Notes

Notes: no-notes

@miniak miniak requested review from tarruda, deepak1556, MarshallOfSound and a team August 24, 2018 00:45
@miniak miniak changed the title refactor: use std::string (UTF-8) instead of base::string16 for IPC channel names refactor: use std::string instead of base::string16 for IPC channel names Aug 24, 2018
@miniak miniak force-pushed the miniak/ipc-std-string branch from 2d0a152 to db62ef3 Compare August 24, 2018 00:52
@@ -34,8 +34,7 @@ RemoteCallbackFreer::RemoteCallbackFreer(v8::Isolate* isolate,
RemoteCallbackFreer::~RemoteCallbackFreer() {}

void RemoteCallbackFreer::RunDestructor() {
base::string16 channel =
base::ASCIIToUTF16("ELECTRON_RENDERER_RELEASE_CALLBACK");
auto channel = "ELECTRON_RENDERER_RELEASE_CALLBACK";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FTBFS:

../../electron/atom/common/api/remote_callback_freer.cc:37:3: error: [chromium-style] auto variable type must not deduce to a raw pointer type.
  auto channel = "ELECTRON_RENDERER_RELEASE_CALLBACK";
  ^~~~
  auto*
1 error generated.
[17094/17960] CXX obj/electron/electron_lib/atom_renderer_client.o
[17095/17960] CXX obj/electron/electron_lib/atom_render_frame_observer.o

https://groups.google.com/a/chromium.org/forum/#!topic/chromium-dev/PMxDx7eR_YY has this info:

the solution is typically to make the pointer part of the type be outside of auto, so instead of

auto foo = new Foo;

write

auto* foo = new Foo;

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ckerr fixed

@miniak miniak force-pushed the miniak/ipc-std-string branch from db62ef3 to 8493c9f Compare August 24, 2018 06:40
@miniak
Copy link
Contributor Author
miniak commented Aug 24, 2018

@ckerr this should not be a breaking change, it's just changing an implementation detail. I've added a test with special chars in the IPC channel name.

@miniak miniak force-pushed the miniak/ipc-std-string branch from 8493c9f to e14be34 Compare August 24, 2018 06:50
@ckerr ckerr re 8000 moved the semver/major incompatible API changes label Aug 24, 2018
Copy link
Member
@ckerr ckerr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a nice improvement. Thanks for thinking of this!

Copy link
Member
@ckerr ckerr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A lot of the CI runs are dying in the linker at

v8.dll.lib(v8.dll) : error LNK2005: "public: unsigned __int64 __cdecl v8_inspector::StringView::length(void)const " (?length@StringView@v8_inspector@@QEBA_KXZ) already defined in node_string.obj
v8.dll.lib(v8.dll) : error LNK2005: "public: unsigned short const * __cdecl v8_inspector::StringView::characters16(void)const " (?characters16@StringView@v8_inspector@@QEBAPEBGXZ) already defined in node_string.obj
./node_lib.dll : fatal error LNK1169: one or more multiply defined symbols found
18119

At first glance I don't see the cause, but it's suspicious that other PR's CI runs are passing. @miniak can you investigate this, ie either fix the problem if it's in this PR, or confirm that it's unrelated?

@deepak1556
Copy link
Member

@ckerr those failures are not related to this PR, and also they are being fixed in #14281

@ckerr
Copy link
Member
ckerr commented Aug 24, 2018

@deepak1556 👍

@ckerr ckerr merged commit e6e3ccf into master Aug 24, 2018
@release-clerk
Copy link
release-clerk bot commented Aug 24, 2018

No Release Notes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants
0