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_IN_MEMORY_CACHE_H_ | 5 #ifndef NET_TOOLS_QUIC_QUIC_IN_MEMORY_CACHE_H_ |
6 #define NET_TOOLS_QUIC_QUIC_IN_MEMORY_CACHE_H_ | 6 #define NET_TOOLS_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 CLOSE_CONNECTION, // Close the connection (sending the close packet). | 37 CLOSE_CONNECTION, // Close the connection (sending the close packet). |
38 IGNORE_REQUEST, // Do nothing, expect the client to time out. | 38 IGNORE_REQUEST, // Do nothing, expect the client to time out. |
39 }; | 39 }; |
40 | 40 |
41 // Container for response header/body pairs. | 41 // Container for response header/body pairs. |
42 class Response { | 42 class Response { |
43 public: | 43 public: |
44 Response() : response_type_(REGULAR_RESPONSE) {} | 44 Response() : response_type_(REGULAR_RESPONSE) {} |
45 ~Response() {} | 45 ~Response() {} |
46 | 46 |
47 const SpecialResponseType response_type() const { return response_type_; } | 47 SpecialResponseType response_type() const { return response_type_; } |
48 const BalsaHeaders& headers() const { return headers_; } | 48 const BalsaHeaders& headers() const { return headers_; } |
49 const base::StringPiece body() const { return base::StringPiece(body_); } | 49 const base::StringPiece body() const { return base::StringPiece(body_); } |
50 | 50 |
51 private: | 51 private: |
52 friend class QuicInMemoryCache; | 52 friend class QuicInMemoryCache; |
53 | 53 |
54 void set_headers(const BalsaHeaders& headers) { | 54 void set_headers(const BalsaHeaders& headers) { |
55 headers_.CopyFrom(headers); | 55 headers_.CopyFrom(headers); |
56 } | 56 } |
57 void set_body(base::StringPiece body) { | 57 void set_body(base::StringPiece body) { |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 // Cached responses. | 110 // Cached responses. |
111 ResponseMap responses_; | 111 ResponseMap responses_; |
112 | 112 |
113 DISALLOW_COPY_AND_ASSIGN(QuicInMemoryCache); | 113 DISALLOW_COPY_AND_ASSIGN(QuicInMemoryCache); |
114 }; | 114 }; |
115 | 115 |
116 } // namespace tools | 116 } // namespace tools |
117 } // namespace net | 117 } // namespace net |
118 | 118 |
119 #endif // NET_TOOLS_QUIC_QUIC_IN_MEMORY_CACHE_H_ | 119 #endif // NET_TOOLS_QUIC_QUIC_IN_MEMORY_CACHE_H_ |
OLD | NEW |