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

Side by Side Diff: net/websockets/websocket_frame.cc

Issue 10796107: WebSocketFrameChunk should use IOBuffer to hold data (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: reflect yutak's review Created 8 years, 5 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "net/websockets/websocket_frame.h" 5 #include "net/websockets/websocket_frame.h"
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/rand_util.h" 9 #include "base/rand_util.h"
10 #include "net/base/big_endian.h" 10 #include "net/base/big_endian.h"
11 #include "net/base/io_buffer.h"
11 #include "net/base/net_errors.h" 12 #include "net/base/net_errors.h"
12 13
13 namespace { 14 namespace {
14 15
15 const uint8 kFinalBit = 0x80; 16 const uint8 kFinalBit = 0x80;
16 const uint8 kReserved1Bit = 0x40; 17 const uint8 kReserved1Bit = 0x40;
17 const uint8 kReserved2Bit = 0x20; 18 const uint8 kReserved2Bit = 0x20;
18 const uint8 kReserved3Bit = 0x10; 19 const uint8 kReserved3Bit = 0x10;
19 const uint8 kOpCodeMask = 0xF; 20 const uint8 kOpCodeMask = 0xF;
20 const uint8 kMaskBit = 0x80; 21 const uint8 kMaskBit = 0x80;
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 // (4 or 8 bytes), instead of XOR'ing every byte. 146 // (4 or 8 bytes), instead of XOR'ing every byte.
146 size_t masking_key_offset = frame_offset % kMaskingKeyLength; 147 size_t masking_key_offset = frame_offset % kMaskingKeyLength;
147 for (int i = 0; i < data_size; ++i) { 148 for (int i = 0; i < data_size; ++i) {
148 data[i] ^= masking_key.key[masking_key_offset++]; 149 data[i] ^= masking_key.key[masking_key_offset++];
149 if (masking_key_offset == kMaskingKeyLength) 150 if (masking_key_offset == kMaskingKeyLength)
150 masking_key_offset = 0; 151 masking_key_offset = 0;
151 } 152 }
152 } 153 }
153 154
154 } // namespace net 155 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698