| 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_ |
| (...skipping 844 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 855 owns_buffer_ = false; | 855 owns_buffer_ = false; |
| 856 } else { | 856 } else { |
| 857 // Otherwise, we need to make a copy to give to the caller. | 857 // Otherwise, we need to make a copy to give to the caller. |
| 858 buffer = new char[size_]; | 858 buffer = new char[size_]; |
| 859 memcpy(buffer, frame_, size_); | 859 memcpy(buffer, frame_, size_); |
| 860 } | 860 } |
| 861 *this = SpdySerializedFrame(); | 861 *this = SpdySerializedFrame(); |
| 862 return buffer; | 862 return buffer; |
| 863 } | 863 } |
| 864 | 864 |
| 865 // Returns the estimate of dynamically allocated memory in bytes. |
| 866 size_t EstimateMemoryUsage() const { return owns_buffer_ ? size_ : 0; } |
| 867 |
| 865 protected: | 868 protected: |
| 866 char* frame_; | 869 char* frame_; |
| 867 | 870 |
| 868 private: | 871 private: |
| 869 size_t size_; | 872 size_t size_; |
| 870 bool owns_buffer_; | 873 bool owns_buffer_; |
| 871 DISALLOW_COPY_AND_ASSIGN(SpdySerializedFrame); | 874 DISALLOW_COPY_AND_ASSIGN(SpdySerializedFrame); |
| 872 }; | 875 }; |
| 873 | 876 |
| 874 // This interface is for classes that want to process SpdyFrameIRs without | 877 // This interface is for classes that want to process SpdyFrameIRs without |
| (...skipping 19 matching lines...) Expand all Loading... |
| 894 SpdyFrameVisitor() {} | 897 SpdyFrameVisitor() {} |
| 895 virtual ~SpdyFrameVisitor() {} | 898 virtual ~SpdyFrameVisitor() {} |
| 896 | 899 |
| 897 private: | 900 private: |
| 898 DISALLOW_COPY_AND_ASSIGN(SpdyFrameVisitor); | 901 DISALLOW_COPY_AND_ASSIGN(SpdyFrameVisitor); |
| 899 }; | 902 }; |
| 900 | 903 |
| 901 } // namespace net | 904 } // namespace net |
| 902 | 905 |
| 903 #endif // NET_SPDY_SPDY_PROTOCOL_H_ | 906 #endif // NET_SPDY_SPDY_PROTOCOL_H_ |
| OLD | NEW |