Changeset 168183 in webkit
- Timestamp:
- May 2, 2014 12:43:57 PM (10 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r168181 r168183 1 2014-05-02 Alexey Proskuryakov <ap@apple.com> 2 3 Don't abuse Blob deserialization constructor in WebSocket 4 https://bugs.webkit.org/show_bug.cgi?id=132478 5 6 Reviewed by Sam Weinig. 7 8 * Modules/websockets/WebSocketChannel.cpp: 9 (WebCore::WebSocketChannel::send): 10 (WebCore::WebSocketChannel::enqueueBlobFrame): This is the important change - 11 Blob::create was called for no reason. If the blob came from a worker, it was 12 already cloned for cross-thread messaging, otherwise there is no reason to make 13 a new one. 14 15 * fileapi/Blob.h: 16 (WebCore::Blob::deserialize): 17 (WebCore::Blob::create): Deleted. 18 * fileapi/File.h: 19 (WebCore::File::deserialize): 20 (WebCore::File::create): Deleted. 21 Renamed a special case of "create" function to avoid explaining what it is for. 22 23 * Modules/websockets/ThreadableWebSocketChannel.h: 24 * Modules/websockets/WebSocket.cpp: 25 (WebCore::WebSocket::send): 26 * Modules/websockets/WebSocketChannel.h: 27 * Modules/websockets/WorkerThreadableWebSocketChannel.cpp: 28 (WebCore::WorkerThreadableWebSocketChannel::send): Print a full URL in LOG(), 29 not one shortened to 1024 characters. 30 (WebCore::WorkerThreadableWebSocketChannel::Peer::send): 31 (WebCore::WorkerThreadableWebSocketChannel::mainThreadSendBlob): 32 (WebCore::WorkerThreadableWebSocketChannel::Bridge::send): 33 * Modules/websockets/WorkerThreadableWebSocketChannel.h: 34 * bindings/js/SerializedScriptValue.cpp: 35 (WebCore::CloneDeserializer::readFile): 36 (WebCore::CloneDeserializer::readTerminal): 37 1 38 2014-05-02 Anders Carlsson <andersca@apple.com> 2 39 -
trunk/Source/WebCore/Modules/websockets/ThreadableWebSocketChannel.h
r156550 r168183 67 67 virtual SendResult send(const String& message) = 0; 68 68 virtual SendResult send(const JSC::ArrayBuffer&, unsigned byteOffset, unsigned byteLength) = 0; 69 virtual SendResult send( constBlob&) = 0;69 virtual SendResult send(Blob&) = 0; 70 70 virtual unsigned long bufferedAmount() const = 0; 71 71 virtual void close(int code, const String& reason) = 0; -
trunk/Source/WebCore/Modules/websockets/WebSocket.cpp
r168166 r168183 351 351 { 352 352 LOG(Network, "WebSocket %p send() Sending Blob '%s'", this, binaryData->url().stringCenterEllipsizedToLength().utf8().data()); 353 ASSERT(binaryData);354 353 if (m_state == CONNECTING) { 355 354 ec = INVALID_STATE_ERR; -
trunk/Source/WebCore/Modules/websockets/WebSocketChannel.cpp
r163722 r168183 154 154 } 155 155 156 ThreadableWebSocketChannel::SendResult WebSocketChannel::send( constBlob& binaryData)157 { 158 LOG(Network, "WebSocketChannel %p send() Sending Blob '%s'", this, binaryData.url().string CenterEllipsizedToLength().utf8().data());156 ThreadableWebSocketChannel::SendResult WebSocketChannel::send(Blob& binaryData) 157 { 158 LOG(Network, "WebSocketChannel %p send() Sending Blob '%s'", this, binaryData.url().string().utf8().data()); 159 159 enqueueBlobFrame(WebSocketFrame::OpCodeBinary, binaryData); 160 160 processOutgoingFrameQueue(); … … 696 696 } 697 697 698 void WebSocketChannel::enqueueBlobFrame(WebSocketFrame::OpCode opCode, constBlob& blob)698 void WebSocketChannel::enqueueBlobFrame(WebSocketFrame::OpCode opCode, Blob& blob) 699 699 { 700 700 ASSERT(m_outgoingFrameQueueStatus == OutgoingFrameQueueOpen); … … 702 702 frame->opCode = opCode; 703 703 frame->frameType = QueuedFrameTypeBlob; 704 frame->blobData = Blob::create(blob.url(), blob.type(), blob.size());704 frame->blobData = &blob; 705 705 m_outgoingFrameQueue.append(frame.release()); 706 706 } -
trunk/Source/WebCore/Modules/websockets/WebSocketChannel.h
r162139 r168183 74 74 virtual ThreadableWebSocketChannel::SendResult send(const String& message) override; 75 75 virtual ThreadableWebSocketChannel::SendResult send(const JSC::ArrayBuffer&, unsigned byteOffset, unsigned byteLength) override; 76 virtual ThreadableWebSocketChannel::SendResult send( constBlob&) override;76 virtual ThreadableWebSocketChannel::SendResult send(Blob&) override; 77 77 virtual unsigned long bufferedAmount() const override; 78 78 virtual void close(int code, const String& reason) override; // Start closing handshake. … … 162 162 void enqueueTextFrame(const CString&); 163 163 void enqueueRawFrame(WebSocketFrame::OpCode, const char* data, size_t dataLength); 164 void enqueueBlobFrame(WebSocketFrame::OpCode, constBlob&);164 void enqueueBlobFrame(WebSocketFrame::OpCode, Blob&); 165 165 166 166 void processOutgoingFrameQueue(); -
trunk/Source/WebCore/Modules/websockets/WorkerThreadableWebSocketChannel.cpp
r167943 r168183 99 99 } 100 100 101 ThreadableWebSocketChannel::SendResult WorkerThreadableWebSocketChannel::send( constBlob& binaryData)101 ThreadableWebSocketChannel::SendResult WorkerThreadableWebSocketChannel::send(Blob& binaryData) 102 102 { 103 103 if (!m_bridge) … … 193 193 } 194 194 195 void WorkerThreadableWebSocketChannel::Peer::send( constBlob& binaryData)195 void WorkerThreadableWebSocketChannel::Peer::send(Blob& binaryData) 196 196 { 197 197 ASSERT(isMainThread()); … … 439 439 ASSERT(peer); 440 440 441 RefPtr<Blob> blob = Blob:: create(url, type, size);441 RefPtr<Blob> blob = Blob::deserialize(url, type, size); 442 442 peer->send(*blob); 443 443 } … … 475 475 } 476 476 477 ThreadableWebSocketChannel::SendResult WorkerThreadableWebSocketChannel::Bridge::send( constBlob& binaryData)477 ThreadableWebSocketChannel::SendResult WorkerThreadableWebSocketChannel::Bridge::send(Blob& binaryData) 478 478 { 479 479 if (!m_workerClientWrapper || !m_peer) -
trunk/Source/WebCore/Modules/websockets/WorkerThreadableWebSocketChannel.h
r167943 r168183 68 68 virtual ThreadableWebSocketChannel::SendResult send(const String& message) override; 69 69 virtual ThreadableWebSocketChannel::SendResult send(const JSC::ArrayBuffer&, unsigned byteOffset, unsigned byteLength) override; 70 virtual ThreadableWebSocketChannel::SendResult send( constBlob&) override;70 virtual ThreadableWebSocketChannel::SendResult send(Blob&) override; 71 71 virtual unsigned long bufferedAmount() const override; 72 72 virtual void close(int code, const String& reason) override; … … 90 90 void send(const String& message); 91 91 void send(const JSC::ArrayBuffer&); 92 void send( constBlob&);92 void send(Blob&); 93 93 void bufferedAmount(); 94 94 void close(int code, const String& reason); … … 136 136 ThreadableWebSocketChannel::SendResult send(const String& message); 137 137 ThreadableWebSocketChannel::SendResult send(const JSC::ArrayBuffer&, unsigned byteOffset, unsigned byteLength); 138 ThreadableWebSocketChannel::SendResult send( constBlob&);138 ThreadableWebSocketChannel::SendResult send(Blob&); 139 139 unsigned long bufferedAmount(); 140 140 void close(int code, const String& reason); -
trunk/Source/WebCore/bindings/js/SerializedScriptValue.cpp
r167368 r168183 1733 1733 return 0; 1734 1734 if (m_isDOMGlobalObject) 1735 file = File:: create(path->string(), URL(URL(), url->string()), type->string());1735 file = File::deserialize(path->string(), URL(URL(), url->string()), type->string()); 1736 1736 return true; 1737 1737 } … … 2232 2232 if (!m_isDOMGlobalObject) 2233 2233 return jsNull(); 2234 return getJSValue(Blob:: create(URL(URL(), url->string()), type->string(), size).get());2234 return getJSValue(Blob::deserialize(URL(URL(), url->string()), type->string(), size).get()); 2235 2235 } 2236 2236 case StringTag: { -
trunk/Source/WebCore/fileapi/Blob.h
r168126 r168183 56 56 } 57 57 58 // For deserialization. 59 static PassRefPtr<Blob> create(const URL& srcURL, const String& type, long long size) 58 static PassRefPtr<Blob> deserialize(const URL& srcURL, const String& type, long long size) 60 59 { 61 60 ASSERT(Blob::isNormalizedContentType(type)); -
trunk/Source/WebCore/fileapi/File.h
r168126 r168183 50 50 } 51 51 52 // For deserialization. 53 static PassRefPtr<File> create(const String& path, const URL& srcURL, const String& type) 52 static PassRefPtr<File> deserialize(const String& path, const URL& srcURL, const String& type) 54 53 { 55 54 return adoptRef(new File(path, srcURL, type)); … … 77 76 private: 78 77 File(const String& path, ContentTypeLookupPolicy); 78 File(const String& path, const String& name, ContentTypeLookupPolicy); 79 79 80 80 // For deserialization. 81 81 File(const String& path, const URL& srcURL, const String& type); 82 File(const String& path, const String& name, ContentTypeLookupPolicy);83 82 84 83 String m_path;
Note: See TracChangeset
for help on using the changeset viewer.