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

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

Issue 3814013: FBTF: Monster ctor patch after changing heuristics in clang plugin. (Closed) Base URL: http://git.chromium.org/git/chromium.git
Patch Set: More add file fail Created 10 years, 2 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/host/json_host_config.cc ('k') | remoting/protocol/messages_decoder.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) 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 #ifndef REMOTING_PROTOCOL_MESSAGES_DECODER_H_ 5 #ifndef REMOTING_PROTOCOL_MESSAGES_DECODER_H_
6 #define REMOTING_PROTOCOL_MESSAGES_DECODER_H_ 6 #define REMOTING_PROTOCOL_MESSAGES_DECODER_H_
7 7
8 #include <deque> 8 #include <deque>
9 #include <list> 9 #include <list>
10 10
11 #include "base/ref_counted.h" 11 #include "base/ref_counted.h"
12 #include "google/protobuf/message_lite.h" 12 #include "google/protobuf/message_lite.h"
13 #include "net/base/io_buffer.h"
14 #include "remoting/base/protocol/chromotocol.pb.h" 13 #include "remoting/base/protocol/chromotocol.pb.h"
15 14
15 namespace net {
16 class IOBuffer;
17 }
18
16 namespace remoting { 19 namespace remoting {
17 20
18 typedef std::list<ChromotingHostMessage*> HostMessageList; 21 typedef std::list<ChromotingHostMessage*> HostMessageList;
19 typedef std::list<ChromotingClientMessage*> ClientMessageList; 22 typedef std::list<ChromotingClientMessage*> ClientMessageList;
20 23
21 // A protocol decoder is used to decode data transmitted in the chromoting 24 // A protocol decoder is used to decode data transmitted in the chromoting
22 // network. 25 // network.
23 // TODO(hclam): Defines the interface and implement methods. 26 // TODO(hclam): Defines the interface and implement methods.
24 class MessagesDecoder { 27 class MessagesDecoder {
25 public: 28 public:
26 MessagesDecoder(); 29 MessagesDecoder();
27 virtual ~MessagesDecoder(); 30 virtual ~MessagesDecoder();
28 31
29 // Parse data received from network into ClientMessages. Output is written 32 // Parse data received from network into ClientMessages. Output is written
30 // to |messages|. 33 // to |messages|.
31 virtual void ParseClientMessages(scoped_refptr<net::IOBuffer> data, 34 virtual void ParseClientMessages(scoped_refptr<net::IOBuffer> data,
32 int data_size, 35 int data_size,
33 ClientMessageList* messages); 36 ClientMessageList* messages);
34 37
35 // Parse data received from network into HostMessages. Output is 38 // Parse data received from network into HostMessages. Output is
36 // written to |messages|. 39 // written to |messages|.
37 virtual void ParseHostMessages(scoped_refptr<net::IOBuffer> data, 40 virtual void ParseHostMessages(scoped_refptr<net::IOBuffer> data,
38 int data_size, 41 int data_size,
39 HostMessageList* messages); 42 HostMessageList* messages);
40 43
41 private: 44 private:
42 // DataChunk stores reference to a net::IOBuffer and size of the data 45 // DataChunk stores reference to a net::IOBuffer and size of the data
43 // stored in that buffer. 46 // stored in that buffer.
44 struct DataChunk { 47 struct DataChunk {
45 DataChunk(net::IOBuffer* data, size_t data_size) 48 DataChunk(net::IOBuffer* data, size_t data_size);
46 : data(data), 49 ~DataChunk();
47 data_size(data_size) {
48 }
49 50
50 scoped_refptr<net::IOBuffer> data; 51 scoped_refptr<net::IOBuffer> data;
51 size_t data_size; 52 size_t data_size;
52 }; 53 };
53 54
54 // TODO(sergeyu): It might be more efficient to memcopy data to one big buffer 55 // TODO(sergeyu): It might be more efficient to memcopy data to one big buffer
55 // instead of storing chunks in dqueue. 56 // instead of storing chunks in dqueue.
56 typedef std::deque<DataChunk> DataList; 57 typedef std::deque<DataChunk> DataList;
57 58
58 // A private method used to parse data received from network into protocol 59 // A private method used to parse data received from network into protocol
(...skipping 21 matching lines...) Expand all
80 size_t next_payload_; 81 size_t next_payload_;
81 82
82 // True if the size of the next payload is known. After one payload is read, 83 // True if the size of the next payload is known. After one payload is read,
83 // this is reset to false. 84 // this is reset to false.
84 bool next_payload_known_; 85 bool next_payload_known_;
85 }; 86 };
86 87
87 } // namespace remoting 88 } // namespace remoting
88 89
89 #endif // REMOTING_PROTOCOL_MESSAGES_DECODER_H_ 90 #endif // REMOTING_PROTOCOL_MESSAGES_DECODER_H_
OLDNEW
« no previous file with comments | « remoting/host/json_host_config.cc ('k') | remoting/protocol/messages_decoder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698