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

Side by Side Diff: remoting/client/plugin/chromoting_instance.cc

Issue 9331003: Improving the decoder pipeline. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebased Created 8 years, 10 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/client/plugin/chromoting_instance.h" 5 #include "remoting/client/plugin/chromoting_instance.h"
6 6
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 LOG(ERROR) << "Media library not initialized."; 111 LOG(ERROR) << "Media library not initialized.";
112 return false; 112 return false;
113 } 113 }
114 114
115 // Start all the threads. 115 // Start all the threads.
116 context_.Start(); 116 context_.Start();
117 117
118 // Create the chromoting objects that don't depend on the network connection. 118 // Create the chromoting objects that don't depend on the network connection.
119 // Because we decode on a separate thread we need a FrameConsumerProxy to 119 // Because we decode on a separate thread we need a FrameConsumerProxy to
120 // bounce calls from the RectangleUpdateDecoder back to the plugin thread. 120 // bounce calls from the RectangleUpdateDecoder back to the plugin thread.
121 view_.reset(new PepperView(this, &context_)); 121 consumer_proxy_ = new FrameConsumerProxy(plugin_message_loop_);
122 consumer_proxy_ = new FrameConsumerProxy(view_.get(), plugin_message_loop_);
123 rectangle_decoder_ = new RectangleUpdateDecoder( 122 rectangle_decoder_ = new RectangleUpdateDecoder(
124 context_.decode_message_loop(), consumer_proxy_.get()); 123 context_.decode_message_loop(), consumer_proxy_.get());
124 view_.reset(new PepperView(this, &context_, rectangle_decoder_.get()));
125 consumer_proxy_->Attach(view_.get());
125 126
126 // Default to a medium grey. 127 // Default to a medium grey.
127 view_->SetSolidFill(0xFFCDCDCD); 128 view_->SetSolidFill(0xFFCDCDCD);
128 129
129 return true; 130 return true;
130 } 131 }
131 132
132 void ChromotingInstance::Connect(const ClientConfig& config) { 133 void ChromotingInstance::Connect(const ClientConfig& config) {
133 DCHECK(plugin_message_loop_->BelongsToCurrentThread()); 134 DCHECK(plugin_message_loop_->BelongsToCurrentThread());
134 135
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 GetScriptableObject()->SetConnectionStatus( 189 GetScriptableObject()->SetConnectionStatus(
189 ChromotingScriptableObject::STATUS_CLOSED, 190 ChromotingScriptableObject::STATUS_CLOSED,
190 ChromotingScriptableObject::ERROR_NONE); 191 ChromotingScriptableObject::ERROR_NONE);
191 } 192 }
192 193
193 void ChromotingInstance::DidChangeView(const pp::Rect& position, 194 void ChromotingInstance::DidChangeView(const pp::Rect& position,
194 const pp::Rect& clip) { 195 const pp::Rect& clip) {
195 DCHECK(plugin_message_loop_->BelongsToCurrentThread()); 196 DCHECK(plugin_message_loop_->BelongsToCurrentThread());
196 197
197 SkISize new_size = SkISize::Make(position.width(), position.height()); 198 SkISize new_size = SkISize::Make(position.width(), position.height());
198 if (view_->SetViewSize(new_size)) { 199 SkIRect new_clip =
200 SkIRect::MakeXYWH(clip.x(), clip.y(), clip.width(), clip.height());
201
202 if (view_->SetView(new_size, new_clip)) {
199 if (mouse_input_filter_.get()) { 203 if (mouse_input_filter_.get()) {
200 mouse_input_filter_->set_input_size(new_size); 204 mouse_input_filter_->set_input_size(new_size);
201 } 205 }
202 rectangle_decoder_->SetOutputSize(new_size);
203 } 206 }
204
205 rectangle_decoder_->UpdateClipRect(
206 SkIRect::MakeXYWH(clip.x(), clip.y(), clip.width(), clip.height()));
207 } 207 }
208 208
209 bool ChromotingInstance::HandleInputEvent(const pp::InputEvent& event) { 209 bool ChromotingInstance::HandleInputEvent(const pp::InputEvent& event) {
210 DCHECK(plugin_message_loop_->BelongsToCurrentThread()); 210 DCHECK(plugin_message_loop_->BelongsToCurrentThread());
211 211
212 if (!input_handler_.get()) 212 if (!input_handler_.get())
213 return false; 213 return false;
214 214
215 // TODO(wez): When we have a good hook into Host dimensions changes, move 215 // TODO(wez): When we have a good hook into Host dimensions changes, move
216 // this there. 216 // this there.
217 // If |input_handler_| is valid, then |mouse_input_filter_| must also be 217 // If |input_handler_| is valid, then |mouse_input_filter_| must also be
218 // since they are constructed together as part of the input pipeline 218 // since they are constructed together as part of the input pipeline
219 mouse_input_filter_->set_output_size(view_->get_host_size()); 219 mouse_input_filter_->set_output_size(view_->get_screen_size());
220 220
221 return input_handler_->HandleInputEvent(event); 221 return input_handler_->HandleInputEvent(event);
222 } 222 }
223 223
224 ChromotingScriptableObject* ChromotingInstance::GetScriptableObject() { 224 ChromotingScriptableObject* ChromotingInstance::GetScriptableObject() {
225 pp::VarPrivate object = GetInstanceObject(); 225 pp::VarPrivate object = GetInstanceObject();
226 if (!object.is_undefined()) { 226 if (!object.is_undefined()) {
227 pp::deprecated::ScriptableObject* so = object.AsScriptableObject(); 227 pp::deprecated::ScriptableObject* so = object.AsScriptableObject();
228 DCHECK(so != NULL); 228 DCHECK(so != NULL);
229 return static_cast<ChromotingScriptableObject*>(so); 229 return static_cast<ChromotingScriptableObject*>(so);
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
346 return client_->GetStats(); 346 return client_->GetStats();
347 } 347 }
348 348
349 void ChromotingInstance::ReleaseAllKeys() { 349 void ChromotingInstance::ReleaseAllKeys() {
350 if (key_event_tracker_.get()) { 350 if (key_event_tracker_.get()) {
351 key_event_tracker_->ReleaseAllKeys(); 351 key_event_tracker_->ReleaseAllKeys();
352 } 352 }
353 } 353 }
354 354
355 } // namespace remoting 355 } // namespace remoting
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698