OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_QUIC_QUIC_IN_MEMORY_CACHE_H_ | 5 #ifndef NET_QUIC_QUIC_IN_MEMORY_CACHE_H_ |
6 #define NET_QUIC_QUIC_IN_MEMORY_CACHE_H_ | 6 #define NET_QUIC_QUIC_IN_MEMORY_CACHE_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/containers/hash_tables.h" | 10 #include "base/containers/hash_tables.h" |
(...skipping 26 matching lines...) Expand all Loading... |
37 IGNORE_REQUEST, // Do nothing, expect the client to time out. | 37 IGNORE_REQUEST, // Do nothing, expect the client to time out. |
38 }; | 38 }; |
39 | 39 |
40 // Container for response header/body pairs. | 40 // Container for response header/body pairs. |
41 class Response { | 41 class Response { |
42 public: | 42 public: |
43 Response(); | 43 Response(); |
44 ~Response(); | 44 ~Response(); |
45 | 45 |
46 SpecialResponseType response_type() const { return response_type_; } | 46 SpecialResponseType response_type() const { return response_type_; } |
47 const HttpResponseHeaders& headers() const { return *headers_; } | 47 const HttpResponseHeaders& headers() const { return *headers_.get(); } |
48 const base::StringPiece body() const { return base::StringPiece(body_); } | 48 const base::StringPiece body() const { return base::StringPiece(body_); } |
49 | 49 |
50 private: | 50 private: |
51 friend class QuicInMemoryCache; | 51 friend class QuicInMemoryCache; |
52 | 52 |
53 void set_headers(scoped_refptr<HttpResponseHeaders> headers) { | 53 void set_headers(scoped_refptr<HttpResponseHeaders> headers) { |
54 headers_ = headers; | 54 headers_ = headers; |
55 } | 55 } |
56 void set_body(base::StringPiece body) { | 56 void set_body(base::StringPiece body) { |
57 body.CopyToString(&body_); | 57 body.CopyToString(&body_); |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 | 105 |
106 // Cached responses. | 106 // Cached responses. |
107 ResponseMap responses_; | 107 ResponseMap responses_; |
108 | 108 |
109 DISALLOW_COPY_AND_ASSIGN(QuicInMemoryCache); | 109 DISALLOW_COPY_AND_ASSIGN(QuicInMemoryCache); |
110 }; | 110 }; |
111 | 111 |
112 } // namespace net | 112 } // namespace net |
113 | 113 |
114 #endif // NET_QUIC_QUIC_IN_MEMORY_CACHE_H_ | 114 #endif // NET_QUIC_QUIC_IN_MEMORY_CACHE_H_ |
OLD | NEW |