Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(13)

Side by Side Diff: Source/modules/websockets/NewWebSocketChannelImpl.cpp

Issue 279783002: Delete unnecessary construction of WebSocketFrame in NewWebSocketChannelImpl (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
177 return m_extensions; 177 return m_extensions;
178 } 178 }
179 179
180 WebSocketChannel::SendResult NewWebSocketChannelImpl::send(const String& message ) 180 WebSocketChannel::SendResult NewWebSocketChannelImpl::send(const String& message )
181 { 181 {
182 WTF_LOG(Network, "NewWebSocketChannelImpl %p sendText(%s)", this, message.ut f8().data()); 182 WTF_LOG(Network, "NewWebSocketChannelImpl %p sendText(%s)", this, message.ut f8().data());
183 if (m_identifier) { 183 if (m_identifier) {
184 // FIXME: Change the inspector API to show the entire message instead 184 // FIXME: Change the inspector API to show the entire message instead
185 // of individual frames. 185 // of individual frames.
186 CString data = message.utf8(); 186 CString data = message.utf8();
187 WebSocketFrame frame(WebSocketFrame::OpCodeText, data.data(), data.lengt h(), WebSocketFrame::Final | WebSocketFrame::Masked); 187 InspectorInstrumentation::didSendWebSocketFrame(document(), m_identifier , WebSocketFrame::OpCodeText, true, data.data(), data.length());
188 InspectorInstrumentation::didSendWebSocketFrame(document(), m_identifier , frame.opCode, frame.masked, frame.payload, frame.payloadLength);
189 } 188 }
190 m_messages.append(Message(message)); 189 m_messages.append(Message(message));
191 sendInternal(); 190 sendInternal();
192 return SendSuccess; 191 return SendSuccess;
193 } 192 }
194 193
195 WebSocketChannel::SendResult NewWebSocketChannelImpl::send(PassRefPtr<BlobDataHa ndle> blobDataHandle) 194 WebSocketChannel::SendResult NewWebSocketChannelImpl::send(PassRefPtr<BlobDataHa ndle> blobDataHandle)
196 { 195 {
197 WTF_LOG(Network, "NewWebSocketChannelImpl %p sendBlob(%s, %s, %llu)", this, blobDataHandle->uuid().utf8().data(), blobDataHandle->type().utf8().data(), blob DataHandle->size()); 196 WTF_LOG(Network, "NewWebSocketChannelImpl %p sendBlob(%s, %s, %llu)", this, blobDataHandle->uuid().utf8().data(), blobDataHandle->type().utf8().data(), blob DataHandle->size());
198 if (m_identifier) { 197 if (m_identifier) {
199 // FIXME: Change the inspector API to show the entire message instead 198 // FIXME: Change the inspector API to show the entire message instead
200 // of individual frames. 199 // of individual frames.
201 // FIXME: We can't access the data here. 200 // FIXME: We can't access the data here.
202 // Since Binary data are not displayed in Inspector, this does not 201 // Since Binary data are not displayed in Inspector, this does not
203 // affect actual behavior. 202 // affect actual behavior.
204 WebSocketFrame frame(WebSocketFrame::OpCodeBinary, "", 0, WebSocketFrame ::Final | WebSocketFrame::Masked); 203 InspectorInstrumentation::didSendWebSocketFrame(document(), m_identifier , WebSocketFrame::OpCodeBinary, true, "", 0);
205 InspectorInstrumentation::didSendWebSocketFrame(document(), m_identifier , frame.opCode, frame.masked, frame.payload, frame.payloadLength);
206 } 204 }
207 m_messages.append(Message(blobDataHandle)); 205 m_messages.append(Message(blobDataHandle));
208 sendInternal(); 206 sendInternal();
209 return SendSuccess; 207 return SendSuccess;
210 } 208 }
211 209
212 WebSocketChannel::SendResult NewWebSocketChannelImpl::send(const ArrayBuffer& bu ffer, unsigned byteOffset, unsigned byteLength) 210 WebSocketChannel::SendResult NewWebSocketChannelImpl::send(const ArrayBuffer& bu ffer, unsigned byteOffset, unsigned byteLength)
213 { 211 {
214 WTF_LOG(Network, "NewWebSocketChannelImpl %p sendArrayBuffer(%p, %u, %u)", t his, buffer.data(), byteOffset, byteLength); 212 WTF_LOG(Network, "NewWebSocketChannelImpl %p sendArrayBuffer(%p, %u, %u)", t his, buffer.data(), byteOffset, byteLength);
215 if (m_identifier) { 213 if (m_identifier) {
216 // FIXME: Change the inspector API to show the entire message instead 214 // FIXME: Change the inspector API to show the entire message instead
217 // of individual frames. 215 // of individual frames.
218 WebSocketFrame frame(WebSocketFrame::OpCodeBinary, static_cast<const cha r*>(buffer.data()) + byteOffset, byteLength, WebSocketFrame::Final | WebSocketFr ame::Masked); 216 InspectorInstrumentation::didSendWebSocketFrame(document(), m_identifier , WebSocketFrame::OpCodeBinary, true, static_cast<const char*>(buffer.data()) + byteOffset, byteLength);
219 InspectorInstrumentation::didSendWebSocketFrame(document(), m_identifier , frame.opCode, frame.masked, frame.payload, frame.payloadLength);
220 } 217 }
221 // buffer.slice copies its contents. 218 // buffer.slice copies its contents.
222 m_messages.append(buffer.slice(byteOffset, byteOffset + byteLength)); 219 m_messages.append(buffer.slice(byteOffset, byteOffset + byteLength));
223 sendInternal(); 220 sendInternal();
224 return SendSuccess; 221 return SendSuccess;
225 } 222 }
226 223
227 unsigned long NewWebSocketChannelImpl::bufferedAmount() const 224 unsigned long NewWebSocketChannelImpl::bufferedAmount() const
228 { 225 {
229 WTF_LOG(Network, "NewWebSocketChannelImpl %p bufferedAmount()", this); 226 WTF_LOG(Network, "NewWebSocketChannelImpl %p bufferedAmount()", this);
(...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after
531 // |this| can be deleted here. 528 // |this| can be deleted here.
532 } 529 }
533 530
534 void NewWebSocketChannelImpl::trace(Visitor* visitor) 531 void NewWebSocketChannelImpl::trace(Visitor* visitor)
535 { 532 {
536 visitor->trace(m_blobLoader); 533 visitor->trace(m_blobLoader);
537 WebSocketChannel::trace(visitor); 534 WebSocketChannel::trace(visitor);
538 } 535 }
539 536
540 } // namespace WebCore 537 } // namespace WebCore
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698