OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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/simple_buffer.h" | 5 #include "net/tools/balsa/simple_buffer.h" |
6 #include "base/logging.h" | 6 #include "base/logging.h" |
7 | 7 |
8 // Some of the following member functions are marked inlined, even though they | 8 // Some of the following member functions are marked inlined, even though they |
9 // are virtual. This may seem counter-intuitive, since virtual functions are | 9 // are virtual. This may seem counter-intuitive, since virtual functions are |
10 // generally not eligible for inlining. Profiling results indicate that these | 10 // generally not eligible for inlining. Profiling results indicate that these |
11 // large amount of runtime is spent on virtual function dispatch on these | 11 // large amount of runtime is spent on virtual function dispatch on these |
12 // simple functions. They are virtual because of the interface this class | 12 // simple functions. They are virtual because of the interface this class |
13 // inherits from. However, it is very unlikely that anyone will sub-class | 13 // inherits from. However, it is very unlikely that anyone will sub-class |
14 // SimpleBuffer and change their implementation. To get rid of this baggage, | 14 // SimpleBuffer and change their implementation. To get rid of this baggage, |
15 // internal implementation (e.g., Write) explicitly use SimpleBuffer:: to | 15 // internal implementation (e.g., Write) explicitly use SimpleBuffer:: to |
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
199 // amount of data specified here is expected to | 199 // amount of data specified here is expected to |
200 // already be resident (as if it was Written) | 200 // already be resident (as if it was Written) |
201 inline void SimpleBuffer::AdvanceWritablePtr(int amount_to_advance) { | 201 inline void SimpleBuffer::AdvanceWritablePtr(int amount_to_advance) { |
202 write_idx_ += amount_to_advance; | 202 write_idx_ += amount_to_advance; |
203 if (write_idx_ > storage_size_) { | 203 if (write_idx_ > storage_size_) { |
204 write_idx_ = storage_size_; | 204 write_idx_ = storage_size_; |
205 } | 205 } |
206 } | 206 } |
207 | 207 |
208 } // namespace net | 208 } // namespace net |
OLD | NEW |