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

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

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/protocol/messages_decoder.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
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 #include "remoting/protocol/messages_decoder.h" 5 #include "remoting/protocol/messages_decoder.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "net/base/io_buffer.h"
8 #include "remoting/base/multiple_array_input_stream.h" 9 #include "remoting/base/multiple_array_input_stream.h"
9 #include "talk/base/byteorder.h" 10 #include "talk/base/byteorder.h"
10 11
11 namespace remoting { 12 namespace remoting {
12 13
13 MessagesDecoder::MessagesDecoder() 14 MessagesDecoder::MessagesDecoder()
14 : last_read_position_(0), 15 : last_read_position_(0),
15 available_bytes_(0), 16 available_bytes_(0),
16 next_payload_(0), 17 next_payload_(0),
17 next_payload_known_(false) { 18 next_payload_known_(false) {
18 } 19 }
19 20
20 MessagesDecoder::~MessagesDecoder() {} 21 MessagesDecoder::~MessagesDecoder() {}
21 22
22 void MessagesDecoder::ParseClientMessages(scoped_refptr<net::IOBuffer> data, 23 void MessagesDecoder::ParseClientMessages(scoped_refptr<net::IOBuffer> data,
23 int data_size, 24 int data_size,
24 ClientMessageList* messages) { 25 ClientMessageList* messages) {
25 ParseMessages<ChromotingClientMessage>(data, data_size, messages); 26 ParseMessages<ChromotingClientMessage>(data, data_size, messages);
26 } 27 }
27 28
28 void MessagesDecoder::ParseHostMessages(scoped_refptr<net::IOBuffer> data, 29 void MessagesDecoder::ParseHostMessages(scoped_refptr<net::IOBuffer> data,
29 int data_size, 30 int data_size,
30 HostMessageList* messages) { 31 HostMessageList* messages) {
31 ParseMessages<ChromotingHostMessage>(data, data_size, messages); 32 ParseMessages<ChromotingHostMessage>(data, data_size, messages);
32 } 33 }
33 34
35 MessagesDecoder::DataChunk::DataChunk(net::IOBuffer* data, size_t data_size)
36 : data(data),
37 data_size(data_size) {
38 }
39
40 MessagesDecoder::DataChunk::~DataChunk() {}
41
34 template <typename T> 42 template <typename T>
35 void MessagesDecoder::ParseMessages(scoped_refptr<net::IOBuffer> data, 43 void MessagesDecoder::ParseMessages(scoped_refptr<net::IOBuffer> data,
36 int data_size, 44 int data_size,
37 std::list<T*>* messages) { 45 std::list<T*>* messages) {
38 // If this is the first data in the processing queue, then set the 46 // If this is the first data in the processing queue, then set the
39 // last read position to 0. 47 // last read position to 0.
40 if (data_list_.empty()) 48 if (data_list_.empty())
41 last_read_position_ = 0; 49 last_read_position_ = 0;
42 50
43 // First enqueue the data received. 51 // First enqueue the data received.
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 145
138 if (header.length() == kHeaderSize) { 146 if (header.length() == kHeaderSize) {
139 *size = talk_base::GetBE32(header.c_str()); 147 *size = talk_base::GetBE32(header.c_str());
140 return true; 148 return true;
141 } 149 }
142 NOTREACHED() << "Unable to extract payload size"; 150 NOTREACHED() << "Unable to extract payload size";
143 return false; 151 return false;
144 } 152 }
145 153
146 } // namespace remoting 154 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/protocol/messages_decoder.h ('k') | remoting/protocol/stream_reader.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698