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

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

Issue 1146943003: Removing unused functions from WebSocketFrame class (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 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/WebSocketFrame.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) 2012 Google Inc. All rights reserved. 2 * Copyright (C) 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 13 matching lines...) Expand all
24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */ 29 */
30 30
31 #ifndef WebSocketFrame_h 31 #ifndef WebSocketFrame_h
32 #define WebSocketFrame_h 32 #define WebSocketFrame_h
33 33
34 #include "wtf/text/WTFString.h"
35
36 namespace blink { 34 namespace blink {
37 35
38 struct WebSocketFrame { 36 struct WebSocketFrame {
39 // RFC6455 opcodes. 37 // RFC6455 opcodes.
40 enum OpCode { 38 enum OpCode {
41 OpCodeContinuation = 0x0, 39 OpCodeContinuation = 0x0,
42 OpCodeText = 0x1, 40 OpCodeText = 0x1,
43 OpCodeBinary = 0x2, 41 OpCodeBinary = 0x2,
44 OpCodeClose = 0x8, 42 OpCodeClose = 0x8,
45 OpCodePing = 0x9, 43 OpCodePing = 0x9,
46 OpCodePong = 0xA, 44 OpCodePong = 0xA,
47 OpCodeInvalid = 0x10 45 OpCodeInvalid = 0x10
48 }; 46 };
49 47
50 enum ParseFrameResult {
51 FrameOK,
52 FrameIncomplete,
53 FrameError
54 };
55
56 static bool isNonControlOpCode(OpCode opCode) { return opCode == OpCodeConti nuation || opCode == OpCodeText || opCode == OpCodeBinary; }
57 static bool isControlOpCode(OpCode opCode) { return opCode == OpCodeClose || opCode == OpCodePing || opCode == OpCodePong; }
58 static bool isReservedOpCode(OpCode opCode) { return !isNonControlOpCode(opC ode) && !isControlOpCode(opCode); }
59 static bool needsExtendedLengthField(size_t payloadLength);
60 static ParseFrameResult parseFrame(char* data, size_t dataLength, WebSocketF rame&, const char*& frameEnd, String& errorString); // May modify part of data t o unmask the frame.
61
62 // Flags for the constructor. 48 // Flags for the constructor.
63 // This is not the bitmasks for frame composition / decomposition. 49 // This is not the bitmasks for frame composition / decomposition.
64 enum { 50 enum {
65 EmptyFlags = 0, 51 EmptyFlags = 0,
66 Final = 1, 52 Final = 1,
67 Reserved1 = 2, 53 Reserved1 = 2,
68 Compress = 2, 54 Compress = 2,
69 Reserved2 = 4, 55 Reserved2 = 4,
70 Reserved3 = 8, 56 Reserved3 = 8,
71 Masked = 16, 57 Masked = 16,
72 }; 58 };
73 typedef unsigned Flags; 59 typedef unsigned Flags;
74 WebSocketFrame();
75 // The Flags parameter shall be a combination of above flags. 60 // The Flags parameter shall be a combination of above flags.
76 WebSocketFrame(OpCode, const char* payload, size_t payloadLength, Flags = Em ptyFlags); 61 WebSocketFrame(OpCode, const char* payload, size_t payloadLength, Flags = Em ptyFlags);
77 void makeFrameData(Vector<char>& frameData);
78 62
79 OpCode opCode; 63 OpCode opCode;
80 bool final; 64 bool final;
81 bool compress; 65 bool compress;
82 bool reserved2; 66 bool reserved2;
83 bool reserved3; 67 bool reserved3;
84 bool masked; 68 bool masked;
85 const char* payload; 69 const char* payload;
86 size_t payloadLength; 70 size_t payloadLength;
87 }; 71 };
88 72
89 } // namespace blink 73 } // namespace blink
90 74
91 #endif // WebSocketFrame_h 75 #endif // WebSocketFrame_h
OLDNEW
« no previous file with comments | « no previous file | Source/modules/websockets/WebSocketFrame.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698