Changeset 95176 in webkit
- Timestamp:
- Sep 15, 2011 12:41:02 AM (13 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r95174 r95176 1 2011-09-15 Yuta Kitamura <yutak@chromium.org> 2 3 ThreadableWebSocketChannelClientWrapper shouldn't have a String in it. 4 https://bugs.webkit.org/show_bug.cgi?id=67908 5 6 Reviewed by David Levin. 7 8 Replace a String member variable in ThreadableWebSocketChannelClientWrapper with Vector<UChar>. 9 10 ThreadableWebSocketChannelClientWrapper is derived from ThreadSafeRefCounted. It may be 11 destroyed on different threads, which will affect String's refcounting. Therefore, classes 12 derived from ThreadSafeRefCounted must not have a String member variable. 13 14 No change in functionality, thus no new tests. WebSocket worker tests 15 (tests under http/tests/websocket/tests/{hixie76,hybi}/workers/) should keep passing. 16 17 * websockets/ThreadableWebSocketChannelClientWrapper.cpp: 18 (WebCore::ThreadableWebSocketChannelClientWrapper::ThreadableWebSocketChannelClientWrapper): 19 (WebCore::ThreadableWebSocketChannelClientWrapper::subprotocol): 20 Create a String from Vector<UChar>. Note that String constructor taking an empty vector returns 21 a null string, not an empty string. We want an empty string in that case, so I had to add 22 special-case handling for an empty vector. 23 (WebCore::ThreadableWebSocketChannelClientWrapper::setSubprotocol): 24 Copy the content of the given String into Vector. 25 * websockets/ThreadableWebSocketChannelClientWrapper.h: 26 1 27 2011-09-14 Matthew Delaney <mdelaney@apple.com> 2 28 -
trunk/Source/WebCore/websockets/ThreadableWebSocketChannelClientWrapper.cpp
r95026 r95176 45 45 , m_syncMethodDone(false) 46 46 , m_useHixie76Protocol(true) 47 , m_subprotocol("")48 47 , m_sendRequestResult(false) 49 48 , m_bufferedAmount(0) … … 84 83 String ThreadableWebSocketChannelClientWrapper::subprotocol() const 85 84 { 86 return m_subprotocol; 85 if (m_subprotocol.isEmpty()) 86 return String(""); 87 return String(m_subprotocol); 87 88 } 88 89 89 90 void ThreadableWebSocketChannelClientWrapper::setSubprotocol(const String& subprotocol) 90 91 { 91 m_subprotocol = subprotocol; 92 unsigned length = subprotocol.length(); 93 m_subprotocol.resize(length); 94 if (length) 95 memcpy(m_subprotocol.data(), subprotocol.characters(), sizeof(UChar) * length); 92 96 } 93 97 -
trunk/Source/WebCore/websockets/ThreadableWebSocketChannelClientWrapper.h
r95026 r95176 94 94 bool m_syncMethodDone; 95 95 bool m_useHixie76Protocol; 96 String m_subprotocol;96 Vector<UChar> m_subprotocol; // ThreadSafeRefCounted must not have a String member variable. 97 97 bool m_sendRequestResult; 98 98 unsigned long m_bufferedAmount;
Note: See TracChangeset
for help on using the changeset viewer.