ThreadableWebSocketChannelClientWrapper shouldn't have a String in it.
authoryutak@chromium.org <yutak@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 15 Sep 2011 07:41:02 +0000 (07:41 +0000)
committeryutak@chromium.org <yutak@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 15 Sep 2011 07:41:02 +0000 (07:41 +0000)
commit642d47f927893555924db775d13bf379b7853ded
tree326c59c79fb4df69330010d2ef700db461fbfed4
parenta9c2fee2a7b6bcaf1152c4b1b305a2bd84607e26
ThreadableWebSocketChannelClientWrapper shouldn't have a String in it.
https://bugs.webkit.org/show_bug.cgi?id=67908

Reviewed by David Levin.

Replace a String member variable in ThreadableWebSocketChannelClientWrapper with Vector<UChar>.

ThreadableWebSocketChannelClientWrapper is derived from ThreadSafeRefCounted. It may be
destroyed on different threads, which will affect String's refcounting. Therefore, classes
derived from ThreadSafeRefCounted must not have a String member variable.

No change in functionality, thus no new tests. WebSocket worker tests
(tests under http/tests/websocket/tests/{hixie76,hybi}/workers/) should keep passing.

* websockets/ThreadableWebSocketChannelClientWrapper.cpp:
(WebCore::ThreadableWebSocketChannelClientWrapper::ThreadableWebSocketChannelClientWrapper):
(WebCore::ThreadableWebSocketChannelClientWrapper::subprotocol):
Create a String from Vector<UChar>. Note that String constructor taking an empty vector returns
a null string, not an empty string. We want an empty string in that case, so I had to add
special-case handling for an empty vector.
(WebCore::ThreadableWebSocketChannelClientWrapper::setSubprotocol):
Copy the content of the given String into Vector.
* websockets/ThreadableWebSocketChannelClientWrapper.h:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@95176 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/WebCore/ChangeLog
Source/WebCore/websockets/ThreadableWebSocketChannelClientWrapper.cpp
Source/WebCore/websockets/ThreadableWebSocketChannelClientWrapper.h