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

Unified Diff: blimp/net/blimp_connection.cc

Issue 1452823011: Make PacketReader/PacketWriter interfaces async-only. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rehabbed tests, addressed feedback, made changes to BlimpMessagePump Created 5 years 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | blimp/net/blimp_connection_unittest.cc » ('j') | blimp/net/blimp_message_pump.h » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: blimp/net/blimp_connection.cc
diff --git a/blimp/net/blimp_connection.cc b/blimp/net/blimp_connection.cc
index a79ffe0a05dd2ffa0b25daea81145d6da83153da..c5b07001839af3b3e3071191c7b603b210c9456c 100644
--- a/blimp/net/blimp_connection.cc
+++ b/blimp/net/blimp_connection.cc
@@ -40,7 +40,6 @@ class BlimpMessageSender : public BlimpMessageProcessor {
PacketWriter* writer_;
ConnectionErrorObserver* error_observer_;
scoped_refptr<net::DrainableIOBuffer> buffer_;
- net::CancelableCompletionCallback write_packet_callback_;
net::CompletionCallback pending_process_msg_callback_;
DISALLOW_COPY_AND_ASSIGN(BlimpMessageSender);
@@ -72,19 +71,14 @@ void BlimpMessageSender::ProcessMessage(
return;
}
- write_packet_callback_.Reset(base::Bind(
- &BlimpMessageSender::OnWritePacketComplete, base::Unretained(this)));
pending_process_msg_callback_ = callback;
- int result = writer_->WritePacket(buffer_, write_packet_callback_.callback());
- if (result != net::ERR_IO_PENDING) {
- base::MessageLoop::current()->PostTask(
- FROM_HERE, base::Bind(write_packet_callback_.callback(), result));
- }
+ writer_->WritePacket(buffer_,
+ base::Bind(&BlimpMessageSender::OnWritePacketComplete,
+ base::Unretained(this)));
}
void BlimpMessageSender::OnWritePacketComplete(int result) {
DCHECK_NE(net::ERR_IO_PENDING, result);
- write_packet_callback_.Cancel();
base::ResetAndReturn(&pending_process_msg_callback_).Run(result);
if (result != net::OK) {
error_observer_->OnConnectionError(result);
« no previous file with comments | « no previous file | blimp/net/blimp_connection_unittest.cc » ('j') | blimp/net/blimp_message_pump.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698