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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 make_scoped_ptr(new BufferEntry(std::move(message), callback))); | 69 make_scoped_ptr(new BufferEntry(std::move(message), callback))); |
70 | 70 |
71 // Write the message | 71 // Write the message |
72 if (write_buffer_.size() == 1 && output_processor_) { | 72 if (write_buffer_.size() == 1 && output_processor_) { |
73 WriteNextMessageIfReady(); | 73 WriteNextMessageIfReady(); |
74 } | 74 } |
75 } | 75 } |
76 | 76 |
77 // Flushes acknowledged messages from the buffer and invokes their | 77 // Flushes acknowledged messages from the buffer and invokes their |
78 // |callbacks|, if any. | 78 // |callbacks|, if any. |
79 void BlimpMessageOutputBuffer::OnMessageCheckpoint(int64 message_id) { | 79 void BlimpMessageOutputBuffer::OnMessageCheckpoint(int64_t message_id) { |
80 VLOG(2) << "OnMessageCheckpoint (message_id=" << message_id << ")"; | 80 VLOG(2) << "OnMessageCheckpoint (message_id=" << message_id << ")"; |
81 if (ack_buffer_.empty()) { | 81 if (ack_buffer_.empty()) { |
82 LOG(WARNING) << "Checkpoint called while buffer is empty."; | 82 LOG(WARNING) << "Checkpoint called while buffer is empty."; |
83 return; | 83 return; |
84 } | 84 } |
85 if (message_id > prev_message_id_) { | 85 if (message_id > prev_message_id_) { |
86 LOG(WARNING) << "Illegal checkpoint response: " << message_id; | 86 LOG(WARNING) << "Illegal checkpoint response: " << message_id; |
87 return; | 87 return; |
88 } | 88 } |
89 | 89 |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
145 write_buffer_.pop_front(); | 145 write_buffer_.pop_front(); |
146 WriteNextMessageIfReady(); | 146 WriteNextMessageIfReady(); |
147 } else { | 147 } else { |
148 // An error occurred while writing to the network connection. | 148 // An error occurred while writing to the network connection. |
149 // Stop writing more messages until a new connection is established. | 149 // Stop writing more messages until a new connection is established. |
150 DLOG(WARNING) << "Write error (result=" << result << ")"; | 150 DLOG(WARNING) << "Write error (result=" << result << ")"; |
151 } | 151 } |
152 } | 152 } |
153 | 153 |
154 } // namespace blimp | 154 } // namespace blimp |
OLD | NEW |