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

Side by Side Diff: Source/modules/websockets/MainThreadWebSocketChannel.h

Issue 16049014: Modify MainThreadWebSocketChannel to use enumeration for denotating its current state (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 7 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
« no previous file with comments | « no previous file | Source/modules/websockets/MainThreadWebSocketChannel.cpp » ('j') | 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) 2011, 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2011, 2012 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 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
166 // data in order. Calling this method directly jumps in the process. 166 // data in order. Calling this method directly jumps in the process.
167 bool sendFrame(WebSocketFrame::OpCode, const char* data, size_t dataLength); 167 bool sendFrame(WebSocketFrame::OpCode, const char* data, size_t dataLength);
168 168
169 enum BlobLoaderStatus { 169 enum BlobLoaderStatus {
170 BlobLoaderNotStarted, 170 BlobLoaderNotStarted,
171 BlobLoaderStarted, 171 BlobLoaderStarted,
172 BlobLoaderFinished, 172 BlobLoaderFinished,
173 BlobLoaderFailed 173 BlobLoaderFailed
174 }; 174 };
175 175
176 enum ChannelState {
177 ChannelIdle,
178 ChannelClosing,
179 ChannelClosed
180 };
181
176 Document* m_document; 182 Document* m_document;
177 WebSocketChannelClient* m_client; 183 WebSocketChannelClient* m_client;
178 OwnPtr<WebSocketHandshake> m_handshake; 184 OwnPtr<WebSocketHandshake> m_handshake;
179 RefPtr<SocketStreamHandle> m_handle; 185 RefPtr<SocketStreamHandle> m_handle;
180 Vector<char> m_buffer; 186 Vector<char> m_buffer;
181 187
182 Timer<MainThreadWebSocketChannel> m_resumeTimer; 188 Timer<MainThreadWebSocketChannel> m_resumeTimer;
183 bool m_suspended; 189 bool m_suspended;
184 bool m_closing;
185 bool m_didFailOfClientAlreadyRun; 190 bool m_didFailOfClientAlreadyRun;
186 bool m_receivedClosingHandshake; 191 bool m_receivedClosingHandshake;
187 Timer<MainThreadWebSocketChannel> m_closingTimer; 192 Timer<MainThreadWebSocketChannel> m_closingTimer;
188 bool m_closed; 193 ChannelState m_state;
189 bool m_shouldDiscardReceivedData; 194 bool m_shouldDiscardReceivedData;
190 unsigned long m_unhandledBufferedAmount; 195 unsigned long m_unhandledBufferedAmount;
191 196
192 unsigned long m_identifier; // m_identifier == 0 means that we could not obt ain a valid identifier. 197 unsigned long m_identifier; // m_identifier == 0 means that we could not obt ain a valid identifier.
193 198
194 // Private members only for hybi-10 protocol. 199 // Private members only for hybi-10 protocol.
195 bool m_hasContinuousFrame; 200 bool m_hasContinuousFrame;
196 WebSocketFrame::OpCode m_continuousFrameOpCode; 201 WebSocketFrame::OpCode m_continuousFrameOpCode;
197 Vector<char> m_continuousFrameData; 202 Vector<char> m_continuousFrameData;
198 unsigned short m_closeEventCode; 203 unsigned short m_closeEventCode;
199 String m_closeEventReason; 204 String m_closeEventReason;
200 205
201 Deque<OwnPtr<QueuedFrame> > m_outgoingFrameQueue; 206 Deque<OwnPtr<QueuedFrame> > m_outgoingFrameQueue;
202 OutgoingFrameQueueStatus m_outgoingFrameQueueStatus; 207 OutgoingFrameQueueStatus m_outgoingFrameQueueStatus;
203 208
204 // FIXME: Load two or more Blobs simultaneously for better performance. 209 // FIXME: Load two or more Blobs simultaneously for better performance.
205 OwnPtr<FileReaderLoader> m_blobLoader; 210 OwnPtr<FileReaderLoader> m_blobLoader;
206 BlobLoaderStatus m_blobLoaderStatus; 211 BlobLoaderStatus m_blobLoaderStatus;
207 212
208 String m_sourceURLAtConnection; 213 String m_sourceURLAtConnection;
209 unsigned m_lineNumberAtConnection; 214 unsigned m_lineNumberAtConnection;
210 WebSocketPerMessageDeflate m_perMessageDeflate; 215 WebSocketPerMessageDeflate m_perMessageDeflate;
211 WebSocketDeflateFramer m_deflateFramer; 216 WebSocketDeflateFramer m_deflateFramer;
212 }; 217 };
213 218
214 } // namespace WebCore 219 } // namespace WebCore
215 220
216 #endif // MainThreadWebSocketChannel_h 221 #endif // MainThreadWebSocketChannel_h
OLDNEW
« no previous file with comments | « no previous file | Source/modules/websockets/MainThreadWebSocketChannel.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698