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

Unified Diff: remoting/protocol/host_control_dispatcher.cc

Issue 841773005: Cleanup channel dispatchers (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « remoting/protocol/host_control_dispatcher.h ('k') | remoting/protocol/host_event_dispatcher.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/protocol/host_control_dispatcher.cc
diff --git a/remoting/protocol/host_control_dispatcher.cc b/remoting/protocol/host_control_dispatcher.cc
index 0c19d176bd3fe38a0e46e94980fd2773666238ea..e323d095f45571cf5afb00b0c2b81d019da9a701 100644
--- a/remoting/protocol/host_control_dispatcher.cc
+++ b/remoting/protocol/host_control_dispatcher.cc
@@ -20,51 +20,47 @@ namespace protocol {
HostControlDispatcher::HostControlDispatcher()
: ChannelDispatcherBase(kControlChannelName),
clipboard_stub_(nullptr),
- host_stub_(nullptr) {
+ host_stub_(nullptr),
+ parser_(base::Bind(&HostControlDispatcher::OnMessageReceived,
+ base::Unretained(this)),
+ reader()) {
}
HostControlDispatcher::~HostControlDispatcher() {
- writer_.Close();
-}
-
-void HostControlDispatcher::OnInitialized() {
- reader_.Init(channel(), base::Bind(
- &HostControlDispatcher::OnMessageReceived, base::Unretained(this)));
- writer_.Init(channel(), BufferedSocketWriter::WriteFailedCallback());
}
void HostControlDispatcher::SetCapabilities(
const Capabilities& capabilities) {
ControlMessage message;
message.mutable_capabilities()->CopyFrom(capabilities);
- writer_.Write(SerializeAndFrameMessage(message), base::Closure());
+ writer()->Write(SerializeAndFrameMessage(message), base::Closure());
}
void HostControlDispatcher::SetPairingResponse(
const PairingResponse& pairing_response) {
ControlMessage message;
message.mutable_pairing_response()->CopyFrom(pairing_response);
- writer_.Write(SerializeAndFrameMessage(message), base::Closure());
+ writer()->Write(SerializeAndFrameMessage(message), base::Closure());
}
void HostControlDispatcher::DeliverHostMessage(
const ExtensionMessage& message) {
ControlMessage control_message;
control_message.mutable_extension_message()->CopyFrom(message);
- writer_.Write(SerializeAndFrameMessage(control_message), base::Closure());
+ writer()->Write(SerializeAndFrameMessage(control_message), base::Closure());
}
void HostControlDispatcher::InjectClipboardEvent(const ClipboardEvent& event) {
ControlMessage message;
message.mutable_clipboard_event()->CopyFrom(event);
- writer_.Write(SerializeAndFrameMessage(message), base::Closure());
+ writer()->Write(SerializeAndFrameMessage(message), base::Closure());
}
void HostControlDispatcher::SetCursorShape(
const CursorShapeInfo& cursor_shape) {
ControlMessage message;
message.mutable_cursor_shape()->CopyFrom(cursor_shape);
- writer_.Write(SerializeAndFrameMessage(message), base::Closure());
+ writer()->Write(SerializeAndFrameMessage(message), base::Closure());
}
void HostControlDispatcher::OnMessageReceived(
« no previous file with comments | « remoting/protocol/host_control_dispatcher.h ('k') | remoting/protocol/host_event_dispatcher.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698