Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "blimp/net/blimp_message_output_buffer.h" | 5 #include "blimp/net/blimp_message_output_buffer.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/macros.h" | 9 #include "base/macros.h" |
| 10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 58 } | 58 } |
| 59 | 59 |
| 60 void BlimpMessageOutputBuffer::ProcessMessage( | 60 void BlimpMessageOutputBuffer::ProcessMessage( |
| 61 scoped_ptr<BlimpMessage> message, | 61 scoped_ptr<BlimpMessage> message, |
| 62 const net::CompletionCallback& callback) { | 62 const net::CompletionCallback& callback) { |
| 63 DVLOG(2) << "OutputBuffer::ProcessMessage " << *message; | 63 DVLOG(2) << "OutputBuffer::ProcessMessage " << *message; |
| 64 | 64 |
| 65 message->set_message_id(++prev_message_id_); | 65 message->set_message_id(++prev_message_id_); |
| 66 | 66 |
| 67 current_buffer_size_bytes_ += message->ByteSize(); | 67 current_buffer_size_bytes_ += message->ByteSize(); |
| 68 DCHECK_GE(max_buffer_size_bytes_, current_buffer_size_bytes_); | 68 if (max_buffer_size_bytes_ < current_buffer_size_bytes_) |
| 69 DLOG(WARNING) << "Buffer size Limit Exceeded. Maximum Bytes Limit: " | |
|
Kevin M
2016/03/23 18:37:34
Nit: this isn't really a limit anymore, it's more
Khushal
2016/03/23 19:06:49
Done.
| |
| 70 << max_buffer_size_bytes_ | |
| 71 << "Buffered Bytes Size: " << current_buffer_size_bytes_; | |
| 69 | 72 |
| 70 write_buffer_.push_back( | 73 write_buffer_.push_back( |
| 71 make_scoped_ptr(new BufferEntry(std::move(message), callback))); | 74 make_scoped_ptr(new BufferEntry(std::move(message), callback))); |
| 72 | 75 |
| 73 // Write the message | 76 // Write the message |
| 74 if (write_buffer_.size() == 1 && output_processor_) { | 77 if (write_buffer_.size() == 1 && output_processor_) { |
| 75 WriteNextMessageIfReady(); | 78 WriteNextMessageIfReady(); |
| 76 } | 79 } |
| 77 } | 80 } |
| 78 | 81 |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 148 write_buffer_.pop_front(); | 151 write_buffer_.pop_front(); |
| 149 WriteNextMessageIfReady(); | 152 WriteNextMessageIfReady(); |
| 150 } else { | 153 } else { |
| 151 // An error occurred while writing to the network connection. | 154 // An error occurred while writing to the network connection. |
| 152 // Stop writing more messages until a new connection is established. | 155 // Stop writing more messages until a new connection is established. |
| 153 DLOG(WARNING) << "Write error (result=" << result << ")"; | 156 DLOG(WARNING) << "Write error (result=" << result << ")"; |
| 154 } | 157 } |
| 155 } | 158 } |
| 156 | 159 |
| 157 } // namespace blimp | 160 } // namespace blimp |
| OLD | NEW |