Chromium Code Reviews| 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 840 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 851 owns_buffer_ = false; | 851 owns_buffer_ = false; |
| 852 } else { | 852 } else { |
| 853 // Otherwise, we need to make a copy to give to the caller. | 853 // Otherwise, we need to make a copy to give to the caller. |
| 854 buffer = new char[size_]; | 854 buffer = new char[size_]; |
| 855 memcpy(buffer, frame_, size_); | 855 memcpy(buffer, frame_, size_); |
| 856 } | 856 } |
| 857 *this = SpdySerializedFrame(); | 857 *this = SpdySerializedFrame(); |
| 858 return buffer; | 858 return buffer; |
| 859 } | 859 } |
| 860 | 860 |
| 861 // Returns the estimate of dynamically allocated memory in bytes. | |
| 862 size_t EstimateMemoryUsage() const { | |
| 863 if (owns_buffer_) | |
|
Bence
2017/02/08 14:46:45
Optional: if you think it is easier to read, maybe
xunjieli
2017/02/08 15:42:50
Done.
| |
| 864 return size_; | |
| 865 return 0; | |
| 866 } | |
| 867 | |
| 861 protected: | 868 protected: |
| 862 char* frame_; | 869 char* frame_; |
| 863 | 870 |
| 864 private: | 871 private: |
| 865 size_t size_; | 872 size_t size_; |
| 866 bool owns_buffer_; | 873 bool owns_buffer_; |
| 867 DISALLOW_COPY_AND_ASSIGN(SpdySerializedFrame); | 874 DISALLOW_COPY_AND_ASSIGN(SpdySerializedFrame); |
| 868 }; | 875 }; |
| 869 | 876 |
| 870 // 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... | |
| 890 SpdyFrameVisitor() {} | 897 SpdyFrameVisitor() {} |
| 891 virtual ~SpdyFrameVisitor() {} | 898 virtual ~SpdyFrameVisitor() {} |
| 892 | 899 |
| 893 private: | 900 private: |
| 894 DISALLOW_COPY_AND_ASSIGN(SpdyFrameVisitor); | 901 DISALLOW_COPY_AND_ASSIGN(SpdyFrameVisitor); |
| 895 }; | 902 }; |
| 896 | 903 |
| 897 } // namespace net | 904 } // namespace net |
| 898 | 905 |
| 899 #endif // NET_SPDY_SPDY_PROTOCOL_H_ | 906 #endif // NET_SPDY_SPDY_PROTOCOL_H_ |
| OLD | NEW |