| 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 #ifndef NET_TOOLS_QUIC_QUIC_HTTP_RESPONSE_CACHE_H_ | 5 #ifndef NET_TOOLS_QUIC_QUIC_HTTP_RESPONSE_CACHE_H_ |
| 6 #define NET_TOOLS_QUIC_QUIC_HTTP_RESPONSE_CACHE_H_ | 6 #define NET_TOOLS_QUIC_QUIC_HTTP_RESPONSE_CACHE_H_ |
| 7 | 7 |
| 8 #include <list> | 8 #include <list> |
| 9 #include <map> | 9 #include <map> |
| 10 #include <memory> | 10 #include <memory> |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 const SpdyHeaderBlock& trailers() const { return trailers_; } | 58 const SpdyHeaderBlock& trailers() const { return trailers_; } |
| 59 const QuicStringPiece body() const { return QuicStringPiece(body_); } | 59 const QuicStringPiece body() const { return QuicStringPiece(body_); } |
| 60 | 60 |
| 61 void set_response_type(SpecialResponseType response_type) { | 61 void set_response_type(SpecialResponseType response_type) { |
| 62 response_type_ = response_type; | 62 response_type_ = response_type; |
| 63 } | 63 } |
| 64 void set_headers(SpdyHeaderBlock headers) { headers_ = std::move(headers); } | 64 void set_headers(SpdyHeaderBlock headers) { headers_ = std::move(headers); } |
| 65 void set_trailers(SpdyHeaderBlock trailers) { | 65 void set_trailers(SpdyHeaderBlock trailers) { |
| 66 trailers_ = std::move(trailers); | 66 trailers_ = std::move(trailers); |
| 67 } | 67 } |
| 68 void set_body(QuicStringPiece body) { body.CopyToString(&body_); } | 68 void set_body(QuicStringPiece body) { |
| 69 body_.assign(body.data(), body.size()); |
| 70 } |
| 69 | 71 |
| 70 private: | 72 private: |
| 71 SpecialResponseType response_type_; | 73 SpecialResponseType response_type_; |
| 72 SpdyHeaderBlock headers_; | 74 SpdyHeaderBlock headers_; |
| 73 SpdyHeaderBlock trailers_; | 75 SpdyHeaderBlock trailers_; |
| 74 std::string body_; | 76 std::string body_; |
| 75 | 77 |
| 76 DISALLOW_COPY_AND_ASSIGN(Response); | 78 DISALLOW_COPY_AND_ASSIGN(Response); |
| 77 }; | 79 }; |
| 78 | 80 |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 214 // Protects against concurrent access from test threads setting responses, and | 216 // Protects against concurrent access from test threads setting responses, and |
| 215 // server threads accessing those responses. | 217 // server threads accessing those responses. |
| 216 mutable QuicMutex response_mutex_; | 218 mutable QuicMutex response_mutex_; |
| 217 | 219 |
| 218 DISALLOW_COPY_AND_ASSIGN(QuicHttpResponseCache); | 220 DISALLOW_COPY_AND_ASSIGN(QuicHttpResponseCache); |
| 219 }; | 221 }; |
| 220 | 222 |
| 221 } // namespace net | 223 } // namespace net |
| 222 | 224 |
| 223 #endif // NET_TOOLS_QUIC_QUIC_HTTP_RESPONSE_CACHE_H_ | 225 #endif // NET_TOOLS_QUIC_QUIC_HTTP_RESPONSE_CACHE_H_ |
| OLD | NEW |