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

Unified Diff: Source/modules/websockets/MainThreadWebSocketChannel.h

Issue 311993006: [WebSocket] bufferedAmount should not decrease inside a task. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 6 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 side-by-side diff with in-line comments
Download patch
Index: Source/modules/websockets/MainThreadWebSocketChannel.h
diff --git a/Source/modules/websockets/MainThreadWebSocketChannel.h b/Source/modules/websockets/MainThreadWebSocketChannel.h
index 2e4f68228cf46f61c29daad255081be921d6dcfd..729792e3f46a65d7e99a6120896e45385398863d 100644
--- a/Source/modules/websockets/MainThreadWebSocketChannel.h
+++ b/Source/modules/websockets/MainThreadWebSocketChannel.h
@@ -75,7 +75,6 @@ public:
virtual WebSocketChannel::SendResult send(const ArrayBuffer&, unsigned byteOffset, unsigned byteLength) OVERRIDE;
virtual WebSocketChannel::SendResult send(PassRefPtr<BlobDataHandle>) OVERRIDE;
virtual WebSocketChannel::SendResult send(PassOwnPtr<Vector<char> > data) OVERRIDE;
- virtual unsigned long bufferedAmount() const OVERRIDE;
// Start closing handshake. Use the CloseEventCodeNotSpecified for the code
// argument to omit payload.
virtual void close(int code, const String& reason) OVERRIDE;
@@ -89,7 +88,7 @@ public:
virtual void didOpenSocketStream(SocketStreamHandle*) OVERRIDE;
virtual void didCloseSocketStream(SocketStreamHandle*) OVERRIDE;
virtual void didReceiveSocketStreamData(SocketStreamHandle*, const char*, int) OVERRIDE;
- virtual void didUpdateBufferedAmount(SocketStreamHandle*, size_t bufferedAmount) OVERRIDE;
+ virtual void didConsumeBufferedAmount(SocketStreamHandle*, size_t consumed) OVERRIDE;
virtual void didFailSocketStream(SocketStreamHandle*, const SocketStreamError&) OVERRIDE;
// FileReaderLoaderClient functions.
@@ -101,6 +100,25 @@ public:
private:
MainThreadWebSocketChannel(Document*, WebSocketChannelClient*, const String&, unsigned);
+ class FramingOverhead {
+ public:
+ FramingOverhead(WebSocketFrame::OpCode opcode, size_t frameDataSize, size_t originalPayloadLength)
+ : m_opcode(opcode)
+ , m_frameDataSize(frameDataSize)
+ , m_originalPayloadLength(originalPayloadLength)
+ {
+ }
+
+ WebSocketFrame::OpCode opcode() const { return m_opcode; }
+ size_t frameDataSize() const { return m_frameDataSize; }
+ size_t originalPayloadLength() const { return m_originalPayloadLength; }
+
+ private:
+ WebSocketFrame::OpCode m_opcode;
+ size_t m_frameDataSize;
+ size_t m_originalPayloadLength;
+ };
+
void clearDocument();
void disconnectHandle();
@@ -196,7 +214,6 @@ private:
Timer<MainThreadWebSocketChannel> m_closingTimer;
ChannelState m_state;
bool m_shouldDiscardReceivedData;
- unsigned long m_unhandledBufferedAmount;
unsigned long m_identifier; // m_identifier == 0 means that we could not obtain a valid identifier.
@@ -209,6 +226,10 @@ private:
Deque<OwnPtr<QueuedFrame> > m_outgoingFrameQueue;
OutgoingFrameQueueStatus m_outgoingFrameQueueStatus;
+ Deque<FramingOverhead> m_framingOverheadQueue;
+ // The number of bytes that are already consumed (i.e. sent) in the
+ // current frame.
+ size_t m_numConsumedBytesInCurrentFrame;
// FIXME: Load two or more Blobs simultaneously for better performance.
OwnPtr<FileReaderLoader> m_blobLoader;

Powered by Google App Engine
This is Rietveld 408576698