Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(26)

Side by Side Diff: net/tools/flip_server/balsa_headers.cc

Issue 10854063: Clean-up inline members of nested classes (net/) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: add a NET_EXPOR_PRIVATE Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « net/tools/flip_server/balsa_headers.h ('k') | net/tools/flip_server/output_ordering.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
73 std::ostream& BalsaHeaders::iterator_base::operator<<(std::ostream& os) const { 80 std::ostream& BalsaHeaders::iterator_base::operator<<(std::ostream& os) const {
74 os << "[" << this->headers_ << ", " << this->idx_ << "]"; 81 os << "[" << this->headers_ << ", " << this->idx_ << "]";
75 return os; 82 return os;
76 } 83 }
84
85 BalsaHeaders::iterator_base::iterator_base(const BalsaHeaders* headers,
86 HeaderLines::size_type index)
87 : headers_(headers),
88 idx_(index) {
89 }
77 90
78 BalsaBuffer::~BalsaBuffer() { 91 BalsaBuffer::~BalsaBuffer() {
79 CleanupBlocksStartingFrom(0); 92 CleanupBlocksStartingFrom(0);
80 } 93 }
81 94
82 // Returns the total amount of memory used by the buffer blocks. 95 // Returns the total amount of memory used by the buffer blocks.
83 size_t BalsaBuffer::GetTotalBufferBlockSize() const { 96 size_t BalsaBuffer::GetTotalBufferBlockSize() const {
84 size_t buffer_size = 0; 97 size_t buffer_size = 0;
85 for (Blocks::const_iterator iter = blocks_.begin(); 98 for (Blocks::const_iterator iter = blocks_.begin();
86 iter != blocks_.end(); 99 iter != blocks_.end();
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
218 return block; 231 return block;
219 } 232 }
220 233
221 void BalsaBuffer::CleanupBlocksStartingFrom(Blocks::size_type start_idx) { 234 void BalsaBuffer::CleanupBlocksStartingFrom(Blocks::size_type start_idx) {
222 for (Blocks::size_type i = start_idx; i < blocks_.size(); ++i) { 235 for (Blocks::size_type i = start_idx; i < blocks_.size(); ++i) {
223 delete[] blocks_[i].buffer; 236 delete[] blocks_[i].buffer;
224 } 237 }
225 blocks_.resize(start_idx); 238 blocks_.resize(start_idx);
226 } 239 }
227 240
241 BalsaHeaders::const_header_lines_key_iterator::const_header_lines_key_iterator(
242 const const_header_lines_key_iterator& other)
243 : iterator_base(other),
244 key_(other.key_) {
245 }
246
247 BalsaHeaders::const_header_lines_key_iterator::const_header_lines_key_iterator(
248 const BalsaHeaders* headers,
249 HeaderLines::size_type index,
250 const base::StringPiece& key)
251 : iterator_base(headers, index),
252 key_(key) {
253 }
254
255 BalsaHeaders::const_header_lines_key_iterator::const_header_lines_key_iterator(
256 const BalsaHeaders* headers,
257 HeaderLines::size_type index)
258 : iterator_base(headers, index) {
259 }
260
228 BalsaHeaders::BalsaHeaders() 261 BalsaHeaders::BalsaHeaders()
229 : balsa_buffer_(4096), 262 : balsa_buffer_(4096),
230 content_length_(0), 263 content_length_(0),
231 content_length_status_(BalsaHeadersEnums::NO_CONTENT_LENGTH), 264 content_length_status_(BalsaHeadersEnums::NO_CONTENT_LENGTH),
232 parsed_response_code_(0), 265 parsed_response_code_(0),
233 firstline_buffer_base_idx_(0), 266 firstline_buffer_base_idx_(0),
234 whitespace_1_idx_(0), 267 whitespace_1_idx_(0),
235 non_whitespace_1_idx_(0), 268 non_whitespace_1_idx_(0),
236 whitespace_2_idx_(0), 269 whitespace_2_idx_(0),
237 non_whitespace_2_idx_(0), 270 non_whitespace_2_idx_(0),
(...skipping 685 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
OLDNEW
« no previous file with comments | « net/tools/flip_server/balsa_headers.h ('k') | net/tools/flip_server/output_ordering.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698