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

Side by Side Diff: net/base/big_endian.h

Issue 8929002: Don't attempt to forward declare StringPiece. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years 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
« no previous file with comments | « no previous file | net/dns/dns_client.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 #ifndef NET_BASE_BIG_ENDIAN_H_ 5 #ifndef NET_BASE_BIG_ENDIAN_H_
6 #define NET_BASE_BIG_ENDIAN_H_ 6 #define NET_BASE_BIG_ENDIAN_H_
7 #pragma once 7 #pragma once
8 8
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/string_piece.h"
10 #include "net/base/net_export.h" 11 #include "net/base/net_export.h"
11 12
12 namespace base {
13 class StringPiece;
14 }
15
16 namespace net { 13 namespace net {
17 14
18 // Read an integer (signed or unsigned) from |buf| in Big Endian order. 15 // Read an integer (signed or unsigned) from |buf| in Big Endian order.
19 // Note: this loop is unrolled with -O1 and above. 16 // Note: this loop is unrolled with -O1 and above.
20 // NOTE(szym): glibc dns-canon.c and SpdyFrameBuilder use 17 // NOTE(szym): glibc dns-canon.c and SpdyFrameBuilder use
21 // ntohs(*(uint16_t*)ptr) which is potentially unaligned. 18 // ntohs(*(uint16_t*)ptr) which is potentially unaligned.
22 // This would cause SIGBUS on ARMv5 or earlier and ARMv6-M. 19 // This would cause SIGBUS on ARMv5 or earlier and ARMv6-M.
23 template<typename T> 20 template<typename T>
24 inline void ReadBigEndian(const char buf[], T* out) { 21 inline void ReadBigEndian(const char buf[], T* out) {
25 *out = buf[0]; 22 *out = buf[0];
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 bool Write(T v); 95 bool Write(T v);
99 96
100 char* ptr_; 97 char* ptr_;
101 char* end_; 98 char* end_;
102 }; 99 };
103 100
104 } // namespace net 101 } // namespace net
105 102
106 #endif // NET_BASE_BIG_ENDIAN_H_ 103 #endif // NET_BASE_BIG_ENDIAN_H_
107 104
OLDNEW
« no previous file with comments | « no previous file | net/dns/dns_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698