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

Side by Side Diff: remoting/protocol/client_control_sender.h

Issue 7218061: Close all writers before JingleSession is destroyed. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix tests Created 9 years, 5 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 | Annotate | Revision Log
« no previous file with comments | « remoting/protocol/buffered_socket_writer.cc ('k') | remoting/protocol/client_control_sender.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 // Implementation of ClientStub using sockets created from jingle connection. 5 // Implementation of ClientStub using sockets created from jingle connection.
6 // It sends messages through the socket after serializing it. 6 // It sends messages through the socket after serializing it.
7 // 7 //
8 // Object of this class can only be created by ConnectionToClient. 8 // Object of this class can only be created by ConnectionToClient.
9 // 9 //
10 // This class can be used on any thread. 10 // This class can be used on any thread.
11 11
12 #ifndef REMOTING_PROTOCOL_CLIENT_STUB_IMPL_H_ 12 #ifndef REMOTING_PROTOCOL_CLIENT_STUB_IMPL_H_
13 #define REMOTING_PROTOCOL_CLIENT_STUB_IMPL_H_ 13 #define REMOTING_PROTOCOL_CLIENT_STUB_IMPL_H_
14 14
15 #include "base/basictypes.h" 15 #include "base/basictypes.h"
16 #include "base/memory/ref_counted.h" 16 #include "base/memory/ref_counted.h"
17 #include "remoting/protocol/client_stub.h" 17 #include "remoting/protocol/client_stub.h"
18 18
19 class Task; 19 class Task;
20 20
21 namespace net { 21 namespace net {
22 class Socket; 22 class Socket;
23 } // namespace net 23 } // namespace net
24 24
25 namespace remoting { 25 namespace remoting {
26 namespace protocol { 26 namespace protocol {
27 27
28 class BufferedSocketWriter; 28 class BufferedSocketWriter;
29 29
30 // Implementation of ClientStub that sends commands on a socket. Must
31 // be created and closed on the network thread, but can be used on any
32 // other thread.
30 class ClientControlSender : public ClientStub { 33 class ClientControlSender : public ClientStub {
31 public: 34 public:
32 // Create a stub using a socket.
33 explicit ClientControlSender(net::Socket* socket); 35 explicit ClientControlSender(net::Socket* socket);
34 virtual ~ClientControlSender(); 36 virtual ~ClientControlSender();
35 37
36 virtual void NotifyResolution(const NotifyResolutionRequest* msg, 38 virtual void NotifyResolution(const NotifyResolutionRequest* msg,
37 Task* done); 39 Task* done);
38 virtual void BeginSessionResponse(const LocalLoginStatus* msg, 40 virtual void BeginSessionResponse(const LocalLoginStatus* msg,
39 Task* done); 41 Task* done);
40 42
43 // Stop writing. Must be called on the network thread when the
44 // underlying socket is being destroyed.
45 void Close();
46
41 private: 47 private:
42 // Buffered socket writer holds the serialized message and send it on the 48 // Buffered socket writer holds the serialized message and send it on the
43 // right thread. 49 // right thread.
44 scoped_refptr<BufferedSocketWriter> buffered_writer_; 50 scoped_refptr<BufferedSocketWriter> buffered_writer_;
45 51
46 DISALLOW_COPY_AND_ASSIGN(ClientControlSender); 52 DISALLOW_COPY_AND_ASSIGN(ClientControlSender);
47 }; 53 };
48 54
49 } // namespace protocol 55 } // namespace protocol
50 } // namespace remoting 56 } // namespace remoting
51 57
52 #endif // REMOTING_PROTOCOL_CLIENT_STUB_IMPL_H_ 58 #endif // REMOTING_PROTOCOL_CLIENT_STUB_IMPL_H_
OLDNEW
« no previous file with comments | « remoting/protocol/buffered_socket_writer.cc ('k') | remoting/protocol/client_control_sender.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698