| OLD | NEW |
| 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 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 202 { | 202 { |
| 203 WTF_LOG(Network, "DocumentWebSocketChannel %p sendArrayBuffer(%p, %u, %u)",
this, buffer.data(), byteOffset, byteLength); | 203 WTF_LOG(Network, "DocumentWebSocketChannel %p sendArrayBuffer(%p, %u, %u)",
this, buffer.data(), byteOffset, byteLength); |
| 204 if (m_identifier) { | 204 if (m_identifier) { |
| 205 // FIXME: Change the inspector API to show the entire message instead | 205 // FIXME: Change the inspector API to show the entire message instead |
| 206 // of individual frames. | 206 // of individual frames. |
| 207 InspectorInstrumentation::didSendWebSocketFrame(document(), m_identifier
, WebSocketFrame::OpCodeBinary, true, static_cast<const char*>(buffer.data()) +
byteOffset, byteLength); | 207 InspectorInstrumentation::didSendWebSocketFrame(document(), m_identifier
, WebSocketFrame::OpCodeBinary, true, static_cast<const char*>(buffer.data()) +
byteOffset, byteLength); |
| 208 } | 208 } |
| 209 // buffer.slice copies its contents. | 209 // buffer.slice copies its contents. |
| 210 // FIXME: Reduce copy by sending the data immediately when we don't need to | 210 // FIXME: Reduce copy by sending the data immediately when we don't need to |
| 211 // queue the data. | 211 // queue the data. |
| 212 m_messages.append(adoptPtr(new Message(buffer.slice(byteOffset, byteOffset +
byteLength)))); | 212 RefPtr<DOMArrayBuffer> slice = buffer.sliceOrNull(byteOffset, byteOffset + b
yteLength); |
| 213 // FIXME: Could we propagate a RangeError exception from here instead the fo
llowing assert? |
| 214 RELEASE_ASSERT(slice); // This is an out-of-memory condition. |
| 215 m_messages.append(adoptPtr(new Message(slice.release()))); |
| 213 processSendQueue(); | 216 processSendQueue(); |
| 214 } | 217 } |
| 215 | 218 |
| 216 void DocumentWebSocketChannel::sendTextAsCharVector(PassOwnPtr<Vector<char>> dat
a) | 219 void DocumentWebSocketChannel::sendTextAsCharVector(PassOwnPtr<Vector<char>> dat
a) |
| 217 { | 220 { |
| 218 WTF_LOG(Network, "DocumentWebSocketChannel %p sendTextAsCharVector(%p, %llu)
", this, data.get(), static_cast<unsigned long long>(data->size())); | 221 WTF_LOG(Network, "DocumentWebSocketChannel %p sendTextAsCharVector(%p, %llu)
", this, data.get(), static_cast<unsigned long long>(data->size())); |
| 219 if (m_identifier) { | 222 if (m_identifier) { |
| 220 // FIXME: Change the inspector API to show the entire message instead | 223 // FIXME: Change the inspector API to show the entire message instead |
| 221 // of individual frames. | 224 // of individual frames. |
| 222 InspectorInstrumentation::didSendWebSocketFrame(document(), m_identifier
, WebSocketFrame::OpCodeText, true, data->data(), data->size()); | 225 InspectorInstrumentation::didSendWebSocketFrame(document(), m_identifier
, WebSocketFrame::OpCodeText, true, data->data(), data->size()); |
| (...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 576 | 579 |
| 577 DEFINE_TRACE(DocumentWebSocketChannel) | 580 DEFINE_TRACE(DocumentWebSocketChannel) |
| 578 { | 581 { |
| 579 visitor->trace(m_blobLoader); | 582 visitor->trace(m_blobLoader); |
| 580 visitor->trace(m_client); | 583 visitor->trace(m_client); |
| 581 WebSocketChannel::trace(visitor); | 584 WebSocketChannel::trace(visitor); |
| 582 ContextLifecycleObserver::trace(visitor); | 585 ContextLifecycleObserver::trace(visitor); |
| 583 } | 586 } |
| 584 | 587 |
| 585 } // namespace blink | 588 } // namespace blink |
| OLD | NEW |