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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 return write_buffer_.size() + ack_buffer_.size(); | 52 return write_buffer_.size() + ack_buffer_.size(); |
53 } | 53 } |
54 | 54 |
55 int BlimpMessageOutputBuffer::GetUnacknowledgedMessageCountForTest() const { | 55 int BlimpMessageOutputBuffer::GetUnacknowledgedMessageCountForTest() const { |
56 return ack_buffer_.size(); | 56 return ack_buffer_.size(); |
57 } | 57 } |
58 | 58 |
59 void BlimpMessageOutputBuffer::ProcessMessage( | 59 void BlimpMessageOutputBuffer::ProcessMessage( |
60 scoped_ptr<BlimpMessage> message, | 60 scoped_ptr<BlimpMessage> message, |
61 const net::CompletionCallback& callback) { | 61 const net::CompletionCallback& callback) { |
62 DVLOG(2) << "OutputBuffer::ProcessMessage " << message; | 62 DVLOG(2) << "OutputBuffer::ProcessMessage " << message.get(); |
63 | 63 |
64 message->set_message_id(++prev_message_id_); | 64 message->set_message_id(++prev_message_id_); |
65 | 65 |
66 current_buffer_size_bytes_ += message->ByteSize(); | 66 current_buffer_size_bytes_ += message->ByteSize(); |
67 DCHECK_GE(max_buffer_size_bytes_, current_buffer_size_bytes_); | 67 DCHECK_GE(max_buffer_size_bytes_, current_buffer_size_bytes_); |
68 | 68 |
69 write_buffer_.push_back( | 69 write_buffer_.push_back( |
70 make_scoped_ptr(new BufferEntry(std::move(message), callback))); | 70 make_scoped_ptr(new BufferEntry(std::move(message), callback))); |
71 | 71 |
72 // Write the message | 72 // Write the message |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
147 write_buffer_.pop_front(); | 147 write_buffer_.pop_front(); |
148 WriteNextMessageIfReady(); | 148 WriteNextMessageIfReady(); |
149 } else { | 149 } else { |
150 // An error occurred while writing to the network connection. | 150 // An error occurred while writing to the network connection. |
151 // Stop writing more messages until a new connection is established. | 151 // Stop writing more messages until a new connection is established. |
152 DLOG(WARNING) << "Write error (result=" << result << ")"; | 152 DLOG(WARNING) << "Write error (result=" << result << ")"; |
153 } | 153 } |
154 } | 154 } |
155 | 155 |
156 } // namespace blimp | 156 } // namespace blimp |
OLD | NEW |