OLD | NEW |
---|---|
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 // This stub is thread safe because of the use of BufferedSocketWriter. | 5 // This stub is thread safe because of the use of BufferedSocketWriter. |
6 // BufferedSocketWriter buffers messages and send them on them right thread. | 6 // BufferedSocketWriter buffers messages and send them on them right thread. |
7 | 7 |
8 #include "remoting/protocol/client_control_sender.h" | 8 #include "remoting/protocol/client_control_sender.h" |
9 | 9 |
10 #include "base/task.h" | 10 #include "base/task.h" |
11 #include "remoting/protocol/buffered_socket_writer.h" | 11 #include "remoting/protocol/buffered_socket_writer.h" |
12 #include "remoting/proto/control.pb.h" | 12 #include "remoting/proto/control.pb.h" |
13 #include "remoting/proto/internal.pb.h" | |
Alpha Left Google
2010/12/02 19:41:59
why is this needed?
Sergey Ulanov
2010/12/02 20:06:40
Because I moved ControlMessage to internal.proto.
| |
13 #include "remoting/protocol/util.h" | 14 #include "remoting/protocol/util.h" |
14 | 15 |
15 namespace remoting { | 16 namespace remoting { |
16 namespace protocol { | 17 namespace protocol { |
17 | 18 |
18 ClientControlSender::ClientControlSender(net::Socket* socket) | 19 ClientControlSender::ClientControlSender(net::Socket* socket) |
19 : buffered_writer_(new BufferedSocketWriter()) { | 20 : buffered_writer_(new BufferedSocketWriter()) { |
20 buffered_writer_->Init(socket, NULL); | 21 buffered_writer_->Init(socket, NULL); |
21 } | 22 } |
22 | 23 |
23 ClientControlSender::~ClientControlSender() { | 24 ClientControlSender::~ClientControlSender() { |
24 } | 25 } |
25 | 26 |
26 void ClientControlSender::NotifyResolution( | 27 void ClientControlSender::NotifyResolution( |
27 const NotifyResolutionRequest* msg, Task* done) { | 28 const NotifyResolutionRequest* msg, Task* done) { |
28 ControlMessage message; | 29 protocol::ControlMessage message; |
29 message.mutable_notify_resolution()->CopyFrom(*msg); | 30 message.mutable_notify_resolution()->CopyFrom(*msg); |
30 buffered_writer_->Write(SerializeAndFrameMessage(message)); | 31 buffered_writer_->Write(SerializeAndFrameMessage(message)); |
31 done->Run(); | 32 done->Run(); |
32 delete done; | 33 delete done; |
33 } | 34 } |
34 | 35 |
35 } // namespace protocol | 36 } // namespace protocol |
36 } // namespace remoting | 37 } // namespace remoting |
OLD | NEW |