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

Unified Diff: net/quic/quic_data_writer.h

Issue 11230005: Move non-trivial methods from QuicDataWriter to the .cc file (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix WriteUInt128 Created 8 years, 2 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | net/quic/quic_data_writer.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/quic/quic_data_writer.h
diff --git a/net/quic/quic_data_writer.h b/net/quic/quic_data_writer.h
index 8178ad7997204537c233dc51c3eb5a51d8b71ba2..25a215a4e3ff28bfa9687ffbeb40af85a1027608 100644
--- a/net/quic/quic_data_writer.h
+++ b/net/quic/quic_data_writer.h
@@ -26,56 +26,25 @@ namespace net {
class NET_EXPORT_PRIVATE QuicDataWriter {
public:
explicit QuicDataWriter(size_t length);
+
~QuicDataWriter();
// Returns the size of the QuicDataWriter's data.
size_t length() const { return length_; }
// Takes the buffer from the QuicDataWriter.
- // TODO(rch): move non-trivial methods into .cc file.
- char* take() {
- char* rv = buffer_;
- buffer_ = NULL;
- capacity_ = 0;
- length_ = 0;
- return rv;
- }
+ char* take();
// Methods for adding to the payload. These values are appended to the end
// of the QuicDataWriter payload. Note - binary integers are written in
// host byte order (little endian) not network byte order (big endian).
- bool WriteUInt8(uint8 value) {
- return WriteBytes(&value, sizeof(value));
- }
- bool WriteUInt16(uint16 value) {
- return WriteBytes(&value, sizeof(value));
- }
- bool WriteUInt32(uint32 value) {
- return WriteBytes(&value, sizeof(value));
- }
- bool WriteUInt48(uint64 value) {
- uint32 hi = value >> 32;
- uint32 lo = value & GG_UINT64_C(0x00000000FFFFFFFF);
- return WriteUInt32(lo) && WriteUInt16(hi);
- }
- bool WriteUInt64(uint64 value) {
- return WriteBytes(&value, sizeof(value));
- }
- bool WriteUInt128(uint128 value) {
- return WriteUInt64(value.lo) && WriteUInt64(value.hi);
- }
- bool WriteStringPiece16(base::StringPiece val) {
- if (val.length() > std::numeric_limits<uint16>::max()) {
- return false;
- }
- if (!WriteUInt16(val.size())) {
- return false;
- }
- return WriteBytes(val.data(), val.size());
- }
-
- bool AdvancePointer(uint32 len);
-
+ bool WriteUInt8(uint8 value);
+ bool WriteUInt16(uint16 value);
+ bool WriteUInt32(uint32 value);
+ bool WriteUInt48(uint64 value);
+ bool WriteUInt64(uint64 value);
+ bool WriteUInt128(uint128 value);
+ bool WriteStringPiece16(base::StringPiece val);
bool WriteBytes(const void* data, uint32 data_len);
static void WriteUint64ToBuffer(uint64 value, char* buffer);
« no previous file with comments | « no previous file | net/quic/quic_data_writer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698