[webkit-reviews] review granted: [Bug 202421] Socket RWI client should acquire backend commands from server : [Attachment 380054] Patch

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Thu Oct 3 08:53:58 PDT 2019


Devin Rousso <drousso at apple.com> has granted Ross Kirsling
<ross.kirsling at sony.com>'s request for review:
Bug 202421: Socket RWI client should acquire backend commands from server
https://bugs.webkit.org/show_bug.cgi?id=202421

Attachment 380054: Patch

https://bugs.webkit.org/attachment.cgi?id=380054&action=review




--- Comment #15 from Devin Rousso <drousso at apple.com> ---
Comment on attachment 380054
  --> https://bugs.webkit.org/attachment.cgi?id=380054
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=380054&action=review

r=me

> Source/JavaScriptCore/inspector/remote/socket/RemoteInspectorServer.cpp:263
> +    auto handle = FileSystem::openFile(m_backendCommandsPath,
FileSystem::FileOpenMode::Read);

NIT: I would reorganize this function a bit so you can better ensure that
`FileSystem::closeFile` gets called:
```
    if (m_backendCommandsPath.isEmpty())
	return { };

    auto handle = FileSystem::openFile(m_backendCommandsPath,
FileSystem::FileOpenMode::Read);
    if (!FileSystem::isHandleValid(handle))
	return { };

    String result;
    long long size;
    if (FileSystem::getFileSize(handle, size)) {
	Vector<char> buffer(size);
	auto bytesRead = FileSystem::readFromFile(handle, buffer.data(), size);
	result = String::adopt(WTFMove(buffer));
    }
    FileSystem::closeFile(handle);
    return result;
```


More information about the webkit-reviews mailing list