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

Side by Side Diff: Source/modules/websockets/WebSocket.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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2011 Google Inc. All rights reserved. 2 * Copyright (C) 2011 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 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 virtual bool hasPendingActivity() const OVERRIDE; 113 virtual bool hasPendingActivity() const OVERRIDE;
114 virtual void suspend() OVERRIDE; 114 virtual void suspend() OVERRIDE;
115 virtual void resume() OVERRIDE; 115 virtual void resume() OVERRIDE;
116 virtual void stop() OVERRIDE; 116 virtual void stop() OVERRIDE;
117 117
118 // WebSocketChannelClient functions. 118 // WebSocketChannelClient functions.
119 virtual void didConnect() OVERRIDE; 119 virtual void didConnect() OVERRIDE;
120 virtual void didReceiveMessage(const String& message) OVERRIDE; 120 virtual void didReceiveMessage(const String& message) OVERRIDE;
121 virtual void didReceiveBinaryData(PassOwnPtr<Vector<char> >) OVERRIDE; 121 virtual void didReceiveBinaryData(PassOwnPtr<Vector<char> >) OVERRIDE;
122 virtual void didReceiveMessageError() OVERRIDE; 122 virtual void didReceiveMessageError() OVERRIDE;
123 virtual void didUpdateBufferedAmount(unsigned long bufferedAmount) OVERRIDE; 123 virtual void didIncreaseBufferedAmount(unsigned long) OVERRIDE;
124 virtual void didDecreaseBufferedAmount(unsigned long) OVERRIDE;
124 virtual void didStartClosingHandshake() OVERRIDE; 125 virtual void didStartClosingHandshake() OVERRIDE;
125 virtual void didClose(unsigned long unhandledBufferedAmount, ClosingHandshak eCompletionStatus, unsigned short code, const String& reason) OVERRIDE; 126 virtual void didClose(unsigned long unhandledBufferedAmount, ClosingHandshak eCompletionStatus, unsigned short code, const String& reason) OVERRIDE;
126 127
127 virtual void trace(Visitor*) OVERRIDE; 128 virtual void trace(Visitor*) OVERRIDE;
128 129
129 static bool isValidSubprotocolString(const String&); 130 static bool isValidSubprotocolString(const String&);
130 131
131 protected: 132 protected:
132 explicit WebSocket(ExecutionContext*); 133 explicit WebSocket(ExecutionContext*);
133 134
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
201 202
202 // Checks the result of WebSocketChannel::send() method, and: 203 // Checks the result of WebSocketChannel::send() method, and:
203 // - shows console message 204 // - shows console message
204 // - sets ExceptionState appropriately 205 // - sets ExceptionState appropriately
205 // - reports data for UMA. 206 // - reports data for UMA.
206 void handleSendResult(WebSocketChannel::SendResult, ExceptionState&, WebSock etSendType); 207 void handleSendResult(WebSocketChannel::SendResult, ExceptionState&, WebSock etSendType);
207 208
208 // Updates m_bufferedAmountAfterClose given the amount of data passed to 209 // Updates m_bufferedAmountAfterClose given the amount of data passed to
209 // send() method after the state changed to CLOSING or CLOSED. 210 // send() method after the state changed to CLOSING or CLOSED.
210 void updateBufferedAmountAfterClose(unsigned long); 211 void updateBufferedAmountAfterClose(unsigned long);
212 void decreaseBufferedAmount(Timer<WebSocket>*);
211 213
212 void releaseChannel(); 214 void releaseChannel();
213 215
214 enum BinaryType { 216 enum BinaryType {
215 BinaryTypeBlob, 217 BinaryTypeBlob,
216 BinaryTypeArrayBuffer 218 BinaryTypeArrayBuffer
217 }; 219 };
218 220
219 RefPtrWillBeMember<WebSocketChannel> m_channel; 221 RefPtrWillBeMember<WebSocketChannel> m_channel;
220 222
221 State m_state; 223 State m_state;
222 KURL m_url; 224 KURL m_url;
223 unsigned long m_bufferedAmount; 225 unsigned long m_bufferedAmount;
226 unsigned long m_bufferedAmountDecrease;
224 unsigned long m_bufferedAmountAfterClose; 227 unsigned long m_bufferedAmountAfterClose;
225 BinaryType m_binaryType; 228 BinaryType m_binaryType;
226 // The subprotocol the server selected. 229 // The subprotocol the server selected.
227 String m_subprotocol; 230 String m_subprotocol;
228 String m_extensions; 231 String m_extensions;
229 232
230 RefPtrWillBeMember<EventQueue> m_eventQueue; 233 RefPtrWillBeMember<EventQueue> m_eventQueue;
234 Timer<WebSocket> m_bufferedAmountDecreaseTimer;
231 }; 235 };
232 236
233 } // namespace WebCore 237 } // namespace WebCore
234 238
235 #endif // WebSocket_h 239 #endif // WebSocket_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698