OLD | NEW |
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 "chrome/browser/chromeos/web_socket_proxy.h" | 5 #include "chrome/browser/chromeos/web_socket_proxy.h" |
6 | 6 |
7 #include <stdio.h> | 7 #include <stdio.h> |
8 #include <stdlib.h> | 8 #include <stdlib.h> |
9 #include <string.h> | 9 #include <string.h> |
10 | 10 |
(...skipping 1292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1303 } | 1303 } |
1304 } | 1304 } |
1305 return true; | 1305 return true; |
1306 } | 1306 } |
1307 | 1307 |
1308 bool Conn::EmitFrame( | 1308 bool Conn::EmitFrame( |
1309 Chan* chan, WebSocketFrameOpcode opcode, const void* buf, size_t size) { | 1309 Chan* chan, WebSocketFrameOpcode opcode, const void* buf, size_t size) { |
1310 uint8 header[10]; | 1310 uint8 header[10]; |
1311 int header_size = 2; | 1311 int header_size = 2; |
1312 DCHECK(chan); | 1312 DCHECK(chan); |
1313 DCHECK(opcode >= 0 && opcode < 16); | 1313 DCHECK(opcode >= 0 && static_cast<int>(opcode) < 16); |
1314 header[0] = opcode | 0x80; // FIN bit set. | 1314 header[0] = opcode | 0x80; // FIN bit set. |
1315 if (size < 126) { | 1315 if (size < 126) { |
1316 header[1] = size; | 1316 header[1] = size; |
1317 } else if (size < (1 << 16)) { | 1317 } else if (size < (1 << 16)) { |
1318 header[1] = 126; | 1318 header[1] = 126; |
1319 WriteNetworkInteger(size, header + 2, 2); | 1319 WriteNetworkInteger(size, header + 2, 2); |
1320 header_size += 2; | 1320 header_size += 2; |
1321 } else { | 1321 } else { |
1322 header[1] = 127; | 1322 header[1] = 127; |
1323 WriteNetworkInteger(size, header + 2, 8); | 1323 WriteNetworkInteger(size, header + 2, 8); |
(...skipping 577 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1901 | 1901 |
1902 void WebSocketProxy::Shutdown() { | 1902 void WebSocketProxy::Shutdown() { |
1903 static_cast<Serv*>(impl_)->Shutdown(); | 1903 static_cast<Serv*>(impl_)->Shutdown(); |
1904 } | 1904 } |
1905 | 1905 |
1906 void WebSocketProxy::OnNetworkChange() { | 1906 void WebSocketProxy::OnNetworkChange() { |
1907 static_cast<Serv*>(impl_)->OnNetworkChange(); | 1907 static_cast<Serv*>(impl_)->OnNetworkChange(); |
1908 } | 1908 } |
1909 | 1909 |
1910 } // namespace chromeos | 1910 } // namespace chromeos |
OLD | NEW |