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

Side by Side Diff: remoting/host/client_connection.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/host/client_connection.h ('k') | remoting/host/event_executor_win.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/host/client_connection.h" 5 #include "remoting/host/client_connection.h"
6 6
7 #include "google/protobuf/message.h" 7 #include "google/protobuf/message.h"
8 #include "media/base/data_buffer.h" 8 #include "media/base/data_buffer.h"
9 #include "remoting/base/protocol_decoder.h" 9 #include "remoting/base/protocol_decoder.h"
10 #include "remoting/base/protocol_util.h" 10 #include "remoting/base/protocol_util.h"
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 size_in_queue_ += update_stream_size_; 108 size_in_queue_ += update_stream_size_;
109 size_queue_.push_back(update_stream_size_); 109 size_queue_.push_back(update_stream_size_);
110 if (size_queue_.size() > kAverageUpdateStream) { 110 if (size_queue_.size() > kAverageUpdateStream) {
111 size_in_queue_ -= size_queue_.front(); 111 size_in_queue_ -= size_queue_.front();
112 size_queue_.pop_front(); 112 size_queue_.pop_front();
113 DCHECK_GE(size_in_queue_, 0); 113 DCHECK_GE(size_in_queue_, 0);
114 } 114 }
115 update_stream_size_ = 0; 115 update_stream_size_ = 0;
116 } 116 }
117 117
118 void ClientConnection::MarkEndOfUpdate() {
119 // This is some logic to help calculate the average update stream size.
120 size_in_queue_ += update_stream_size_;
121 size_queue_.push_back(update_stream_size_);
122 if (size_queue_.size() > kAverageUpdateStream) {
123 size_in_queue_ -= size_queue_.front();
124 size_queue_.pop_front();
125 DCHECK_GE(size_in_queue_, 0);
126 }
127 update_stream_size_ = 0;
128 }
129
118 int ClientConnection::GetPendingUpdateStreamMessages() { 130 int ClientConnection::GetPendingUpdateStreamMessages() {
119 DCHECK_EQ(loop_, MessageLoop::current()); 131 DCHECK_EQ(loop_, MessageLoop::current());
120 132
121 if (!size_queue_.size()) 133 if (!size_queue_.size())
122 return 0; 134 return 0;
123 int average_size = size_in_queue_ / size_queue_.size(); 135 int average_size = size_in_queue_ / size_queue_.size();
124 if (!average_size) 136 if (!average_size)
125 return 0; 137 return 0;
126 return channel_->write_buffer_size() / average_size; 138 return channel_->write_buffer_size() / average_size;
127 } 139 }
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 DCHECK(decoder_.get()); 192 DCHECK(decoder_.get());
181 ClientMessageList list; 193 ClientMessageList list;
182 decoder_->ParseClientMessages(data, &list); 194 decoder_->ParseClientMessages(data, &list);
183 195
184 // Then submit the messages to the handler. 196 // Then submit the messages to the handler.
185 DCHECK(handler_); 197 DCHECK(handler_);
186 handler_->HandleMessages(this, &list); 198 handler_->HandleMessages(this, &list);
187 } 199 }
188 200
189 } // namespace remoting 201 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/host/client_connection.h ('k') | remoting/host/event_executor_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698