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

Side by Side Diff: remoting/protocol/channel_dispatcher_base.cc

Issue 1582583003: Fix BufferedSocketWriter to buffer everything before it starts writing. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 months 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "remoting/protocol/channel_dispatcher_base.h" 5 #include "remoting/protocol/channel_dispatcher_base.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "remoting/protocol/p2p_stream_socket.h" 10 #include "remoting/protocol/p2p_stream_socket.h"
(...skipping 24 matching lines...) Expand all
35 35
36 void ChannelDispatcherBase::OnChannelReady( 36 void ChannelDispatcherBase::OnChannelReady(
37 scoped_ptr<P2PStreamSocket> socket) { 37 scoped_ptr<P2PStreamSocket> socket) {
38 if (!socket.get()) { 38 if (!socket.get()) {
39 event_handler_->OnChannelError(this, CHANNEL_CONNECTION_ERROR); 39 event_handler_->OnChannelError(this, CHANNEL_CONNECTION_ERROR);
40 return; 40 return;
41 } 41 }
42 42
43 channel_factory_ = nullptr; 43 channel_factory_ = nullptr;
44 channel_ = std::move(socket); 44 channel_ = std::move(socket);
45 writer_.Init( 45 writer_.Start(
46 base::Bind(&P2PStreamSocket::Write, base::Unretained(channel_.get())), 46 base::Bind(&P2PStreamSocket::Write, base::Unretained(channel_.get())),
47 base::Bind(&ChannelDispatcherBase::OnReadWriteFailed, 47 base::Bind(&ChannelDispatcherBase::OnReadWriteFailed,
48 base::Unretained(this))); 48 base::Unretained(this)));
49 reader_.StartReading(channel_.get(), 49 reader_.StartReading(channel_.get(),
50 base::Bind(&ChannelDispatcherBase::OnReadWriteFailed, 50 base::Bind(&ChannelDispatcherBase::OnReadWriteFailed,
51 base::Unretained(this))); 51 base::Unretained(this)));
52 52
53 event_handler_->OnChannelInitialized(this); 53 event_handler_->OnChannelInitialized(this);
54 } 54 }
55 55
56 void ChannelDispatcherBase::OnReadWriteFailed(int error) { 56 void ChannelDispatcherBase::OnReadWriteFailed(int error) {
57 event_handler_->OnChannelError(this, CHANNEL_CONNECTION_ERROR); 57 event_handler_->OnChannelError(this, CHANNEL_CONNECTION_ERROR);
58 } 58 }
59 59
60 } // namespace protocol 60 } // namespace protocol
61 } // namespace remoting 61 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/base/buffered_socket_writer_unittest.cc ('k') | remoting/protocol/channel_multiplexer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698