| 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 // This file contains some protocol structures for use with SPDY 3 and HTTP 2 | 5 // This file contains some protocol structures for use with SPDY 3 and HTTP 2 |
| 6 // The SPDY 3 spec can be found at: | 6 // The SPDY 3 spec can be found at: |
| 7 // http://dev.chromium.org/spdy/spdy-protocol/spdy-protocol-draft3 | 7 // http://dev.chromium.org/spdy/spdy-protocol/spdy-protocol-draft3 |
| 8 | 8 |
| 9 #ifndef NET_SPDY_SPDY_PROTOCOL_H_ | 9 #ifndef NET_SPDY_SPDY_PROTOCOL_H_ |
| 10 #define NET_SPDY_SPDY_PROTOCOL_H_ | 10 #define NET_SPDY_SPDY_PROTOCOL_H_ |
| 11 | 11 |
| 12 #include <stddef.h> | 12 #include <stddef.h> |
| 13 #include <stdint.h> | 13 #include <stdint.h> |
| 14 | 14 |
| 15 #include <iosfwd> | 15 #include <iosfwd> |
| 16 #include <limits> | 16 #include <limits> |
| 17 #include <map> | 17 #include <map> |
| 18 #include <memory> | 18 #include <memory> |
| 19 #include <new> |
| 19 #include <utility> | 20 #include <utility> |
| 20 | 21 |
| 21 #include "base/compiler_specific.h" | 22 #include "base/compiler_specific.h" |
| 22 #include "base/logging.h" | 23 #include "base/logging.h" |
| 23 #include "base/macros.h" | 24 #include "base/macros.h" |
| 24 #include "base/sys_byteorder.h" | 25 #include "base/sys_byteorder.h" |
| 25 #include "net/base/net_export.h" | 26 #include "net/base/net_export.h" |
| 26 #include "net/spdy/core/spdy_alt_svc_wire_format.h" | 27 #include "net/spdy/core/spdy_alt_svc_wire_format.h" |
| 27 #include "net/spdy/core/spdy_bitmasks.h" | 28 #include "net/spdy/core/spdy_bitmasks.h" |
| 28 #include "net/spdy/core/spdy_bug_tracker.h" | 29 #include "net/spdy/core/spdy_bug_tracker.h" |
| 29 #include "net/spdy/core/spdy_header_block.h" | 30 #include "net/spdy/core/spdy_header_block.h" |
| 31 #include "net/spdy/platform/api/spdy_ptr_util.h" |
| 30 #include "net/spdy/platform/api/spdy_string.h" | 32 #include "net/spdy/platform/api/spdy_string.h" |
| 31 #include "net/spdy/platform/api/spdy_string_piece.h" | 33 #include "net/spdy/platform/api/spdy_string_piece.h" |
| 32 | 34 |
| 33 namespace net { | 35 namespace net { |
| 34 | 36 |
| 35 // A stream id is a 31 bit entity. | 37 // A stream id is a 31 bit entity. |
| 36 typedef uint32_t SpdyStreamId; | 38 typedef uint32_t SpdyStreamId; |
| 37 | 39 |
| 38 // Specifies the stream ID used to denote the current session (for | 40 // Specifies the stream ID used to denote the current session (for |
| 39 // flow control). | 41 // flow control). |
| (...skipping 444 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 484 void set_padding_len(int padding_len) { | 486 void set_padding_len(int padding_len) { |
| 485 DCHECK_GT(padding_len, 0); | 487 DCHECK_GT(padding_len, 0); |
| 486 DCHECK_LE(padding_len, kPaddingSizePerFrame); | 488 DCHECK_LE(padding_len, kPaddingSizePerFrame); |
| 487 padded_ = true; | 489 padded_ = true; |
| 488 // The pad field takes one octet on the wire. | 490 // The pad field takes one octet on the wire. |
| 489 padding_payload_len_ = padding_len - 1; | 491 padding_payload_len_ = padding_len - 1; |
| 490 } | 492 } |
| 491 | 493 |
| 492 // Deep-copy of data (keep private copy). | 494 // Deep-copy of data (keep private copy). |
| 493 void SetDataDeep(SpdyStringPiece data) { | 495 void SetDataDeep(SpdyStringPiece data) { |
| 494 data_store_.reset(new SpdyString(data.data(), data.size())); | 496 data_store_ = SpdyMakeUnique<SpdyString>(data.data(), data.size()); |
| 495 data_ = data_store_->data(); | 497 data_ = data_store_->data(); |
| 496 data_len_ = data.size(); | 498 data_len_ = data.size(); |
| 497 } | 499 } |
| 498 | 500 |
| 499 // Shallow-copy of data (do not keep private copy). | 501 // Shallow-copy of data (do not keep private copy). |
| 500 void SetDataShallow(SpdyStringPiece data) { | 502 void SetDataShallow(SpdyStringPiece data) { |
| 501 data_store_.reset(); | 503 data_store_.reset(); |
| 502 data_ = data.data(); | 504 data_ = data.data(); |
| 503 data_len_ = data.size(); | 505 data_len_ = data.size(); |
| 504 } | 506 } |
| (...skipping 412 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 917 SpdyFrameVisitor() {} | 919 SpdyFrameVisitor() {} |
| 918 virtual ~SpdyFrameVisitor() {} | 920 virtual ~SpdyFrameVisitor() {} |
| 919 | 921 |
| 920 private: | 922 private: |
| 921 DISALLOW_COPY_AND_ASSIGN(SpdyFrameVisitor); | 923 DISALLOW_COPY_AND_ASSIGN(SpdyFrameVisitor); |
| 922 }; | 924 }; |
| 923 | 925 |
| 924 } // namespace net | 926 } // namespace net |
| 925 | 927 |
| 926 #endif // NET_SPDY_SPDY_PROTOCOL_H_ | 928 #endif // NET_SPDY_SPDY_PROTOCOL_H_ |
| OLD | NEW |