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

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

Issue 4017002: HostMessageDispatcher to parse control messages (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: merged again Created 10 years, 1 month 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/socket_reader_base.h ('k') | remoting/protocol/stream_reader.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef REMOTING_PROTOCOL_STREAM_READER_H_
6 #define REMOTING_PROTOCOL_STREAM_READER_H_
7
8 #include "base/callback.h"
9 #include "base/scoped_ptr.h"
10 #include "remoting/protocol/socket_reader_base.h"
11
12 namespace remoting {
13
14 class EventStreamReader : public SocketReaderBase {
15 public:
16 EventStreamReader();
17 ~EventStreamReader();
18
19 // The OnMessageCallback is called whenever a new message is received.
20 // Ownership of the message is passed the callback.
21 typedef Callback1<ChromotingClientMessage*>::Type OnMessageCallback;
22
23 // Initialize the reader and start reading. Must be called on the thread
24 // |socket| belongs to. The callback will be called when a new message is
25 // received. EventStreamReader owns |on_message_callback|, doesn't own
26 // |socket|.
27 void Init(net::Socket* socket, OnMessageCallback* on_message_callback);
28
29 protected:
30 virtual void OnDataReceived(net::IOBuffer* buffer, int data_size);
31
32 private:
33 MessagesDecoder messages_decoder_;
34 scoped_ptr<OnMessageCallback> on_message_callback_;
35
36 DISALLOW_COPY_AND_ASSIGN(EventStreamReader);
37 };
38
39 class VideoStreamReader : public SocketReaderBase {
40 public:
41 VideoStreamReader();
42 ~VideoStreamReader();
43
44 // The OnMessageCallback is called whenever a new message is received.
45 // Ownership of the message is passed the callback.
46 typedef Callback1<ChromotingHostMessage*>::Type OnMessageCallback;
47
48 // Initialize the reader and start reading. Must be called on the thread
49 // |socket| belongs to. The callback will be called when a new message is
50 // received. VideoStreamReader owns |on_message_callback|, doesn't own
51 // |socket|.
52 void Init(net::Socket* socket, OnMessageCallback* on_message_callback);
53
54 protected:
55 virtual void OnDataReceived(net::IOBuffer* buffer, int data_size);
56
57 private:
58 MessagesDecoder messages_decoder_;
59 scoped_ptr<OnMessageCallback> on_message_callback_;
60
61 DISALLOW_COPY_AND_ASSIGN(VideoStreamReader);
62 };
63
64 } // namespace remoting
65
66 #endif // REMOTING_PROTOCOL_STREAM_READER_H_
OLDNEW
« no previous file with comments | « remoting/protocol/socket_reader_base.h ('k') | remoting/protocol/stream_reader.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698