OLD | NEW |
---|---|
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #include "net/tools/flip_server/balsa_headers.h" | 5 #include "net/tools/flip_server/balsa_headers.h" |
6 | 6 |
7 #include <stdio.h> | 7 #include <stdio.h> |
8 #include <algorithm> | 8 #include <algorithm> |
9 #include <ext/hash_set> | 9 #include <ext/hash_set> |
10 #include <string> | 10 #include <string> |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
63 REGISTER_MODULE_INITIALIZER(multivalued_headers, InitMultivaluedHeaders()); | 63 REGISTER_MODULE_INITIALIZER(multivalued_headers, InitMultivaluedHeaders()); |
64 | 64 |
65 const int kFastToBufferSize = 32; // I think 22 is adequate, but anyway.. | 65 const int kFastToBufferSize = 32; // I think 22 is adequate, but anyway.. |
66 | 66 |
67 } // namespace | 67 } // namespace |
68 | 68 |
69 namespace net { | 69 namespace net { |
70 | 70 |
71 const size_t BalsaBuffer::kDefaultBlocksize; | 71 const size_t BalsaBuffer::kDefaultBlocksize; |
72 | 72 |
73 BalsaHeaders::iterator_base::iterator_base() : headers_(NULL), idx_(0) { } | |
74 | |
75 BalsaHeaders::iterator_base::iterator_base(const iterator_base& it) | |
76 : headers_(it.headers_), | |
77 idx_(it.idx_) { | |
78 } | |
79 | |
80 BalsaHeaders::iterator_base::iterator_base(const BalsaHeaders* headers, | |
81 HeaderLines::size_type index) | |
82 : headers_(headers), | |
83 idx_(index) { | |
84 } | |
mmenke
2012/08/09 15:13:35
nit: This one should be declared after operator<<
hans
2012/08/09 15:35:42
Done.
| |
85 | |
73 std::ostream& BalsaHeaders::iterator_base::operator<<(std::ostream& os) const { | 86 std::ostream& BalsaHeaders::iterator_base::operator<<(std::ostream& os) const { |
74 os << "[" << this->headers_ << ", " << this->idx_ << "]"; | 87 os << "[" << this->headers_ << ", " << this->idx_ << "]"; |
75 return os; | 88 return os; |
76 } | 89 } |
90 | |
91 BalsaHeaders::const_header_lines_key_iterator::const_header_lines_key_iterator( | |
92 const const_header_lines_key_iterator& other) | |
93 : iterator_base(other), | |
94 key_(other.key_) { | |
95 } | |
96 | |
97 BalsaHeaders::const_header_lines_key_iterator::const_header_lines_key_iterator( | |
98 const BalsaHeaders* headers, | |
99 HeaderLines::size_type index, | |
100 const base::StringPiece& key) | |
101 : iterator_base(headers, index), | |
102 key_(key) { | |
103 } | |
104 | |
105 BalsaHeaders::const_header_lines_key_iterator::const_header_lines_key_iterator( | |
106 const BalsaHeaders* headers, | |
107 HeaderLines::size_type index) | |
108 : iterator_base(headers, index) { | |
109 } | |
mmenke
2012/08/09 15:13:35
These should be down near the BalsaHeaders constru
hans
2012/08/09 15:35:42
Done.
| |
77 | 110 |
78 BalsaBuffer::~BalsaBuffer() { | 111 BalsaBuffer::~BalsaBuffer() { |
79 CleanupBlocksStartingFrom(0); | 112 CleanupBlocksStartingFrom(0); |
80 } | 113 } |
81 | 114 |
82 // Returns the total amount of memory used by the buffer blocks. | 115 // Returns the total amount of memory used by the buffer blocks. |
83 size_t BalsaBuffer::GetTotalBufferBlockSize() const { | 116 size_t BalsaBuffer::GetTotalBufferBlockSize() const { |
84 size_t buffer_size = 0; | 117 size_t buffer_size = 0; |
85 for (Blocks::const_iterator iter = blocks_.begin(); | 118 for (Blocks::const_iterator iter = blocks_.begin(); |
86 iter != blocks_.end(); | 119 iter != blocks_.end(); |
(...skipping 836 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
923 | 956 |
924 void BalsaHeaders::SetResponseReasonPhrase(const base::StringPiece& reason) { | 957 void BalsaHeaders::SetResponseReasonPhrase(const base::StringPiece& reason) { |
925 // Note: There is no difference between request_version() and | 958 // Note: There is no difference between request_version() and |
926 // response_reason_phrase(). Thus, a function to set one is equivalent to a | 959 // response_reason_phrase(). Thus, a function to set one is equivalent to a |
927 // function to set the other. We maintain two functions for this as it is | 960 // function to set the other. We maintain two functions for this as it is |
928 // much more descriptive, and makes code more understandable. | 961 // much more descriptive, and makes code more understandable. |
929 SetRequestVersion(reason); | 962 SetRequestVersion(reason); |
930 } | 963 } |
931 | 964 |
932 } // namespace net | 965 } // namespace net |
OLD | NEW |