Title: [95025] trunk/Source/WebCore
Revision
95025
Author
yu...@chromium.org
Date
2011-09-13 06:25:18 -0700 (Tue, 13 Sep 2011)

Log Message

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>.

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>.
(WebCore::ThreadableWebSocketChannelClientWrapper::setSubprotocol):
Copy the content of the given String into Vector.
* websockets/ThreadableWebSocketChannelClientWrapper.h:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (95024 => 95025)


--- trunk/Source/WebCore/ChangeLog	2011-09-13 13:00:33 UTC (rev 95024)
+++ trunk/Source/WebCore/ChangeLog	2011-09-13 13:25:18 UTC (rev 95025)
@@ -1,3 +1,23 @@
+2011-09-13  Yuta Kitamura  <yu...@chromium.org>
+
+        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>.
+
+        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>.
+        (WebCore::ThreadableWebSocketChannelClientWrapper::setSubprotocol):
+        Copy the content of the given String into Vector.
+        * websockets/ThreadableWebSocketChannelClientWrapper.h:
+
 2011-09-13  Fumitoshi Ukai  <u...@chromium.org>
 
         Unreviewed, build fix.

Modified: trunk/Source/WebCore/websockets/ThreadableWebSocketChannelClientWrapper.cpp (95024 => 95025)


--- trunk/Source/WebCore/websockets/ThreadableWebSocketChannelClientWrapper.cpp	2011-09-13 13:00:33 UTC (rev 95024)
+++ trunk/Source/WebCore/websockets/ThreadableWebSocketChannelClientWrapper.cpp	2011-09-13 13:25:18 UTC (rev 95025)
@@ -44,7 +44,6 @@
     : m_client(client)
     , m_syncMethodDone(false)
     , m_useHixie76Protocol(true)
-    , m_subprotocol("")
     , m_sendRequestResult(false)
     , m_bufferedAmount(0)
     , m_suspended(false)
@@ -83,12 +82,15 @@
 
 String ThreadableWebSocketChannelClientWrapper::subprotocol() const
 {
-    return m_subprotocol;
+    return String(m_subprotocol);
 }
 
 void ThreadableWebSocketChannelClientWrapper::setSubprotocol(const String& subprotocol)
 {
-    m_subprotocol = subprotocol;
+    unsigned length = subprotocol.length();
+    m_subprotocol.resize(length);
+    if (length)
+        memcpy(m_subprotocol.data(), subprotocol.characters(), sizeof(UChar) * length);
 }
 
 bool ThreadableWebSocketChannelClientWrapper::sendRequestResult() const

Modified: trunk/Source/WebCore/websockets/ThreadableWebSocketChannelClientWrapper.h (95024 => 95025)


--- trunk/Source/WebCore/websockets/ThreadableWebSocketChannelClientWrapper.h	2011-09-13 13:00:33 UTC (rev 95024)
+++ trunk/Source/WebCore/websockets/ThreadableWebSocketChannelClientWrapper.h	2011-09-13 13:25:18 UTC (rev 95025)
@@ -93,7 +93,7 @@
     WebSocketChannelClient* m_client;
     bool m_syncMethodDone;
     bool m_useHixie76Protocol;
-    String m_subprotocol;
+    Vector<UChar> m_subprotocol;
     bool m_sendRequestResult;
     unsigned long m_bufferedAmount;
     bool m_suspended;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to