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

Side by Side Diff: remoting/base/protocol_decoder.cc

Issue 3305001: Move decoder into separate thread, clean up API layering, and redo update protocl (Closed)
Patch Set: Fix compile error. 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
« no previous file with comments | « remoting/base/protocol_decoder.h ('k') | remoting/base/protocol_decoder_unittest.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/base/protocol_decoder.h" 5 #include "remoting/base/protocol_decoder.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "remoting/base/multiple_array_input_stream.h" 8 #include "remoting/base/multiple_array_input_stream.h"
9 #include "talk/base/byteorder.h" 9 #include "talk/base/byteorder.h"
10 10
(...skipping 11 matching lines...) Expand all
22 ParseMessages<ChromotingClientMessage>(data, messages); 22 ParseMessages<ChromotingClientMessage>(data, messages);
23 } 23 }
24 24
25 void ProtocolDecoder::ParseHostMessages(scoped_refptr<media::DataBuffer> data, 25 void ProtocolDecoder::ParseHostMessages(scoped_refptr<media::DataBuffer> data,
26 HostMessageList* messages) { 26 HostMessageList* messages) {
27 ParseMessages<ChromotingHostMessage>(data, messages); 27 ParseMessages<ChromotingHostMessage>(data, messages);
28 } 28 }
29 29
30 template <typename T> 30 template <typename T>
31 void ProtocolDecoder::ParseMessages(scoped_refptr<media::DataBuffer> data, 31 void ProtocolDecoder::ParseMessages(scoped_refptr<media::DataBuffer> data,
32 std::vector<T*>* messages) { 32 std::list<T*>* messages) {
33 // If this is the first data in the processing queue, then set the 33 // If this is the first data in the processing queue, then set the
34 // last read position to 0. 34 // last read position to 0.
35 if (data_list_.empty()) 35 if (data_list_.empty())
36 last_read_position_ = 0; 36 last_read_position_ = 0;
37 37
38 // First enqueue the data received. 38 // First enqueue the data received.
39 data_list_.push_back(data); 39 data_list_.push_back(data);
40 available_bytes_ += data->GetDataSize(); 40 available_bytes_ += data->GetDataSize();
41 41
42 // Then try to parse one message until we can't parse anymore. 42 // Then try to parse one message until we can't parse anymore.
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 140
141 if (header.length() == kHeaderSize) { 141 if (header.length() == kHeaderSize) {
142 *size = talk_base::GetBE32(header.c_str()); 142 *size = talk_base::GetBE32(header.c_str());
143 return true; 143 return true;
144 } 144 }
145 NOTREACHED() << "Unable to extract payload size"; 145 NOTREACHED() << "Unable to extract payload size";
146 return false; 146 return false;
147 } 147 }
148 148
149 } // namespace remoting 149 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/base/protocol_decoder.h ('k') | remoting/base/protocol_decoder_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698